- Joined
- Jul 9, 2012
- Messages
- 159
Hello again!
I have just started working with hashtables and everything works fine except one thing.
I'm trying to make a trigger where a unit will spawn every 30 seconds. Its spawning location will then be saved in a hashtable. Later on, if the unit casts a chain lightning ability at a target, it will be teleported to its initial spawning point and will then start dragging the targeted unit towards it.
Everything works fine in my trigger except the location where it spawned isn't stored into the hashtable, and it then moves to the center of the map instead.
Here are the triggers:
Thank you!
I have just started working with hashtables and everything works fine except one thing.
I'm trying to make a trigger where a unit will spawn every 30 seconds. Its spawning location will then be saved in a hashtable. Later on, if the unit casts a chain lightning ability at a target, it will be teleported to its initial spawning point and will then start dragging the targeted unit towards it.
Everything works fine in my trigger except the location where it spawned isn't stored into the hashtable, and it then moves to the center of the map instead.
Here are the triggers:
-
Initial Variables
-
Events
- Map initialization
- Conditions
-
Actions
- Set Anubarak = Lord of Azjol-Nerub 0001 <gen>
- Set PoisonCloudRegion[1] = Poison Cloud 1 <gen>
- Set PoisonCloudRegion[2] = Poison Cloud 2 <gen>
- Hashtable - Create a hashtable
- Set DiseaseBringerHash = (Last created hashtable)
-
Events
-
Disease Bringer Spawn
-
Events
- Time - Every 30.00 seconds of game time
- Conditions
-
Actions
- Set DiseaseBringerPoint = (Center of PoisonCloudRegion[(Random integer number between 1 and 2)])
- Set CallOfThePlagueCasterPoint = DiseaseBringerPoint
- Unit - Create 1 Disease Bringer for Player 12 (Brown) at DiseaseBringerPoint facing Default building facing degrees
- Hashtable - Save Handle OfCallOfThePlagueCasterPoint as (Key (Last created unit)) of 1 in DiseaseBringerHash
- Custom script: call RemoveLocation(udg_DiseaseBringerPoint)
- Custom script: call RemoveLocation(udg_CallOfThePlagueCasterPoint)
-
Events
-
Call of the Plague
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Call of the Plague
-
Actions
- Set CallOfThePlagueCaster = (Triggering unit)
- Set CallOfThePlagueTarget = (Target unit of ability being cast)
- Hashtable - Save Handle OfCallOfThePlagueTarget as (Key (Triggering unit)) of 2 in DiseaseBringerHash
- Set CallOfThePlagueTargetPoint = (Position of CallOfThePlagueTarget)
- Set CallOfThePlagueCasterPoint = (Load (Key (Triggering unit)) of 1 in DiseaseBringerHash)
- Custom script: call SetUnitX(udg_CallOfThePlagueCaster,GetLocationX(udg_CallOfThePlagueCasterPoint))
- Custom script: call SetUnitY(udg_CallOfThePlagueCaster,GetLocationY(udg_CallOfThePlagueCasterPoint))
- Lightning - Create a Drain Life lightning effect from source CallOfThePlagueCasterPoint to target CallOfThePlagueTargetPoint
- Set CallOfThePlagueLightning = (Last created lightning effect)
- Hashtable - Save Handle OfCallOfThePlagueLightning as (Key (Triggering unit)) of 3 in DiseaseBringerHash
- Unit - Make CallOfThePlagueCaster face CallOfThePlagueTarget over 0.00 seconds
- Unit - Pause CallOfThePlagueCaster
- Special Effect - Create a special effect attached to the head of CallOfThePlagueTarget using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
- Set CallOfThePlagueEffect = (Last created special effect)
- Hashtable - Save Handle OfCallOfThePlagueEffect as (Key (Triggering unit)) of 4 in DiseaseBringerHash
- Custom script: call RemoveLocation(udg_CallOfThePlagueCasterPoint)
- Custom script: call RemoveLocation(udg_CallOfThePlagueTargetPoint)
- Unit Group - Add CallOfThePlagueCaster to CallOfThePlagueUG
- Trigger - Turn on Call of the Plague Loop <gen>
-
Events
-
Call of the Plague Loop
-
Events
- Time - Every 0.04 seconds of game time
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in CallOfThePlagueUG) Greater than 0
-
Then - Actions
-
Unit Group - Pick every unit in CallOfThePlagueUG and do (Actions)
-
Loop - Actions
- Set CallOfThePlagueCaster = (Picked unit)
- Set CallOfThePlagueLightning = (Load (Key (Picked unit)) of 3 in DiseaseBringerHash)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (CallOfThePlagueCaster is alive) Equal to True
-
Then - Actions
- Set CallOfThePlagueTarget = (Load (Key (Picked unit)) of 2 in DiseaseBringerHash)
- Set CallOfThePlagueCasterPoint = (Load (Key (Triggering unit)) of 1 in DiseaseBringerHash)
- Set CallOfThePlagueTargetPoint = (Position of CallOfThePlagueTarget)
- Set CallOfThePlagueTargetMovePoint = (CallOfThePlagueTargetPoint offset by 8.00 towards (Angle from CallOfThePlagueTargetPoint to CallOfThePlagueCasterPoint) degrees)
- Lightning - Move CallOfThePlagueLightning to source CallOfThePlagueTargetMovePoint and target CallOfThePlagueCasterPoint
- Custom script: call SetUnitX(udg_CallOfThePlagueTarget,GetLocationX(udg_CallOfThePlagueTargetMovePoint))
- Custom script: call SetUnitY(udg_CallOfThePlagueTarget,GetLocationY(udg_CallOfThePlagueTargetMovePoint))
- Custom script: call RemoveLocation(udg_CallOfThePlagueCasterPoint)
- Custom script: call RemoveLocation(udg_CallOfThePlagueTargetPoint)
- Custom script: call RemoveLocation(udg_CallOfThePlagueTargetMovePoint)
-
Else - Actions
- Unit Group - Remove CallOfThePlagueCaster from CallOfThePlagueUG
- Lightning - Destroy CallOfThePlagueLightning
- Set CallOfThePlagueEffect = (Load (Key (Picked unit)) of 4 in DiseaseBringerHash)
- Special Effect - Destroy CallOfThePlagueEffect
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in CallOfThePlagueUG and do (Actions)
-
Else - Actions
- Trigger - Turn off (This trigger)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Last edited: