Minor lag when casting spell

Finestdeath

New Member
Reaction score
10
I recently edited a spell for my map. Originally, what the spell does is that it deals damage to nearby units the moment the projectile lands. I edited it so that when the projectile lands, it slows the units near it instead of damaging them.

However, when I cast the edited spell, the First projectile to land causes a minor 0.1 second lag which is abit annoying. And it only happens the First time you cast it. Casting it the second time will not cause any lag.

I'm not really that troubled about this issue, but I would like to know why is there this "minor lag"?

Before editing the spell, it looked like this. (It just deals damage, thats all)
Trigger:
  • Trigger A1
    • Event
      • Unit - A unit Begans channeling an ability
    • Conditions
    • Actions
      • Unit - Create 1 Dummy for (Owner of (Triggering Player) at PickedUnitLoc facing (Angle from PickedUnitLoc to TargetLoc) degrees
      • Trigger - Turn on (Trigger A2)
Trigger:
  • Trigger A2
    • Event
      • Time - Every 0.05 seconds of the game time
    • Conditions
    • Actions
      • Set Dummy = (Last created unit)
      • Unit - Cause Dummy to damage (Picked Unit), dealing 500.00 damage of attack type Spells and damage type Magic.
      • Unit - Remove Dummy from the game.


After editing the spell, it looked like this (This slows the enemies down)
Trigger:
  • Trigger B1
    • Event
      • Time - Every 0.05 seconds of the game time
    • Conditions
    • Actions
      • Unit - Create 1 Dummy for (Owner of (Triggering Player) at PickedUnitLoc facing (Angle from PickedUnitLoc to TargetLoc) degrees
      • Set Dummy = (Last created unit)
      • Unit - Add Thunderclap (Slow) to Dummy
      • Unit - Order Dummy to Human Mountain King - Thunder Clap
      • Unit - Remove Dummy from the game.


So what I've done is that I have merged the two triggers together. Now it doesn't deal damage but instead, slows the enemies down.

I'm not sure exactly which part is causing the lag. Is it the part where I merged them together? Or the part where the Dummy casts Thunder Clap? And is it possible to eliminate this lag?

Help would be appreciated :D
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
This is the First-call lag.
It happens because wc3 loads the information about custom spells or units the moment they appear in the map.
When your Dummy unit is created the first time, wc3 will first have to look up all its stats, which causes a small lag.

You can take care of that by just placing your dummy unit somewhere on the map and remove it on map initialization. The minor lag will still occur, but then it's during the loading time and nobody will notice (there's no way to get rid of it totally, since wc3 HAS to load it).

If there's still a lag after "preloading" your dummy unit then it's probably the spell the dummy is casting. If that's the case then just give the spell to your dummy unit before removing it. That way the spell is also preloaded.
 

Laiev

Hey Listen!!
Reaction score
188
of course will lag... you create 20 units per second -.- and PickedLocUnit (?) wtf?

u don't set it and want use it...?

also your trigger is hard to understand what you want to do..

this trigger make no sense --' anyway...
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
of course will lag... you create 20 units per second -.- and PickedLocUnit (?) wtf?
Actually 20 units per second isn't very much unless you're playing on an antique pocket pc.
Even ceating 20 units in one instant shouldn't make the game lag one bit.
 

Finestdeath

New Member
Reaction score
10
@Accname
Preload? What do you mean?

@s3rius
Okay I will give it a try.

@Laiev
Chill. Its just 1 unit. I didn't post the whole trigger 'cos those are the parts that weren't edited. And the PickedUnitLoc was for a part of the Unit Group. And I don't really think its that hard to understand. Already posted what each "part" does. My bad if you are still not sure what it means.
 

Finestdeath

New Member
Reaction score
10
It didn't worked at first. Then I tried adding the ability onto the dummy and told it to cast it and there was no more lag! Thanks alot guys! +rep!
 

HydraRancher

Truth begins in lies
Reaction score
197
Just on a little note, dont just "remove" your dummy, add a generic expiration timer, much cleaner.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top