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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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