I am using Flood's Rain of X GUI system.
http://www.hiveworkshop.com/forums/spells-569/rain-x-system-version-1-1a-136432/
I advanced it to support "channeling" spells.
I am still new to MUI spells and Indexing, so I'm not sure if this would leak:
I changed it so that I would "stop casting" in two cases:
1. the spell is over, no more waves.
2. the hero/player stops casting (gets interrupted, moves somewhere, ect..)
For #1 I added these lines
The line
The line
For #2 I created the "Hero Stops Channeling" trigger.
It checks
a) the "stopping" unit
b) is this a channeling spell?
c) is the spell still running? [RoX_Off = false => the spell is still running]
Important is checking for c), as otherwise this trigger will run, when case #1 occured. That's why I set "RoX_Off = true" BEFORE I order the unit to stop.
So, if the case is: the hero stops while the spell is running, I reduce the array (recycle?) and turn the RoX_Off bool to true. I then check if there is still an instance running; if not: disable the loop. Now the spell is "done".
So, will this work, without leaking, and recycle correct?
http://www.hiveworkshop.com/forums/spells-569/rain-x-system-version-1-1a-136432/
I advanced it to support "channeling" spells.
I am still new to MUI spells and Indexing, so I'm not sure if this would leak:
-
Rain Sample Ability
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Rain_BASE
-
-
Actions
-
-------- Leave this as it is. --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoX_Index[2] Less than or equal to 0
-
-
Then - Actions
-
Trigger - Turn on RoX Loop <gen>
-
-
Else - Actions
-
-
Set RoX_Index[1] = (RoX_Index[1] + 1)
-
Set RoX_Index[2] = (RoX_Index[2] + 1)
-
Set RoX_Off[RoX_Index[1]] = False
-
-------- ------------------------- --------
-
-------- Sets the casting unit --------
-
Set RoX_Caster[RoX_Index[1]] = (Triggering unit)
-
-------- The location the ability is caster, --------
-
Set RoX_TargetPoint[RoX_Index[1]] = (Target point of ability being cast)
-
-------- Sets the player of the caster. --------
-
Set RoX_Player[RoX_Index[1]] = (Owner of (Triggering unit))
-
-------- Should your Rain of X deal damage to allies? --------
-
Set RoX_HitAllies[RoX_Index[1]] = True
-
-------- Should your Rain of X deal damage to buildings? --------
-
Set RoX_HitBuildings[RoX_Index[1]] = False
-
-------- Set this to the number of waves you want your Rain of X to have. --------
-
Set RoX_NumberOfWaves[RoX_Index[1]] = 5
-
-------- Set this to the number of shards that will be spawned each wave. --------
-
Set RoX_NumberOfShards[RoX_Index[1]] = 12
-
-------- You should always leave this at 0. --------
-
Set RoX_ShardsSpawnCounter[RoX_Index[1]] = 0
-
-------- This is the speed that the shards will fall with. --------
-
Set RoX_ShardFallSpeed[RoX_Index[1]] = 30.00
-
-------- This is the time each wave will be delayed before a new one will begin. --------
-
Set RoX_DelayEachWave[RoX_Index[1]] = 0.75
-
-------- You should always leave this at 0.00. --------
-
Set RoX_DelayTimer[RoX_Index[1]] = 0.00
-
-------- This is the AoE (Area of Effect) your Rain of X will have. You should set it as your abilities AOE. --------
-
Set RoX_AoE[RoX_Index[1]] = 200.00
-
-------- This is the damage each wave will cause. --------
-
Set RoX_Damage[RoX_Index[1]] = 50.00
-
-------- This is the height your shards will start at. --------
-
Set RoX_ShardHeight[RoX_Index[1]] = 750.00
-
-------- This is the model your shards will have. --------
-
Set RoX_ShardModel[RoX_Index[1]] = Abilities\Weapons\AncestralGuardianMissile\AncestralGuardianMissile.mdl
-
-------- This is the effect that will be cause on hitted enemies. --------
-
Set RoX_OnHitEffect[RoX_Index[1]] = Abilities\Spells\Human\Invisibility\InvisibilityTarget.mdl
-
-------- Is this a channel spell? --------
-
-------- *channel spell should have maximum cast duration/waves to avoid bugs* --------
-
Set ROX_Channel_Spell[RoX_Index[1]] = True
-
-
-
RoX Loop
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer RoX_Index[3]) from 1 to RoX_Index[1], do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoX_Off[RoX_Index[3]] Equal to False
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoX_DelayTimer[RoX_Index[3]] Greater than or equal to RoX_DelayEachWave[RoX_Index[3]]
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoX_NumberOfWaves[RoX_Index[3]] Less than or equal to 0
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ROX_Channel_Spell[RoX_Index[3]] Equal to True
-
-
Then - Actions
-
Set RoX_Off[RoX_Index[3]] = True
-
Unit - Order RoX_Caster[RoX_Index[3]] to Stop
-
-
Else - Actions
-
Set RoX_Off[RoX_Index[3]] = True
-
-
-
Custom script: call RemoveLocation(udg_RoX_TargetPoint[udg_RoX_Index[3]])
-
Set RoX_Index[2] = (RoX_Index[2] - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoX_Index[2] Less than or equal to 0
-
-
Then - Actions
-
Set RoX_Index[1] = 0
-
Trigger - Turn off RoX Loop <gen>
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoX_ShardsSpawnCounter[RoX_Index[3]] Greater than or equal to RoX_NumberOfShards[RoX_Index[3]]
-
-
Then - Actions
-
Set RoX_NumberOfWaves[RoX_Index[3]] = (RoX_NumberOfWaves[RoX_Index[3]] - 1)
-
Set RoX_ShardsSpawnCounter[RoX_Index[3]] = 0
-
Set RoX_DelayTimer[RoX_Index[3]] = 0.00
-
Set RoX_UnitGroup[0] = (Units within RoX_AoE[RoX_Index[3]] of RoX_TargetPoint[RoX_Index[3]])
-
Unit Group - Pick every unit in RoX_UnitGroup[0] and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is alive) Equal to True
-
-
Then - Actions
-
Special Effect - Create a special effect attached to the head of (Picked unit) using RoX_OnHitEffect[RoX_Index[3]]
-
Special Effect - Destroy (Last created special effect)
-
Unit - Cause RoX_Caster[RoX_Index[3]] to damage (Picked unit), dealing RoX_Damage[RoX_Index[3]] damage of attack type Spells and damage type Normal
-
-
Else - Actions
-
-
-
-
Custom script: call DestroyGroup(udg_RoX_UnitGroup[0])
-
-
Else - Actions
-
Set RoX_ShardsSpawnCounter[RoX_Index[3]] = (RoX_ShardsSpawnCounter[RoX_Index[3]] + 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoXS_Index[2] Less than or equal to 0
-
-
Then - Actions
-
Trigger - Turn on RoXShard Loop <gen>
-
-
Else - Actions
-
-
Set RoXS_Index[1] = (RoXS_Index[1] + 1)
-
Set RoXS_Index[2] = (RoXS_Index[2] + 1)
-
Set RoXS_Off[RoXS_Index[1]] = False
-
Set RoX_Point[0] = (RoX_TargetPoint[RoX_Index[3]] offset by (Random real number between 0.00 and RoX_AoE[RoX_Index[3]]) towards (Random real number between 0.00 and 359.00) degrees)
-
Unit - Create 1 Shard_Dummy for RoX_Player[RoX_Index[3]] at RoX_Point[0] facing Default building facing degrees
-
Set RoXS_Unit[RoXS_Index[1]] = (Last created unit)
-
Set RoXS_Height[RoXS_Index[1]] = RoX_ShardHeight[RoX_Index[3]]
-
Special Effect - Create a special effect attached to the origin of RoXS_Unit[RoXS_Index[1]] using RoX_ShardModel[RoX_Index[3]]
-
Set RoXS_ModelEffect[RoXS_Index[1]] = (Last created special effect)
-
Animation - Change RoXS_Unit[RoXS_Index[1]] flying height to RoX_ShardHeight[RoX_Index[3]] at 0.00
-
Custom script: call RemoveLocation(udg_RoX_Point[0])
-
Set RoXS_ShardFallSpeed[RoXS_Index[1]] = RoX_ShardFallSpeed[RoX_Index[3]]
-
-
-
-
-
-
Else - Actions
-
Set RoX_DelayTimer[RoX_Index[3]] = (RoX_DelayTimer[RoX_Index[3]] + 0.03)
-
-
-
-
Else - Actions
-
-
-
-
-
-
RoXShard Loop
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer RoXS_Index[3]) from 1 to RoXS_Index[1], do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoXS_Off[RoXS_Index[3]] Equal to False
-
-
Then - Actions
-
Set RoXS_Height[RoXS_Index[3]] = (RoXS_Height[RoXS_Index[3]] - RoXS_ShardFallSpeed[RoXS_Index[3]])
-
Animation - Change RoXS_Unit[RoXS_Index[3]] flying height to RoXS_Height[RoXS_Index[3]] at 0.00
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoXS_Height[RoXS_Index[3]] Less than or equal to 0.00
-
-
Then - Actions
-
Special Effect - Destroy RoXS_ModelEffect[RoXS_Index[3]]
-
Unit - Kill RoXS_Unit[RoXS_Index[3]]
-
Set RoXS_Off[RoXS_Index[3]] = True
-
Set RoXS_Index[2] = (RoXS_Index[2] - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoXS_Index[2] Less than or equal to 0
-
-
Then - Actions
-
Set RoXS_Index[1] = 0
-
Trigger - Turn off RoXShard Loop <gen>
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-
-
RoX Stop Channel Casting
-
Events
-
Unit - A unit Stops casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Rain_BASE
-
-
Actions
-
For each (Integer RoX_Index[3]) from 1 to RoX_Index[1], do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Triggering unit) Equal to RoX_Caster[RoX_Index[3]]
-
ROX_Channel_Spell[RoX_Index[3]] Equal to True
-
RoX_Off[RoX_Index[3]] Equal to False
-
-
Then - Actions
-
Set RoX_Index[2] = (RoX_Index[2] - 1)
-
Set RoX_Off[RoX_Index[3]] = True
-
Custom script: call RemoveLocation(udg_RoX_TargetPoint[udg_RoX_Index[3]])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RoX_Index[2] Less than or equal to 0
-
-
Then - Actions
-
Set RoX_Index[1] = 0
-
Trigger - Turn off RoX Loop <gen>
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-
1. the spell is over, no more waves.
2. the hero/player stops casting (gets interrupted, moves somewhere, ect..)
For #1 I added these lines
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ROX_Channel_Spell[RoX_Index[3]] Equal to True
-
Then - Actions
-
Set RoX_Off[RoX_Index[3]] = True
-
Unit - Order RoX_Caster[RoX_Index[3]] to Stop
The line
-
Set RoX_Off[RoX_Index[3]] = True
The line
-
Unit - Order RoX_Caster[RoX_Index[3]] to Stop
For #2 I created the "Hero Stops Channeling" trigger.
It checks
a) the "stopping" unit
b) is this a channeling spell?
c) is the spell still running? [RoX_Off = false => the spell is still running]
Important is checking for c), as otherwise this trigger will run, when case #1 occured. That's why I set "RoX_Off = true" BEFORE I order the unit to stop.
So, if the case is: the hero stops while the spell is running, I reduce the array (recycle?) and turn the RoX_Off bool to true. I then check if there is still an instance running; if not: disable the loop. Now the spell is "done".
So, will this work, without leaking, and recycle correct?