- Joined
- Mar 17, 2012
- Messages
- 579
Hello, guys. I really need your help optimizing a couple of my spells cause they make the game lag the more I use them.
1 - Mind Trap - AoE spell that keeps everyone stunned for 5 sec.
Cast:
Loop:
P.S. Dummies are removed fwiw.
2 - Might of heaven - AoE spell around the hero. It damages all enemies around him if the apropriaye skill is on and if not, heals every ally.
Init:
Loop:
Do they leak or what? I can't understand why they make the map lag. I mean creating dummies will definitely load the map, but I remove one before another one appears... Any help, please?
1 - Mind Trap - AoE spell that keeps everyone stunned for 5 sec.
Cast:
-
Mind Trap init
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Mind Trap new
-
Actions
- Set Mind_Trap_Int = (Player number of (Owner of (Triggering unit)))
- Set Mind_Trap_Caster[Mind_Trap_Int] = (Triggering unit)
- Set Mind_Trap_Point[Mind_Trap_Int] = (Target point of ability being cast)
- Set Mind_Trap_Counter[Mind_Trap_Int] = 5.00
- Unit Group - Add Mind_Trap_Caster[Mind_Trap_Int] to Mind_Trap_Casters
- Trigger - Turn on Mind Trap expiration <gen>
-
Events
-
Mind Trap expiration
-
Events
- Time - Every 0.20 seconds of game time
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Mind_Trap_Casters is empty) Equal to True
-
Then - Actions
- Trigger - Turn off (This trigger)
- Skip remaining actions
-
Else - Actions
-
For each (Integer Mind_Trap_Int) from 1 to 13, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Mind_Trap_Counter[Mind_Trap_Int] Greater than 0.00
-
Then - Actions
- Special Effect - Create a special effect at Mind_Trap_Point[Mind_Trap_Int] using MindTrap.mdx
- Special Effect - Destroy (Last created special effect)
- Set Mind_Trap_Group[Mind_Trap_Int] = (Units within 350.00 of Mind_Trap_Point[Mind_Trap_Int] matching ((((Matching unit) belongs to an enemy of (Owner of Mind_Trap_Caster[Mind_Trap_Int])) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching unit) is A structu
- Set Mind_Trap_Counter[Mind_Trap_Int] = (Mind_Trap_Counter[Mind_Trap_Int] - 0.20)
-
Unit Group - Pick every unit in Mind_Trap_Group[Mind_Trap_Int] and do (Actions)
-
Loop - Actions
- Unit - Create 1 Mind Trap dummy for (Owner of Mind_Trap_Caster[Mind_Trap_Int]) at Mind_Trap_Point[Mind_Trap_Int] facing Default building facing degrees
- Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
- Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) is An Ancient) Equal to True
-
Then - Actions
- Set Mind_Trap_Damage[Mind_Trap_Int] = ((((((Real((Level of Mind Trap new for Mind_Trap_Caster[Mind_Trap_Int]))) x 25.00) + 0.00) + ((Real((Intelligence of Mind_Trap_Caster[Mind_Trap_Int] (Include bonuses)))) x (((Real((Level of Mind Trap new for Mind_Trap_Caster[Mind_Trap_Int]))) x 0.40) + 0.80))
- Unit - Cause Mind_Trap_Caster[Mind_Trap_Int] to damage (Picked unit), dealing Mind_Trap_Damage[Mind_Trap_Int] damage of attack type Spells and damage type Fire
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup (udg_Mind_Trap_Group[udg_Mind_Trap_Int])
-
Else - Actions
- Custom script: call RemoveLocation(udg_Mind_Trap_Point[udg_Mind_Trap_Int])
- Unit Group - Remove Mind_Trap_Caster[Mind_Trap_Int] from Mind_Trap_Casters
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer Mind_Trap_Int) from 1 to 13, do (Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
2 - Might of heaven - AoE spell around the hero. It damages all enemies around him if the apropriaye skill is on and if not, heals every ally.
Init:
-
Might of Heaven init
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Might of Heaven
-
Actions
- Set Might_of_Heaven_Int = (Player number of (Owner of (Triggering unit)))
- Set Might_of_Heaven_Caster[Might_of_Heaven_Int] = (Triggering unit)
- Set Might_of_Heaven_Bool[Might_of_Heaven_Int] = True
- Set Might_of_Heaven_Timer[Might_of_Heaven_Int] = 5.00
- Unit - Add Might of Heaven effect (+1) to Might_of_Heaven_Caster[Might_of_Heaven_Int]
- Unit Group - Add Might_of_Heaven_Caster[Might_of_Heaven_Int] to Might_of_Heaven_Casters
- Trigger - Turn on Might of Heaven loop <gen>
-
Events
-
Might of Heaven loop
-
Events
- Time - Every 0.10 seconds of game time
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Might_of_Heaven_Casters is empty) Equal to True
-
Then - Actions
- Trigger - Turn off (This trigger)
- Skip remaining actions
-
Else - Actions
-
For each (Integer Might_of_Heaven_Int) from 1 to 12, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Might_of_Heaven_Bool[Might_of_Heaven_Int] Equal to True
- Might_of_Heaven_Timer[Might_of_Heaven_Int] Greater than 0.00
-
Then - Actions
- Set Might_of_Heaven_Timer[Might_of_Heaven_Int] = (Might_of_Heaven_Timer[Might_of_Heaven_Int] - 0.10)
- Set Might_of_Heaven_Caster_Point[Might_of_Heaven_Int] = (Position of Might_of_Heaven_Caster[Might_of_Heaven_Int])
- Set Might_of_Heaven_Enemy_Group[Might_of_Heaven_Int] = (Units within 500.00 of Might_of_Heaven_Caster_Point[Might_of_Heaven_Int] matching ((((Matching unit) belongs to an enemy of (Owner of Might_of_Heaven_Caster[Might_of_Heaven_Int])) Equal to True) and ((((Matching unit) is An Ancient) Not equal to True) and ((
- Set Might_of_Heaven_Ally_Group[Might_of_Heaven_Int] = (Units within 500.00 of Might_of_Heaven_Caster_Point[Might_of_Heaven_Int] matching ((((Matching unit) belongs to an ally of (Owner of Might_of_Heaven_Caster[Might_of_Heaven_Int])) Equal to True) and ((((Matching unit) is An Ancient) Not equal to True) and (((
- Set Might_of_Heaven_Damage[Might_of_Heaven_Int] = (((((Real((Level of Might of Heaven for Might_of_Heaven_Caster[Might_of_Heaven_Int]))) x 5.00) + 10.00) + ((Real((Intelligence of Might_of_Heaven_Caster[Might_of_Heaven_Int] (Include bonuses)))) x (((Real((Level of Might of Heaven for Might_of_Heaven_Caster
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Holy Mark for Might_of_Heaven_Caster[Might_of_Heaven_Int]) Greater than 0
-
Then - Actions
-
Unit Group - Pick every unit in Might_of_Heaven_Ally_Group[Might_of_Heaven_Int] and do (Actions)
-
Loop - Actions
- Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Might_of_Heaven_Damage[Might_of_Heaven_Int] x 2.00))
-
Loop - Actions
-
Unit Group - Pick every unit in Might_of_Heaven_Ally_Group[Might_of_Heaven_Int] and do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Retribution Mark for Might_of_Heaven_Caster[Might_of_Heaven_Int]) Greater than 0
-
Then - Actions
-
Unit Group - Pick every unit in Might_of_Heaven_Enemy_Group[Might_of_Heaven_Int] and do (Actions)
-
Loop - Actions
- Unit - Cause Might_of_Heaven_Caster[Might_of_Heaven_Int] to damage (Picked unit), dealing (Might_of_Heaven_Damage[Might_of_Heaven_Int] x 2.00) damage of attack type Spells and damage type Fire
-
Loop - Actions
-
Unit Group - Pick every unit in Might_of_Heaven_Enemy_Group[Might_of_Heaven_Int] and do (Actions)
-
Else - Actions
-
Unit Group - Pick every unit in Might_of_Heaven_Ally_Group[Might_of_Heaven_Int] and do (Actions)
-
Loop - Actions
- Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + Might_of_Heaven_Damage[Might_of_Heaven_Int])
-
Loop - Actions
-
Unit Group - Pick every unit in Might_of_Heaven_Enemy_Group[Might_of_Heaven_Int] and do (Actions)
-
Loop - Actions
- Unit - Cause Might_of_Heaven_Caster[Might_of_Heaven_Int] to damage (Picked unit), dealing Might_of_Heaven_Damage[Might_of_Heaven_Int] damage of attack type Spells and damage type Fire
-
Loop - Actions
-
Unit Group - Pick every unit in Might_of_Heaven_Ally_Group[Might_of_Heaven_Int] and do (Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_Might_of_Heaven_Caster_Point[udg_Might_of_Heaven_Int])
- Custom script: call DestroyGroup(udg_Might_of_Heaven_Ally_Group[udg_Might_of_Heaven_Int])
- Custom script: call DestroyGroup(udg_Might_of_Heaven_Enemy_Group[udg_Might_of_Heaven_Int])
-
Else - Actions
- Set Might_of_Heaven_Timer[Might_of_Heaven_Int] = 0.00
- Set Might_of_Heaven_Bool[Might_of_Heaven_Int] = False
- Unit - Remove Might of Heaven effect (+1) from Might_of_Heaven_Caster[Might_of_Heaven_Int]
- Unit Group - Remove Might_of_Heaven_Caster[Might_of_Heaven_Int] from Might_of_Heaven_Casters
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer Might_of_Heaven_Int) from 1 to 12, do (Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Do they leak or what? I can't understand why they make the map lag. I mean creating dummies will definitely load the map, but I remove one before another one appears... Any help, please?