- Joined
- Aug 6, 2009
- Messages
- 697
I made a kamehameha spell and for some reason the main two dummy units gets ahead of the rest of the group, but then the rest of the dummy units catch up to the main dummy units later in the spell.
Ahead of the rest.
Catching Up
Does anyone have any idea why this happens and how to fix it?
Ahead of the rest.
Catching Up
-
Kamehameha
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Kamehameha
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- KH_CurrentIndex Equal to 0
-
Then - Actions
- Trigger - Turn on KamehamehaLoop <gen>
- Else - Actions
-
If - Conditions
- Set KH_CurrentIndex = (KH_CurrentIndex + 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- KH_CurrentIndex Greater than KH_IndexMax
-
Then - Actions
- Set KH_Index[KH_CurrentIndex] = KH_CurrentIndex
- Set KH_IndexMax = KH_CurrentIndex
- Else - Actions
-
If - Conditions
- Set Tempint = KH_Index[KH_CurrentIndex]
- Set KH_Caster[Tempint] = (Triggering unit)
- Set KH_Point = (Position of KH_Caster[Tempint])
- Set KH_Point2 = (Target point of ability being cast)
- Set KH_Angle[Tempint] = (Angle from KH_Point to KH_Point2)
- Set KH_Point3 = (KH_Point offset by 35.00 towards KH_Angle[Tempint] degrees)
- Set KH_Duration[Tempint] = 1.50
- Custom script: if udg_KH_UGroup[udg_Tempint] == null then
- Custom script: set udg_KH_UGroup[udg_Tempint] = CreateGroup()
- Custom script: endif
- -------- Two units added for a better effect. --------
- Unit - Create 1 KameDummyUnit for (Owner of KH_Caster[Tempint]) at KH_Point3 facing Default building facing degrees
- Set KH_DummyUnit[Tempint] = (Last created unit)
- Unit - Create 1 KameDummyUnit for (Owner of KH_Caster[Tempint]) at KH_Point3 facing Default building facing degrees
- Set KH_DummyUnit2[Tempint] = (Last created unit)
- Unit - Pause KH_Caster[Tempint]
- Custom script: call RemoveLocation (udg_KH_Point)
- Custom script: call RemoveLocation (udg_KH_Point2)
- Custom script: call RemoveLocation (udg_KH_Point3)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
-
KamehamehaLoop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
- Game - Display to (All players) the text: on
-
For each (Integer KH_Loop) from 1 to KH_CurrentIndex, do (Actions)
-
Loop - Actions
- Set Tempint = KH_Index[KH_Loop]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- KH_Duration[Tempint] Greater than 0.00
-
Then - Actions
- Game - Display to (All players) the text: (Current Kamehameha Index + (String(KH_CurrentIndex)))
- Set KH_Point = (Position of KH_DummyUnit[Tempint])
- Set KH_Point2 = (KH_Point offset by 35.00 towards KH_Angle[Tempint] degrees)
- Set KH_Duration[Tempint] = (KH_Duration[Tempint] - 0.03)
- Unit - Create 1 KameDummyUnit for (Owner of KH_Caster[Tempint]) at KH_Point facing KH_Angle[Tempint] degrees
- Unit Group - Add (Last created unit) to KH_UGroup[Tempint]
- Unit - Move KH_DummyUnit[Tempint] instantly to KH_Point2
- Unit - Move KH_DummyUnit2[Tempint] instantly to KH_Point2
- Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units within 160.00 of KH_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of KH_Caster[Tempint])) Equal to True) and (((Matching unit) has and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Picked unit) Not equal to No unit
-
Then - Actions
- Set KH_Duration[Tempint] = 0.00
-
Unit Group - Pick every unit in (Units within 300.00 of KH_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of KH_Caster[Tempint])) Equal to True) and (((Matching unit) has and do (Actions)
-
Loop - Actions
- Unit - Cause KH_Caster[Tempint] to damage (Picked unit), dealing (250.00 x (Real((Level of Kamehameha for KH_Caster[Tempint])))) damage of attack type Spells and damage type Normal
-
Loop - Actions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Else - Actions
- Set KH_Index[KH_Loop] = KH_Index[KH_CurrentIndex]
- Set KH_Index[KH_CurrentIndex] = Tempint
- Set KH_CurrentIndex = (KH_CurrentIndex - 1)
- Set KH_Loop = (KH_Loop - 1)
- Set KH_Point = (Position of KH_DummyUnit[Tempint])
- Unit - Create 1 KameDummyExplosion for (Owner of KH_Caster[Tempint]) at KH_Point facing KH_Angle[Tempint] degrees
- Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
- Unit - Remove KH_DummyUnit[Tempint] from the game
- Unit - Remove KH_DummyUnit2[Tempint] from the game
- Unit Group - Pick every unit in KH_UGroup[Tempint] and do (Unit - Remove (Picked unit) from the game)
- Unit Group - Remove all units of KH_UGroup[Tempint] from KH_UGroup[Tempint]
- Unit - Unpause KH_Caster[Tempint]
- Custom script: call RemoveLocation (udg_KH_Point)
-
If - Conditions
- Custom script: call RemoveLocation (udg_KH_Point)
- Custom script: call RemoveLocation (udg_KH_Point2)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- KH_CurrentIndex Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Skip remaining actions
- Else - Actions
-
If - Conditions
-
Events
Last edited by a moderator: