trigger malfunctions after waiting over 60 seconds

seansucks

New Member
Reaction score
0
for some reason, on my creep revive system.
i have it set to 60 seconds, all units appear like they're supposed to after death. but when i make it more than 60 seconds, (i.e. 120, 150, etc) they don't come back after the timer is up. and i checked all my other triggers, i just sat there waiting at the respawn point and nothing. nothing is interfering with the wait trigger. and i searched the forums but i didn't find anything about this really. is there a maximum time to the wait trigger? can i double the wait trigger? so it's like wait 60 seconds, and when the timer runs out, wait another 60 seconds?

what do i do!
 

Tom Jones

N/A
Reaction score
437
Post your trigger by right clicking the trigger name in the trigger functions window, then chose copy as text, and then paste the text inside either a [noparse]
Trigger:
[/noparse] or [noparse]
Code:
[/noparse] tag.

Trigger:
  • This is a wc3 tag.


Code:
This is a code tag.
 

seansucks

New Member
Reaction score
0
i don't think that will solve anything since the trigger already functions, it just stops working after 60 secons. but i'll post it anyways.

here's the getting point trigger. which gets the position of the creep and stores its custom value.

Trigger:
  • Get Respawn Position
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Set Integer_R = (Integer_R + 1)
          • Unit - Set the custom value of (Picked unit) to Integer_R
          • Set Point_CR[Integer_R] = (Position of (Picked unit))


here is the trigger that spawns the creep

Trigger:
  • Creep Respawn Trigger
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • (Triggering unit) Not equal to (Summoned unit)
    • Actions
      • Wait 60.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at Point_CR[(Custom value of (Triggering unit))] facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
 

svenski

New Member
Reaction score
1
Your creep revive trigger isn't multi-instancable. This is the revive trigger ripped straight from the downloadable DotA Template map (which you should DL and check out if you wanna see more usefull easy map-setup triggers):

JASS:
function Trig_Revive_Creeps_Actions takes nothing returns nothing
    local integer CUSTOM
    set CUSTOM = GetUnitUserData(GetDyingUnit())
    call TriggerSleepAction( udg_Hostile_Revive_Time )
    call CreateNUnitsAtLoc( 1, udg_Creep_Types[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Positions[CUSTOM], bj_UNIT_FACING )
    call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
endfunction

//===========================================================================
function InitTrig_Revive_Creeps takes nothing returns nothing
    set gg_trg_Revive_Creeps = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction


See the local integer variable? That is being stored each time a unit from player 12 (...neutral hostile in this case) dies. Then the trigger waits the revive time, and respawns the unit using that locally stored custom value (which is being overwritten each time a trigger unit dies in your trigger). I'm shocked you noticed your trigger working at all.

At least i think that's the problem....
 

Tom Jones

N/A
Reaction score
437
Have you messed with the gameplay constants? In particular the ones concerning decay time, and specifically the Bone one.
 

seansucks

New Member
Reaction score
0
Have you messed with the gameplay constants? In particular the ones concerning decay time, and specifically the Bone one.

no, i haven't messed with any of those in specific, some gameplay constants yes, but it didn't give me a problem until i extended it past 60 seconds, when i reset it back to 60 seconds it works fine.

and svenski i don't understand anything when it comes to jass, i need that broken down a little bit more.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Ummm, isn't "Triggering Unit" lost after long waits?
 

svenski

New Member
Reaction score
1
no, i haven't messed with any of those in specific, some gameplay constants yes, but it didn't give me a problem until i extended it past 60 seconds, when i reset it back to 60 seconds it works fine.

and svenski i don't understand anything when it comes to jass, i need that broken down a little bit more.

weird... Well you get that "JASS" trigger if you simply select your trigger, right click it, and do CONVERT TO CUSTOM TEXT. Your trigger would then look very similar to the one I posted there.

Basically the best way to fix your problem (and the leaks you're creating by picking all the units in the map area) is to replace your current triggers with these:

Trigger:
  • Actions
    • Set LoopCreep = 0
    • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
      • Loop - Actions
        • Set Creep_Types[LoopCreep] = (Unit-type of (Picked unit))
        • Set Creep_Positions[LoopCreep] = (Position of (Picked unit))
        • Unit - Set the custom value of (Picked unit) to LoopCreep
        • Set LoopCreep = (LoopCreep + 1)
    • Custom script: call DestroyGroup(bj_lastCreatedGroup)


These actions can be triggered to run at map initialization if all your neutrals are there, or, whenever you have your neutrals spawn, run these actions to save all their type and locations. You can see this is much like your trigger, but it doesn't have a "group leak" (a memory leak created when you don't destroy the unit group created by the Pick every unit in (units owned by neutral hostile...) and do actions....). Have the respawn trigger be the same as the one i pasted earlier, namely:

JASS:
function Trig_Revive_Creeps_Actions takes nothing returns nothing
    local integer CUSTOM
    set CUSTOM = GetUnitUserData(GetDyingUnit())
    call TriggerSleepAction( udg_Hostile_Revive_Time )
    call CreateNUnitsAtLoc( 1, udg_Creep_Types[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Positions[CUSTOM], bj_UNIT_FACING )
    call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
endfunction

//===========================================================================
function InitTrig_Revive_Creeps takes nothing returns nothing
    set gg_trg_Revive_Creeps = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction


If you can't see the resemblance between this trigger and a GUI trigger, try converting this trigger to custom text...

Trigger:
  • Revive Creeps GUI
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
    • Actions
      • Set CUSTOM = (Custom value of (Dying unit))
      • Wait Hostile_Revive_Time seconds
      • Unit - Create 1 Creep_Types[CUSTOM] for Neutral Hostile at Creep_Positions[CUSTOM] facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to CUSTOM



That above trigger is EXACTLY the same as the JASS trigger, except the integer CUSTOM is being stored as a local variable, which is allowed in multiple instances.

EDIT: Note that this trigger uses "Hostile_Revive_Time" as your concerning wait time, and i'm pretty sure there is no wait cap in the game. Again, this method of using custom script works because it stores the unit's index at the moment it dies, then does the wait action. Your trigger doesn't do that because you're waiting without setting a reference to which unit died.. I think Bob is right when he says that gets lost when the wait action is called in your trigger.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
no, i haven't messed with any of those in specific, some gameplay constants yes, but it didn't give me a problem until i extended it past 60 seconds, when i reset it back to 60 seconds it works fine.

and svenski i don't understand anything when it comes to jass, i need that broken down a little bit more.

That's because there are gameplay constants telling the editor how long after a unit dies to remove it (heroes are ignored). If the units are removed before your Wait expires, the unit will no longer exist, and so your trigger will malfunction.

You can either increase the decay time (make it more than the revive time), use local variables, or use an array stack to store the information of the unit when it dies.
 

seansucks

New Member
Reaction score
0
That's because there are gameplay constants telling the editor how long after a unit dies to remove it (heroes are ignored). If the units are removed before your Wait expires, the unit will no longer exist, and so your trigger will malfunction.

You can either increase the decay time (make it more than the revive time), use local variables, or use an array stack to store the information of the unit when it dies.

that's it. thank you very much. the decay time on the bones was 88 seconds, which is why when i'd set it to 120 it wouldn't work but it'd work at 60 seconds.

problem solved in a simple fashion +rep
 
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