• 🏆 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] Respawn System Problems

Status
Not open for further replies.
Level 11
Joined
Aug 11, 2009
Messages
594
First I will link the triggers:

  • Creep Respawn Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to False)) and do (Actions)
        • Loop - Actions
          • Set Integer_CreepRespawn = (Integer_CreepRespawn + 1)
          • Unit - Set the custom value of (Picked unit) to Integer_CreepRespawn
          • Set Point_Creeps[Integer_CreepRespawn] = (Position of (Picked unit))
          • Set Facing_Creeps[Integer_CreepRespawn] = (Facing of (Picked unit))
  • Creep Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Custom value of (Triggering unit)) Greater than 0
    • Actions
      • Wait 30.00 game-time seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Point_Creeps[(Custom value of (Triggering unit))] facing Facing_Creeps[(Custom value of (Triggering unit))] degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
And now to the issue:
All units does not respawn. Most works, but for example Banshees and Harpies wont respawn. They are owned by Neutral Hostile (just like other units that respawns like wolves) and has no special classification. Anyone has any idea why they dont respawn? Or if someone knows a good respawn system (or can make one) which works properly. I need something that respawns all units except those owned by Player 1-6 and also which are not Heroes.'

Thanks for any help on this, +rep will be awarded ofc
 
Level 10
Joined
Sep 21, 2007
Messages
517
Well, lets analyze this:
A)The array index value cannot exceed 8192, but i highly doubt you have more than 8192 units in your map.

B) Is Integer_CreepRespawn initialized to a wrong value?

C) In the Creep Respawn trigger, why not add the conditions required so that units owned by players 1-6 are not respawned?

D) Perhaps the wait action is bugged, as some problems result from it. So why not resort to using timers? You can create an array of timers for each individual unit and store their custom values as a value in a hash table.

Hope i helped!
 
This is SDRyoko's creep revive system. If you use this, please give full credits to him.
You have to use both these triggers in your map to make this work.
  • INIT Store Creeps
    • Events
      • Map initialization
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Set Loop = 0
      • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set Creep_Type[Loop] = (Unit-type of (Picked unit))
          • Set Creep_Position[Loop] = (Position of (Picked unit))
          • Unit - Set the custom value of (Picked unit) to Loop
          • Set Loop = (Loop + 1)
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • Destructible - Open All walls of (Picked destructible)


JASS:
function Trig_Revive_Creeps_Actions takes nothing returns nothing
    local integer CUSTOM
    set CUSTOM = GetUnitUserData(GetDyingUnit())
    call TriggerSleepAction( 60.00 )
    call CreateNUnitsAtLoc( 1, udg_Creep_Type[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Position[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
 
Level 10
Joined
Sep 21, 2007
Messages
517
@Peacehagen, According to the code, the error is almost for sure from the wait. As you can see the wait he used is the normal wait. In contrast, you used the game-time wait. The polled wait (the wait you used) can last longer than requested according to blizzard. It's wierd though, the polled wait uses a timer and should be more accurate. The polled wait also doesnt consider time consumed by lag in comparison to the normal wait.
 
Level 11
Joined
Aug 11, 2009
Messages
594
I have tried normal wait aswell and the problem remains :/ how do i use the timers you mentioned earlier?

I can try that respawn system and see if it solves the problem :)
 
Level 7
Joined
Oct 16, 2010
Messages
193
Ive done this before in one of my maps. I attached the demo map here.

And you can change the init trigger event to whatever suits you.

Sorry for the sucky demo map i simply made it.
 

Attachments

  • Respawn triggs.w3x
    19.8 KB · Views: 48
Level 11
Joined
Aug 11, 2009
Messages
594
@eubz: I can try those triggers you showed but could you make it so it works for more than just neutral hostile? Also does it save the facing of the respawning unit?

@nafre: Those didn't work at all, just respawned the units in the middle of the map and still didnt respawn the Harpies/Banshees at all :/

So problem still remains, most unit types respawn, but a few types does not.

Diehard@Azeroth mentioned something about timers for every unit, can someone help me with how to do that so I can try if that solves it. Would be very grateful.

Edit: I read a bit about timers and it seems to be a Jass thing? If so, I would need someone to make it for me, I have NewGen so vJass is ok. Things needed in the respawn system:

- Respawns all units (not Heroes) which are owned by Player 7-12 + Neutral Hostile.
- Respawns units at their starting point in the map (also their facing angle).
- Would be great with an easily editable respawn time.

Thanks!
 
Level 10
Joined
Sep 21, 2007
Messages
517
@Peacehagen, sup bro, well here is a tutorial for using hashtables. http://www.thehelper.net/threads/hashtables-gui.140175/
Hashtables basically can be used as an alternative to custom unit value. This is because, in your code, lets say you run a timer when a creep dies k? and you have a trigger which has the respawn actions needed to occur when the timer you set expires. The good thing about hashtables here is that you can attach a key (or custom value in your case) to almost anything, and can retrieve it. Like you have a timer and set its key to the custom value of the unit which died, you can then get the key from the expired timer and use it as the index for Creep_Type[KEY/CustomValue] etc.. You get what im saying?

Basically, with hashtables you can attach and retrieve a value you set to almost ANYTHING (e.g: timer), but with custom values you cannot get a value from an expired timer, but only from units or whatever (like, get custom value from w/e).

Tbh im not sure if i should do code since i didnt use hashtables for 3 yrs mb? anyways i forgot about flushing and children and all that crap so i dont want to post anything wrong. But im 100% sure on this information m8.

If you dont feel like using hashtables, i think that there might be an error which is ruining your whole system. Since the normal wait, and heck even polled wait should have worked.
 
Level 11
Joined
Aug 11, 2009
Messages
594
I have a problem with Hashtables (maybe because of NewGen?) but I cant save Key(Triggering Unit). When I try to fill in something with Key() I can only put a Handle variable in the "()". And I cant set the Handle variable to anything except another variable :/
 
I have a problem with Hashtables (maybe because of NewGen?) but I cant save Key(Triggering Unit). When I try to fill in something with Key() I can only put a Handle variable in the "()". And I cant set the Handle variable to anything except another variable :/

This problem is also present in my JNGP.
 
Status
Not open for further replies.
Top