WC3 modding.info

Warcraft (WC3) Modding => Warcraft III Resources => Warcraft III Spells and Systems => Topic started by: radamantus on June 27, 2013, 02:48:58 PM

Rating
Average Score
« Created: June 10, 2017, 06:30:16 AM by moyack »
Title: Custom Ability Source Cost v1.1
Post by: radamantus on June 27, 2013, 02:48:58 PM
Categories: System, GUI
Rating: 4
Image/screenshot:
Warcraft III spell resource
Allows you to use custom ability source cost.

To Import:
Copy the triggers and variables

Setup:
Trigger: Test 1039914570
   
           
  • 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
Trigger: Test 1102395128
   
           
  • 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
Trigger: Test 2054499293
   
           
  • 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)
Title: Custom Ability Source Cost v1.1
Post by: moyack on June 27, 2013, 02:49:26 PM
Please add the code to the first post.
Title: Re: Custom Ability Source Cost v1.1
Post by: sankaku on August 13, 2015, 11:32:19 AM
Or even a map? I see an attachment icon but no attachment.
Title: Re: Custom Ability Source Cost v1.1
Post by: moyack 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.