So I was making a chain lightning spell that improves its damage based on the caster's int score, and it works, however repeated usage of the spell causes the game to eventually crash. I suspect memory leaks are the culprit!
Testing leads me to suspect these lines cause the leak
Here is my full trigger
So far I've built the map completely with GUI triggers so I'm hoping to keep it that way. Any thoughts?
Testing leads me to suspect these lines cause the leak
-
Chain Lightning
- Events
- Conditions
-
Actions
- Lightning - Create a Chain Lightning - Primary Lightning effect from source (Position of casting unit) to target (Position of ChainLightningTarget[0])
- Set ChainLightningEffect[0] = (Last created lightning effect)
-
for each (Integer A) from 1 to 4 do (Actions)
-
Loop - Actions
-
If (All conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
-
Then - Actions
- Lightning - create a Chain Lightning - Primary lightning effect from source (Position of ChainLightningTarget[((Integer A) - 1)]) to target (Position of ChainLightningTarget[(Integer A)])
- Set ChainLightningEffect[(Integer A)] = (Last created lightning effect)
-
If (All conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer A) from 0 to 4, do (Actions)
-
Loop - Actions
- Lightning - Destroy ChainLightningEffect[(Integer A)]
-
Loop - Actions
-
Chain Lightning
- Events
-
Conditions
- (Ability being cast) equal to Chain Lightning (Warmage)
-
Actions
-
for each (Integer A) from 0 to 4 do (Actions)
-
Loop - Actions
- Set ChainLightningTarget[(Integer A)] = No unit
-
Loop - Actions
- Set ChainLightningTarget[0] = (Target unit of ability being cast)
- Set ChainLightningDamage = Damage // took out the calculation here cause it's long and irrelivant
- Unit - Cause (Casting unit) to damage ChainLightningTarget[0] dealing ChainLightningDamage damage of attack type Spells and damage type Lightning
- Lightning - Create a Chain Lightning - Primary Lightning effect from source (Position of casting unit) to target (Position of ChainLightningTarget[0])
- Set ChainLightningEffect[0] = (Last created lightning effect)
- wait 0.06 seconds
-
for each (Integer A) from 1 to 4 do (Actions)
-
Loop - Actions
- Set ChainLightningTarget[(Integer A)] = next target //Another long and irrelivant calculation - just gets another viable target within range of the last target
-
If (All conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ChainLightningTarget[(Integer A)] Not equal to No unit
-
Then - Actions
- Set ChainLightningDamage = ChainLightningDamage * 0.75
- Unit - Cause (casting unit) to damage ChainLightningTarget[(Integer A)] dealing ChainLightningDamage of attack type Spells and damage type Lightning
- Lightning - create a Chain Lightning - Primary lightning effect from source (Position of ChainLightningTarget[((Integer A) - 1)]) to target (Position of ChainLightningTarget[(Integer A)])
- Set ChainLightningEffect[(Integer A)] = (Last created lightning effect)
- Wait 0.10 seconds
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
For each (Integer A) from 0 to 4, do (Actions)
-
Loop - Actions
- Lightning - Destroy ChainLightningEffect[(Integer A)]
-
Loop - Actions
-
for each (Integer A) from 0 to 4 do (Actions)
Last edited: