First off, forgive me if this something fundamental and my brain just refused to learn.
Now to the point, I have a building ability im working on. Its called Coronate. Upon activation it will replace the targeted hero with a hero of type King then summon a group of "elite" units to the nearest Town Hall structure with fancy teleport special effects etc. Since I have a desire to use the actual "Mass Teleport" SFX, I have two triggers, 1. Coronate Hero and 2. Create Elite Units. The first trigger initiates a countdown timer which, upon its expiriation, obviously causes the second trigger to fire.
So I am using a hashtable to keep things MUI but the issue Im facing is that after saving the teleport SFX and nearest town hall location to the hashtable, loading them in the second trigger doesn't seem to work as they seem to reset to default values i.e. when I test the map, the "elite" units are created and the center of the map (which I believe means the default value is being loaded in which means I am incorrectly saving and/or loading the value into the hashtable).
I have reread the code several times and I cannot figure out where its going wrong.
Thanks in advance.
Ps. I realise there are still leaks. I will be attempting to fix them once I solve the hashtable issue. Cheers.
Now to the point, I have a building ability im working on. Its called Coronate. Upon activation it will replace the targeted hero with a hero of type King then summon a group of "elite" units to the nearest Town Hall structure with fancy teleport special effects etc. Since I have a desire to use the actual "Mass Teleport" SFX, I have two triggers, 1. Coronate Hero and 2. Create Elite Units. The first trigger initiates a countdown timer which, upon its expiriation, obviously causes the second trigger to fire.
So I am using a hashtable to keep things MUI but the issue Im facing is that after saving the teleport SFX and nearest town hall location to the hashtable, loading them in the second trigger doesn't seem to work as they seem to reset to default values i.e. when I test the map, the "elite" units are created and the center of the map (which I believe means the default value is being loaded in which means I am incorrectly saving and/or loading the value into the hashtable).
I have reread the code several times and I cannot figure out where its going wrong.
Thanks in advance.
Ps. I realise there are still leaks. I will be attempting to fix them once I solve the hashtable issue. Cheers.
-
Coronate Hero
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Coronate
-
-
Actions
-
Set VariableSet coronateTarget = (Target unit of ability being cast)
-
Set VariableSet coronateUnitTypes[0] = Elite Footman
-
Set VariableSet coronateUnitTypes[1] = Elite Rifleman
-
Set VariableSet coronateUnitTypes[2] = Elite Knight
-
Unit - Replace coronateTarget with a King using The new unit's max life and mana
-
Set VariableSet coronateTarget = (Last replaced unit)
-
Special Effect - Create a special effect attached to the origin of coronateTarget using Abilities\Spells\Human\ReviveHuman\ReviveHuman.mdl
-
Special Effect - Destroy (Last created special effect)
-
Special Effect - Create a special effect attached to the origin of coronateTarget using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
-
Special Effect - Destroy (Last created special effect)
-
Unit - Remove Coronate from (Casting unit)
-
Unit Group - Add (Triggering unit) to coronateCasters
-
Set VariableSet coronateNearestTHDist = 9999999.00
-
Set VariableSet coronateCasterLoc = (Position of (Triggering unit))
-
Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A town-hall-type unit) Equal to True) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))) and do (Actions)
-
Loop - Actions
-
Set VariableSet coronatePickedLoc = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Distance between coronateCasterLoc and coronatePickedLoc) Less than coronateNearestTHDist
-
-
Then - Actions
-
Set VariableSet coronateNearestTH = (Picked unit)
-
Set VariableSet coronateNearestTHDist = (Distance between coronatePickedLoc and (Position of (Picked unit)))
-
-
Else - Actions
-
-
-
-
Set VariableSet coronateNearestTHLoc = (Position of coronateNearestTH)
-
Hashtable - Save Handle OfcoronateNearestTHLoc as 0 of (Key (Triggering unit).) in customHashtable.
-
Special Effect - Create a special effect attached to the origin of coronateNearestTH using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
-
Set VariableSet coronateSFX = (Last created special effect)
-
Hashtable - Save Handle OfcoronateSFX as 1 of (Key (Triggering unit).) in customHashtable.
-
Custom script: call RemoveLocation(udg_coronateCasterLoc)
-
Custom script: call RemoveLocation(udg_coronatePickedLoc)
-
Countdown Timer - Start coronateTimer as a One-shot timer that will expire in 2.00 seconds
-
-
-
Create Elite Units
-
Events
-
Time - coronateTimer expires
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in coronateCasters and do (Actions)
-
Loop - Actions
-
Set VariableSet coronateUnitCount = 0
-
Set VariableSet coronateUnitIndex = 0
-
Set VariableSet coronateNearestTHLoc = (Load 0 of (Key (Picked unit).) in customHashtable.)
-
Set VariableSet coronateSFX = (Load 1 of (Key (Picked unit).) in customHashtable.)
-
Special Effect - Destroy coronateSFX
-
For each (Integer A) from 1 to coronateNumUnits, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
coronateUnitCount Equal to 4
-
-
Then - Actions
-
Set VariableSet coronateUnitCount = 0
-
Set VariableSet coronateUnitIndex = (coronateUnitIndex + 1)
-
-
Else - Actions
-
Set VariableSet coronateUnitCount = (coronateUnitCount + 1)
-
-
-
Unit - Create 1 coronateUnitTypes[coronateUnitIndex] for (Owner of (Picked unit)) at coronateNearestTHLoc facing Default building facing degrees
-
Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
-
Special Effect - Destroy (Last created special effect)
-
-
-
-
-
-