[Trigger] Help My spell is causing lag

Status
Not open for further replies.
Level 10
Joined
Sep 3, 2009
Messages
458
Hey guys. Well I need some help with this spell of mine. After a few uses of my spell it creates massive lag in my map. I tried to remove all the leaks that I could and think caused the lag but it still happens all the time. Please I need your help.

Basic info on the spell:

Dragon Rush - Kajima blinks to a target location and slashes his sword on the ground, damaging and slowing nearby units around the where he slashed his sword and damaging him by half the damage.

Here's the trigger

Initially On

  • Dragon Rush Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dragon Rush
    • Actions
      • Trigger - Turn on Dragon Rush Fin <gen>
      • Set DR_Caster = (Casting unit)
      • Set DR_Point = (Target point of ability being cast)
      • Set DR_DmgPoint = (DR_Point offset by 150.00 towards (Facing of DR_Caster) degrees)
Initially Off
  • Dragon Rush Fin
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set DR_Multiplier = 1.50
      • Set DR_Damage = (((Agility of DR_Caster (Include bonuses)) x (Integer(DR_Multiplier))) + ((Strength of DR_Caster (Include bonuses)) + (Intelligence of DR_Caster (Include bonuses))))
      • Set DR_Counter = (DR_Counter + 0.01)
      • Set DR_Flag1 = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DR_Counter Greater than or equal to 0.07
          • DR_Flag1 Equal to False
        • Then - Actions
          • Unit - Move DR_Caster instantly to DR_Point
          • Unit - Create 1 Dummy Unit for (Owner of DR_Caster) at DR_DmgPoint facing Default building facing degrees
          • Set DR_Dummy = (Last created unit)
          • Set DR_Flag1 = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DR_Counter Greater than or equal to 0.60
        • Then - Actions
          • Unit - Add Thunder Clap (Dragon Rush) to DR_Dummy
          • Unit - Set level of Thunder Clap (Dragon Rush) for DR_Dummy to (Level of Dragon Rush for DR_Caster)
          • Special Effect - Create a special effect at DR_DmgPoint using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
          • Unit - Order DR_Dummy to Human Mountain King - Thunder Clap
          • Unit - Cause DR_Caster to damage circular area after 0.00 seconds of radius 300.00 at DR_DmgPoint, dealing (Real(DR_Damage)) damage of attack type Hero and damage type Normal
          • Unit - Cause DR_Caster to damage DR_Caster, dealing ((Real(DR_Damage)) / 2.00) damage of attack type Hero and damage type Normal
          • Set DR_Effect = (Last created special effect)
          • Set DR_Counter = 0.00
          • Special Effect - Destroy DR_Effect
          • Custom script: call RemoveLocation (udg_DR_Point)
          • Custom script: call RemoveLocation (udg_DR_DmgPoint)
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
The only possible cause I see is that because the Dummy dont die so after many casts your map become populated with dummy units thats why it lags...... you can use the action ===> Unit->Add Generic Expiration Timer or maybe just add this in the last part: call KillUnit(udg_DR_Dummy)

and this is not MUI though I dont care about that especially since I dont know in what manner you'll use this spell....
 
Level 8
Joined
Jun 18, 2007
Messages
214
First of all, change the loop trigger to at least every 0.03 seconds. Second remove food cost from your dummy units (Object Editor - Food Cost - set it to 0). You don't remove the units that you created: Use - Add Expiration Timer (Generic), like Adiktuz said. And set it to let's say 1 or 1.5 seconds.

  • Unit - Cause DR_Caster to damage circular area after 0.00 seconds of radius 300.00 at DR_DmgPoint, dealing (Real(DR_Damage)) damage of attack type Hero and damage type Normal
If I'm right this will damage everyone, not only enemy units. I suggest you use group pick - damage picked unit. But make sure to remove the group after you're done: call DestroyGroup(udg_yourGroup)

Also make sure only one hero is casting this spell, and it finishes it's casting, because it's not MUI, and can cause serious errors.
 
First of all, change the loop trigger to at least every 0.03 seconds. Second remove food cost from your dummy units (Object Editor - Food Cost - set it to 0). You don't remove the units that you created: Use - Add Expiration Timer (Generic), like Adiktuz said. And set it to let's say 1 or 1.5 seconds.

  • Unit - Cause DR_Caster to damage circular area after 0.00 seconds of radius 300.00 at DR_DmgPoint, dealing (Real(DR_Damage)) damage of attack type Hero and damage type Normal
If I'm right this will damage everyone, not only enemy units. I suggest you use group pick - damage picked unit. But make sure to remove the group after you're done: call DestroyGroup(udg_yourGroup)

Also make sure only one hero is casting this spell, and it finishes it's casting, because it's not MUI, and can cause serious errors.

yeah right.. this damages all units so it will hit the caster 2 times unless he can move away FAST within .6 seconds because you have a 300 radius from a point only 150 from the position you will teleport... maybe he can move but I don't think we have the right reaction time to do it....
 
Level 10
Joined
Sep 3, 2009
Messages
458
The only possible cause I see is that because the Dummy dont die so after many casts your map become populated with dummy units thats why it lags...... you can use the action ===> Unit->Add Generic Expiration Timer or maybe just add this in the last part: call KillUnit(udg_DR_Dummy)

and this is not MUI though I dont care about that especially since I dont know in what manner you'll use this spell....

Well I actually made the dummy's regen to -1 so that it will automatically die without trigger but I guess there's something wrong with that so thanks.

First of all, change the loop trigger to at least every 0.03 seconds. Second remove food cost from your dummy units (Object Editor - Food Cost - set it to 0). You don't remove the units that you created: Use - Add Expiration Timer (Generic), like Adiktuz said. And set it to let's say 1 or 1.5 seconds.

  • Unit - Cause DR_Caster to damage circular area after 0.00 seconds of radius 300.00 at DR_DmgPoint, dealing (Real(DR_Damage)) damage of attack type Hero and damage type Normal
If I'm right this will damage everyone, not only enemy units. I suggest you use group pick - damage picked unit. But make sure to remove the group after you're done: call DestroyGroup(udg_yourGroup)

Also make sure only one hero is casting this spell, and it finishes it's casting, because it's not MUI, and can cause serious errors.

when you mean loop trigger to atleast 0.03, does that mean

  • Time - Every 0.03 seconds of game time
thanks also

yeah right.. this damages all units so it will hit the caster 2 times unless he can move away FAST within .6 seconds because you have a 300 radius from a point only 150 from the position you will teleport... maybe he can move but I don't think we have the right reaction time to do it....

and about the damage I planned it to damage all units friend or foe and to make the caster only receive half damage. Basically when the damage occurs I heal him by half. But as it seems I need to adjust the timing.

And also the MUI part I planned to make it MUI (which I really don't know how) but this problem occured and well I'm on a halt.

Thanks guys I'm gonna test it now and see what happens.

EDIT:

Well It still had lag for some reason.
 
oh... you create so many dummies... because you set at the start the DR_Flag1 to be false for each trigger execution of the periodic trigger so the first If-then-else becomes active over and over again thus creating more and more dummies.....

you should set it to false in the first trigger and not in the upper part of the periodic one..... one more.. how long do you set the life timer?

where do you place the life timer? in the first if-then-else or in the second?? If you place the life-timer in the second part then that causes the lag because only the last dummy created has the life-timer... you should do my suggestion above.....
 
Level 10
Joined
Sep 3, 2009
Messages
458
oh... you create so many dummies... because you set at the start the DR_Flag1 to be false for each trigger execution of the periodic trigger so the first If-then-else becomes active over and over again thus creating more and more dummies.....

you should set it to false in the first trigger and not in the upper part of the periodic one..... one more.. how long do you set the life timer?

where do you place the life timer? in the first if-then-else or in the second?? If you place the life-timer in the second part then that causes the lag because only the last dummy created has the life-timer... you should do my suggestion above.....

Lol I never thought putting it there was causing the lag. Thanks man your so awesome! +rep! (uhm how do I do the rep thingy?)

and to answer your other questions, I set the expiration timer to 1.5 and I put it in the first if/then/else statement and it works fine. Thanks for your help
 
Lol I never thought putting it there was causing the lag. Thanks man your so awesome! +rep! (uhm how do I do the rep thingy?)

and to answer your other questions, I set the expiration timer to 1.5 and I put it in the first if/then/else statement and it works fine. Thanks for your help

well everybody makes a mistake and thats why there is a site like this to help others..... for the rep click the icon with the check/x mark under the avatar of the user... thanks.
 
Status
Not open for further replies.
Top