- Joined
- Jul 17, 2011
- Messages
- 55
My problem here is that I wanted to make a dash spell. The dash is supposed to damage units when passed, ONLY ONCE! using group arrays. I searched for an alternative, which is to use local unit groups and hashtables together, which worked. my spell now damages once! for each unit, BUT ONLY AFTER IT'S BEEN CASTED ONCE! meaning, at first cast, it damages units multiple times periodically. the next time the spell is casted, it won't bug anymore. WHAT'S WRONG???
BY THE WAY, USING BRIBE's indexing system. works like a charm!
On Spell Cast
BY THE WAY, USING BRIBE's indexing system. works like a charm!
On Spell Cast
-
Cast Spell
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Bladespin
-
Actions
- Custom script: local group dg = CreateGroup()
- Set TempUnit = (Triggering unit)
- Hashtable - Save Handle Of(Last created unit group) as 0 of ID in Hashtable
- Set ID = (Custom value of (Triggering unit))
- Set Duration_Index[ID] = 4.00
- Set Angle_Index[ID] = (Facing of (Triggering unit))
- Set Radius_Index[ID] = 250.00
- Set Damage_Index[ID] = 50.00
- Set Angle_Index[ID] = (Facing of (Triggering unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Group is empty) Equal to True
-
Then - Actions
- Trigger - Turn on Loop Spell <gen>
- Else - Actions
-
If - Conditions
- Unit Group - Add TempUnit to Group
-
Events
-
Loop Spell
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in Group and do (Actions)
-
Loop - Actions
- Set TempUnit = (Picked unit)
- Set ID = (Custom value of TempUnit)
- Set TempLoc = (Position of TempUnit)
- Set TempAngle = Angle_Index[ID]
- Set TempOffset = (TempLoc offset by 22.00 towards TempAngle degrees)
- Set TempRadius = Radius_Index[ID]
- Set TempDamage = Damage_Index[ID]
- Set Group_Damaged = (Load 0 of ID in Hashtable)
- Game - Display to (All players) the text: (String((Number of units in Group_Damaged)))
- Unit - Move TempUnit instantly to TempOffset
- Animation - Play TempUnit's attack stand walk spin animation
- Custom script: call RemoveLocation(udg_TempLoc)
- Custom script: set udg_TempGroup = CreateGroup()
- Set TempGroup = (Units within TempRadius of TempOffset matching ((((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is in Gr
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to Group_Damaged
- Unit - Cause TempUnit to damage (Picked unit), dealing TempDamage damage of attack type Hero and damage type Normal
-
Loop - Actions
- Hashtable - Save Handle OfGroup_Damaged as 0 of ID in Hashtable
- Custom script: call DestroyGroup (udg_TempGroup)
- Custom script: call RemoveLocation(udg_TempLoc)
- Custom script: call RemoveLocation(udg_TempOffset)
- Set Duration_Index[ID] = (Duration_Index[ID] - 0.03)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Duration_Index[ID] Less than or equal to 0.00
-
Then - Actions
- Unit Group - Remove TempUnit from Group
- Animation - Play TempUnit's stand animation
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Group is empty) Equal to True
-
Then - Actions
- Trigger - Turn off Loop Spell <gen>
- Else - Actions
-
If - Conditions
- Else - ActionS
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in Group and do (Actions)
-
Events
Last edited by a moderator: