I've been tinkering with many different ways of making an ability similar to War Stomp using GUI, but all have had bugs ranging from major to minor, as all of them have, to varying degrees, left various units permanently paused in certain casting situations.
I started with code using arrays and counters similar to the way RMX used them in one of his spell packs, but that caused bugs. I've tried to make a unit stack in GUI using a few lines of custom script as well but that also had bugs.
Here is my latest "version" of the spell - it uses arrays as well as a unit group of all units that are paused. The bug with this version is that when the caster War Stomps buildings (two at a time in this case) they never unpause. Making it not target buildings isn't the solution I'd be most keen with as I'm sure it must be a logic error somewhere in my code.
If anyone can please help with any errors they spot it will be most appreciated. If anyone wants to use this code themselves - before or after its fixed - they are very welcome.
The code needs to be MUI and all that. Here's the code:
I started with code using arrays and counters similar to the way RMX used them in one of his spell packs, but that caused bugs. I've tried to make a unit stack in GUI using a few lines of custom script as well but that also had bugs.
Here is my latest "version" of the spell - it uses arrays as well as a unit group of all units that are paused. The bug with this version is that when the caster War Stomps buildings (two at a time in this case) they never unpause. Making it not target buildings isn't the solution I'd be most keen with as I'm sure it must be a logic error somewhere in my code.
If anyone can please help with any errors they spot it will be most appreciated. If anyone wants to use this code themselves - before or after its fixed - they are very welcome.
The code needs to be MUI and all that. Here's the code:
-
Still as Statues
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Still as Statues (Living Statue)
-
Actions
- Set The_Real = (0.75 + (0.25 x (Real((Level of Still as Statues (Living Statue) for (Triggering unit))))))
- Set Point = (Position of (Triggering unit))
- Set UnitGroup = (Units within 300.00 of Point matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
-
Unit Group - Pick every unit in UnitGroup and do (Actions)
-
Loop - Actions
- Unit - Cause (Triggering unit) to damage (Picked unit), dealing (100.00 + (75.00 x (Real((Level of Still as Statues (Living Statue) for (Triggering unit)))))) damage of attack type Spells and damage type Normal
- Unit - Pause (Picked unit)
- Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
- Animation - Change (Picked unit)'s vertex coloring to (25.00%, 30.00%, 25.00%) with 0.00% transparency
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) is in Statues_UnitGroup) Equal to True
-
Then - Actions
-
For each (Integer A) from 0 to (Number of units in Statues_UnitGroup), do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Picked unit) Equal to Statues_Unit[(Integer A)]
- Statues_Time[(Integer A)] Less than The_Real
-
Then - Actions
- Set Statues_Time[(Integer A)] = The_Real
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer A) from 0 to (Number of units in Statues_UnitGroup), do (Actions)
-
Else - Actions
- Set The_Random = (Number of units in Statues_UnitGroup)
- Set Statues_Unit[The_Random] = (Picked unit)
- Set Statues_Time[The_Random] = The_Real
- Set Statues_Num = (Statues_Num + 1)
- Unit Group - Add (Picked unit) to Statues_UnitGroup
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup (udg_UnitGroup)
- Custom script: call RemoveLocation (udg_Point)
- Trigger - Turn on INITIALLY OFF Still as Statues Loop <gen>
-
Events
-
INITIALLY OFF Still as Statues Loop
-
Events
- Time - Every 0.05 seconds of game time
- Conditions
-
Actions
-
For each (Integer A) from 0 to Statues_Num, do (Actions)
-
Loop - Actions
- Set Statues_Time[(Integer A)] = (Statues_Time[(Integer A)] - 0.05)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- Statues_Time[(Integer A)] Equal to 0.00
- (Statues_Unit[(Integer A)] is alive) Equal to False
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Unit Group - Remove Statues_Unit[(Integer A)] from UnitGroup
- Animation - Change Statues_Unit[(Integer A)]'s animation speed to 100.00% of its original speed
- Animation - Change Statues_Unit[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
- Unit - Unpause Statues_Unit[(Integer A)]
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in Statues_UnitGroup) Equal to 0
-
Then - Actions
- Set Statues_Num = 0
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
For each (Integer A) from 0 to Statues_Num, do (Actions)
-
Events