• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Custom Ability Source Cost v1.1

  • Like
Reactions: deepstrasz
Allows you to use custom ability source cost.
[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]

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)
Contents

Custom Ability Source Cost v1.0 (Map)

Reviews
16:17, 30th Sep 2012 Magtheridon96: Approved. Exactly how I would make it. (Except, I'd do it in vJASS of course :P)

Moderator

M

Moderator

16:17, 30th Sep 2012
Magtheridon96: Approved.
Exactly how I would make it. (Except, I'd do it in vJASS of course :p)
 
Top