- Joined
- Aug 2, 2010
- Messages
- 14
So I have created this spell that is supposed to hit an enemy and when it does, split into three projectiles (that's why it is called splitfire). Right now when I try to fix some memory leaks, the triggers stops working and I don't know why.
Thanks Space Ship, it works now but it still starts to lag when there are loads of projectiles on the map. I can't find any more leaks.
-
Melee Initialization
-
Events
- Map initialization
- Conditions
-
Actions
- Hashtable - Create a hashtable
- Set SplitLightning = (Last created hashtable)
- Visibility - Disable fog of war
- Visibility - Disable black mask
-
Events
-
Init
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Carrion Swarm
-
Actions
- Set Caster = (Casting unit)
- Set HeroPos = (Position of Caster)
- Set TargetPos = (Target point of ability being cast)
- Set MoveDist = 9.00
- Set Angle = (Angle from HeroPos to TargetPos)
- Set TimeLeft = 8.00
- Unit - Create 1 Ghoul for (Owner of Caster) at HeroPos facing Angle degrees
- Set Projectile = (Last created unit)
- Set SplitLightningHandle = (Last created unit)
- Hashtable - Save MoveDist as 3 of (Key SplitLightningHandle) in SplitLightning
- Hashtable - Save Angle as 4 of (Key SplitLightningHandle) in SplitLightning
- Hashtable - Save TimeLeft as 5 of (Key SplitLightningHandle) in SplitLightning
- Unit Group - Add Projectile to Projectiles
- Custom script: call RemoveLocation(udg_HeroPos)
- Custom script: call RemoveLocation(udg_TargetPos)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Loop <gen> is on) Equal to False
-
Then - Actions
- Trigger - Turn on Loop <gen>
- Else - Actions
-
If - Conditions
-
Events
-
Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in Projectiles and do (Actions)
-
Loop - Actions
- Set MoveDist = (Load 3 of (Key (Picked unit)) from SplitLightning)
- Set Angle = (Load 4 of (Key (Picked unit)) from SplitLightning)
- Set TimeLeft = (Load 5 of (Key (Picked unit)) from SplitLightning)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- TimeLeft Greater than or equal to 0.03
-
Then - Actions
- Set ProjectilePos = (Position of (Picked unit))
- Set ProjectileMovePos = (ProjectilePos offset by MoveDist towards Angle degrees)
- Unit - Move (Picked unit) instantly to ProjectileMovePos
- Hashtable - Save (TimeLeft - 0.03) as 5 of (Key (Picked unit)) in SplitLightning
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- TimeLeft Less than or equal to 7.40
-
Then - Actions
- Set Targets = (Units within 60.00 of ProjectilePos matching ((((Matching unit) belongs to an enemy of (Owner of Projectile)) Equal to True) and (((Matching unit) is alive) Equal to True)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in Targets) Greater than or equal to 1
-
Then - Actions
- Set Angle = (Angle - 80.00)
- Unit - Cause Projectile to damage (Random unit from Targets), dealing 100.00 damage of attack type Spells and damage type Normal
- Custom script: call DestroyGroup(udg_Targets)
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
- Unit - Create 1 Ghoul for (Owner of (Picked unit)) at ProjectilePos facing Default building facing degrees
- Set Projectile = (Last created unit)
- Set SplitLightningHandle = (Last created unit)
- Set Angle = (Angle + 20.00)
- Set TimeLeft = 8.00
- Set MoveDist = 8.00
- Hashtable - Save MoveDist as 3 of (Key SplitLightningHandle) in SplitLightning
- Hashtable - Save Angle as 4 of (Key SplitLightningHandle) in SplitLightning
- Hashtable - Save TimeLeft as 5 of (Key SplitLightningHandle) in SplitLightning
- Unit Group - Add Projectile to Projectiles
-
Loop - Actions
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in SplitLightning
- Unit Group - Remove (Picked unit) from Projectiles
- Unit - Remove (Picked unit) from the game
-
Else - Actions
- Custom script: call DestroyGroup(udg_Targets)
-
If - Conditions
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation(udg_ProjectileMovePos)
- Custom script: call RemoveLocation(udg_ProjectilePos)
-
Else - Actions
- Custom script: call RemoveLocation(udg_ProjectilePos)
- Custom script: call RemoveLocation(udg_ProjectileMovePos)
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in SplitLightning
- Unit Group - Remove (Picked unit) from Projectiles
- Unit - Remove (Picked unit) from the game
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in Projectiles) Equal to 0
-
Then - Actions
- Trigger - Turn off Loop <gen>
- Else - Actions
-
If - Conditions
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in Projectiles and do (Actions)
-
Events
Attachments
Last edited: