Creep Respawn Trigger Causing More Creeps To Spawn Than It should

Astal

New Member
Reaction score
1
I think its because of a leak but i really dont know. One area of my map, creeps spawn uncontrollably.

Ive been using this same trigger in different maps and always had problems with it. If anyone gets a chance could you look over it and see if it looks ok?

These are my triggers.

Trigger:
  • Creep Revival System Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set Integer = (Integer + 1)
          • Unit - Set the custom value of (Picked unit) to Integer
          • Custom script: set udg_Creep_X[udg_Integer] = GetUnitX(GetEnumUnit())
          • Custom script: set udg_Creep_Y[udg_Integer] = GetUnitY(GetEnumUnit())


Trigger:
  • Revive Creeps
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CreepRespawnTime Greater than 0.00
        • Then - Actions
          • Wait CreepRespawnTime game-time seconds
          • Unit - Create 1 (Random level CreepLevel creep unit-type) for Neutral Hostile at ((Center of (Entire map)) offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))])) facing (Random angle) degrees
          • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
        • Else - Actions
          • Wait 30.00 seconds
          • Unit - Create 1 (Random level CreepLevel creep unit-type) for Neutral Hostile at ((Center of (Entire map)) offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))])) facing (Random angle) degrees
          • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
 

Conal

Member
Reaction score
12
It's the waits.

Imagine this:
1. 5 creeps die, the wait begins
2. 5 more creeps die during that wait.
3. The original 5 wait finishes but uses the more recent unit information such as your X,Y coordinates because of the wait.
4. The next 5 finish waiting...etc...

Since you've established "CreepRespawnTime", add another integer variable based off the custom value of the unit and increment it in a periodic of about 1 second. When that integer reaches the creeprespawntime, do all the respawn stuff.

Edit: Yes, you have three leaks. The unit group one is insignificant though.
 

Shura

New Member
Reaction score
45
These triggers are from a Creep Revive System and were designed specifically so the waits were not a problem.
 

Conal

Member
Reaction score
12
I don't see how the waits wouldn't be a problem. In the scenario mentioned previously, eventually, units will end up with the most recently killed creep's custom value due to the waits.
 

Shura

New Member
Reaction score
45
The triggers are using arrays, which can basically assign a unique value to each unit. This would be done by making sure that each unit has a separate custom value, and that is used as the array number. Also, Triggering Unit will still refer to whatever unit fired the trigger, even if the trigger has run multiple times.
 

Conal

Member
Reaction score
12
Well, if that's the case, the only suggestion I have is to display the units custom value when it is revived. If it displays the same number more than once (excluding the recycled one) then you know where the problem is.
 

Astal

New Member
Reaction score
1
I have no idea what u guys are talkin about :( lol


Is there a working creep revive system out there thats fairly easy to implement?
 

mylemonblue

You can change this now in User CP.
Reaction score
7
AceHeart's Creep Revival system would be best IMO. His favorite (Which seems to work best as well) is in JASS, but it's fully copy/paste-able.
 

Astal

New Member
Reaction score
1
AceHeart's Creep Revival system would be best IMO. His favorite (Which seems to work best as well) is in JASS, but it's fully copy/paste-able.

alright ill look for it unless u got a link. I wonder if i can make it work with my other triggers.



Hmm wish someone could just help me figure out whats wrong with mine hehehehe oh well.


I dunno which of ace hearts works best. He has like 13 triggers in his example.
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top