Warcraft 3 documentation

vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

Custom Ability Source Cost v1.1 No New Posts Warcraft III Spells and Systems

Started by
radamantus

0 Members and 1 Guest are viewing this topic.

Rating

Average Score - 4 / 5

« Created: June 10, 2017, 06:30:16 AM by moyack »

Custom Ability Source Cost v1.1
on: June 27, 2013, 02:48:58 PM
Categories: System, GUI
Rating: 4
Warcraft III Spell resource
« Created: June 10, 2017, 06:30:02 AM by moyack »

Allows you to use custom ability source cost.

To Import:
Copy the triggers and variables

Setup:
CASC Setup
Events
Map initialization
Conditions
Actions
Custom script: set udg_CASC_Hash = InitHashtable()
-------- --------------------------- --------
-------- Determines the abilities and its required resource --------
-------- --------------------------- --------
Set CASC_Abil = Example 1
Set CASC_Gold = 100
Set CASC_Lumber = 75
Set CASC_Life = 0.00
Set CASC_Mana = 0.00
-------- --------------------------- --------
-------- Save --------
-------- --------------------------- --------
Trigger - Run CASC Save <gen> (ignoring conditions)
Set CASC_Abil = Example 2
Set CASC_Gold = 0
Set CASC_Lumber = 0
Set CASC_Life = 100.00
Set CASC_Mana = 75.00
-------- --------------------------- --------
-------- Save --------
-------- --------------------------- --------
Trigger - Run CASC Save <gen> (ignoring conditions)
 

Save
CASC Save
Events
Conditions
Actions
Custom script: call SaveInteger(udg_CASC_Hash,udg_CASC_Abil,1,udg_CASC_Gold)
Custom script: call SaveInteger(udg_CASC_Hash,udg_CASC_Abil,2,udg_CASC_Lumber)
Custom script: call SaveReal(udg_CASC_Hash,udg_CASC_Abil,3,udg_CASC_Life)
Custom script: call SaveReal(udg_CASC_Hash,udg_CASC_Abil,4,udg_CASC_Mana)
 

Cast
CASC Cast
Events
Unit - A unit Begins casting an ability
Conditions
Actions
Custom script: set udg_CASC_TempAbil = GetSpellAbilityId()
Set CASC_Caster = (Triggering unit)
Set CASC_Player = (Triggering player)
-------- --------------------------- --------
-------- Load --------
-------- --------------------------- --------
Set CASC_LoadGold = (Load 1 of CASC_TempAbil from CASC_Hash)
Set CASC_LoadLumber = (Load 2 of CASC_TempAbil from CASC_Hash)
Set CASC_LoadLife = (Load 3 of CASC_TempAbil from CASC_Hash)
Set CASC_LoadMana = (Load 4 of CASC_TempAbil from CASC_Hash)
-------- --------------------------- --------
-------- Variables --------
-------- --------------------------- --------
Set CASC_CurrentGold = (CASC_Player Current gold)
Set CASC_CurrentLumber = (CASC_Player Current lumber)
Set CASC_CurrentLife = (Life of CASC_Caster)
Set CASC_CurrentMana = (Mana of CASC_Caster)
-------- --------------------------- --------
-------- Checking --------
-------- --------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
CASC_CurrentGold Greater than CASC_LoadGold
CASC_CurrentLumber Greater than CASC_LoadLumber
CASC_CurrentLife Greater than CASC_LoadLife
CASC_CurrentMana Greater than CASC_LoadMana
Then - Actions
Unit - Set life of CASC_Caster to (CASC_CurrentLife - CASC_LoadLife)
Unit - Set mana of CASC_Caster to (CASC_CurrentMana - CASC_LoadMana)
Player - Set CASC_Player Current gold to (CASC_CurrentGold - CASC_LoadGold)
Player - Set CASC_Player Current lumber to (CASC_CurrentLumber - CASC_LoadLumber)
Else - Actions
Unit - Order CASC_Caster to Stop
Set CASC_TempPlayer = (Player group(CASC_Player))
Game - Display to CASC_TempPlayer the text: |cffffcc00Not enoug...
Custom script: call DestroyForce(udg_CASC_TempPlayer)
 


Quote
Changelog
v1.1
-Changed event(due to quick casting)
-Removed ability remove and add.(if matched with my new event,the caster will be stuck up)
« Last Edit: June 10, 2017, 06:30:02 AM by moyack »



Custom Ability Source Cost v1.1
Reply #1 on: June 27, 2013, 02:49:26 PM

Please add the code to the first post.


Re: Custom Ability Source Cost v1.1
Reply #2 on: August 13, 2015, 11:32:19 AM

Or even a map? I see an attachment icon but no attachment.



Re: Custom Ability Source Cost v1.1
Reply #3 on: August 16, 2015, 10:01:55 PM

Or even a map? I see an attachment icon but no attachment.
Ok, added the file map. Thanks for reporting this issue.


 

* Random Spells & Systems

Started by moyack

Replies: 4
Views: 15865
Site Discussion

Started by grim001

Replies: 0
Views: 704
Codes & Snippets

Started by Archmage Owenalacaster

Replies: 0
Views: 1151
Codes & Snippets

Started by Magtheridon96

Replies: 3
Views: 9577
Jass Tutorials

Started by rvonsonsnadtz

Replies: 10
Views: 19810
Coding Help
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)