• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Laggy Knockback Spell

Status
Not open for further replies.
So, i have a problem with one my old spells, used in one of my maps. This spell create very big lags when used in game and sometimes, war3 crashes cauz' of this (not a fatal error, just like if you press alt + f4 in a program) and that for all players.

So here are the spell triggers :

  • Coup Sanglant
    • Evénements
      • Unité - A unit Initie l'effet d'une compétence
    • Conditions
      • (Ability being cast) Egal Ã* Coup Sanglant
    • Actions
      • Set CS_cible = (Target unit of ability being cast)
      • Set CS_loop_times = 0
      • Set CS_heros = (Casting unit)
      • Set CS_Point_KB_fin = ((Position of CS_cible) offset by 200.00 towards (Angle from (Position of CS_heros) to (Position of CS_cible)) degrees)
      • Déclencheur - Turn on Coup Sanglant Loop <gen>
  • Coup Sanglant Loop
    • Evénements
      • Temps - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set CS_loc_cible = (Position of CS_cible)
      • Set CS_angle = (Angle from CS_loc_cible to CS_Point_KB_fin)
      • Set CS_loop_times = (CS_loop_times + 1)
      • Set CS_loc_cible_new = (CS_loc_cible offset by 6.00 towards CS_angle degrees)
      • Unité - Move CS_cible instantly to CS_loc_cible_new, facing (Facing of CS_cible) degrees
      • Custom script: call RemoveLocation( udg_CS_loc_cible_new )
      • Custom script: call RemoveLocation( udg_CS_loc_cible )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • CS_loop_times Supérieur ou égal Ã* 25
        • Alors - Actions
          • Custom script: call RemoveLocation( udg_CS_Point_KB_fin )
          • Déclencheur - Turn off (This trigger)
        • Sinon - Actions
And on another side, i have some spells which in theory must cause more lags (for example a spell which make move 18dummies at same time) and which support Multiples Instances without lags.
So i don't understand what's the problem.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You should use Starts the effect of an ability. Your event is Begins casting...right?

CS_Point_KB_fin leaks.
Position of CS_cible - point 1
Position of CS_heros - point 2
Position of CS_cible - point 3
The offset point is fourth point.

Leaks occur if the ability is cast when the looping trigger is on. The ability is not MUI, it won't work for more than one unit at the same time.
 
I knew that the spell isn't mui, but i did a long time ago (before i started to do mui) and i don't need it MUI for the moment.

I changed some things for store the angle at the cast of spell. But the spell still causes laggs, but lowers lags.

  • Coup Sanglant
    • Evénements
      • Unité - A unit Initie l'effet d'une compétence
    • Conditions
      • (Ability being cast) Egal Ã* Coup Sanglant
    • Actions
      • Set CS_cible = (Target unit of ability being cast)
      • Set CS_loop_times = 0
      • Set CS_heros = (Casting unit)
      • --------I know, there is 2 locations leaks there ^^--------
      • Set CS_angle = (Angle from (Position of CS_heros) to (Position of CS_cible))
      • Déclencheur - Turn on Coup Sanglant Loop <gen>
  • Coup Sanglant Loop
    • Evénements
      • Temps - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set CS_loop_times = (CS_loop_times + 1)
      • Set CS_loc_cible = (Position of CS_cible)
      • Set CS_loc_cible_new = (CS_loc_cible offset by 6.00 towards CS_angle degrees)
      • Unité - Move CS_cible instantly to CS_loc_cible_new, facing (Facing of CS_cible) degrees
      • Custom script: call RemoveLocation( udg_CS_loc_cible_new )
      • Custom script: call RemoveLocation( udg_CS_loc_cible )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • CS_loop_times Supérieur ou égal Ã* 25
        • Alors - Actions
          • Déclencheur - Turn off (This trigger)
        • Sinon - Actions
 
Are you sure the lag/crash isn't caused by something else? If it is lagging, it might just be your computer. Make sure that you aren't using any super-high-quality effects or anything like that; that code is most likely not the source of the lag you are describing. (assuming that your spell is working properly)

Every time you use this ability, every player has between 2 and 5frame (instead of the 22-25 in all the rest of the game) while the duration of the spell. This with good or bad pc.

And there is not any special effect on the spell except one little blood effect at the cast of the spell.
 
Level 6
Joined
Jun 20, 2011
Messages
249
Yes, if you set that value to 0 then the strike will cause damage every 0 seconds.
Set it to another value, i'm sure this is what is causing the lag, but instead of asking why haven't you tested it already?
 
Status
Not open for further replies.
Top