• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Extreme Lag from ... what?? O.O

Status
Not open for further replies.
Level 5
Joined
Feb 5, 2021
Messages
89
Hello People of Hive,
I once again require your assistance since i have something that works perfectly in one place but when i try to duplicate the effect in another place it causes extreme lag and freezes the game for several seconds

Heres the trigger, can anyone help me figure out why this lags me out this much (The trigger is repeated every second for 5 seconds when triggered, no conditions).

  • For each (Integer A) from 1 to (NumberOfPlayers + 5), do (Actions)
    • Loop - Actions
      • Set VariableSet MobSpawnPoints = (Random point in Dungeon1 Part5 Boss <gen>)
      • Unit - Create (Random integer number between 3 and 5) Peasant for Neutral Hostile at MobSpawnPoints facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_MobSpawnPoints)
 
Level 5
Joined
Feb 5, 2021
Messages
89
You'd have to show us all of your triggers but creating 50+ units at once is going to have an effect on performance. It shouldn't be too extreme though.
What do you mean by all? this is the trigger that does not work and nothing else will be running at the time of this trigger running? :)
Let me copy in the whole thing :)

  • Start Dungeon
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to (NumberOfPlayers + 5), do (Actions)
        • Loop - Actions
          • Set VariableSet MobSpawnPoints = (Random point in Dungeon1 Part5 Boss <gen>)
          • Unit - Create (Random integer number between 3 and 5) Peasant for Neutral Hostile at MobSpawnPoints facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_MobSpawnPoints)
I am using one such as this with "Unit - Create (Random integer number between 3 and 5)" Being "Unit - Create (Random integer number between 0 and 1)" and it works fine even though it is triggered more times than this one aswell, hence my confusion, thanks for helping :)

it might be because 'integer A' is a global variable and you are using it in 2 triggers at once
This i also thought of so i tried changing it to a variable and nothing changed, also i know that integer A is not used anywhere else at this point, but i will probably use the variable later when i figure out why its not working, thanks for the input :)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
What do you mean by all? this is the trigger that does not work and nothing else will be running at the time of this trigger running? :)
Let me copy in the whole thing :)

  • Start Dungeon
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to (NumberOfPlayers + 5), do (Actions)
        • Loop - Actions
          • Set VariableSet MobSpawnPoints = (Random point in Dungeon1 Part5 Boss <gen>)
          • Unit - Create (Random integer number between 3 and 5) Peasant for Neutral Hostile at MobSpawnPoints facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_MobSpawnPoints)
I am using one such as this with "Unit - Create (Random integer number between 3 and 5)" Being "Unit - Create (Random integer number between 0 and 1)" and it works fine even though it is triggered more times than this one aswell, hence my confusion, thanks for helping :)


This i also thought of so i tried changing it to a variable and nothing changed, also i know that integer A is not used anywhere else at this point, but i will probably use the variable later when i figure out why its not working, thanks for the input :)
You said the problem starts when you duplicate it, which sounds like you'd have at least 2 triggers. Also, a unit being created can run the "A unit enters region" Event, so any triggers using that should be investigated.
 
Level 5
Joined
Feb 5, 2021
Messages
89
You said the problem starts when you duplicate it, which sounds like you'd have at least 2 triggers. Also, a unit being created can run the "A unit enters region" Event, so any triggers using that should be investigated.
That is true, i have something similar, but they do not run at the same time, they are triggered different places by different things and cannot happen at the same time, hence why i get very confused about it :) but i can find the other one for the sake of the problem on this one ;)

  • SpawnZone1Encounter
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String(EncounterSelection))
      • For each (Integer A) from 1 to (NumberOfPlayers + 2), do (Actions)
        • Loop - Actions
          • Set VariableSet MobSpawnPoints = (Random point in Zone1EncounterRegion)
          • Unit - Create (Random integer number between 0 and 2) Peasant) for Neutral Hostile at MobSpawnPoints facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_MobSpawnPoints)
This one does not lag me out, even if i trigger it 3 times in 0.3 seconds (it has no event because it is triggered to run by something else)

Does it lag more and more overtime or does it suddenly become extremely laggy and freezes?
It starts to lag / freeze the instant the trigger is run, even if i set the values from 3 - 5 and down to 0 - 2 then it still does it
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
That is true, i have something similar, but they do not run at the same time, they are triggered different places by different things and cannot happen at the same time, hence why i get very confused about it :) but i can find the other one for the sake of the problem on this one ;)

  • SpawnZone1Encounter
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String(EncounterSelection))
      • For each (Integer A) from 1 to (NumberOfPlayers + 2), do (Actions)
        • Loop - Actions
          • Set VariableSet MobSpawnPoints = (Random point in Zone1EncounterRegion)
          • Unit - Create (Random integer number between 0 and 2) Peasant) for Neutral Hostile at MobSpawnPoints facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_MobSpawnPoints)
This one does not lag me out, even if i trigger it 3 times in 0.3 seconds (it has no event because it is triggered to run by something else)


It starts to lag / freeze the instant the trigger is run, even if i set the values from 3 - 5 and down to 0 - 2 then it still does it
If you send me the map I can probably figure out what's wrong. There's not really anything to go on without being able to see all of the triggers.
 
Level 5
Joined
Feb 5, 2021
Messages
89
If you send me the map I can probably figure out what's wrong. There's not really anything to go on without being able to see all of the triggers.
Thanks for trying, i found another solution that might even fit my theme even better, thanks alot :)
 
Status
Not open for further replies.
Top