[trigger=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)
[/trigger][trigger=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)
[/trigger][trigger=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)
[/trigger]