• 🏆 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!

[Solved] Creep Respawning

Status
Not open for further replies.
Level 3
Joined
Nov 3, 2015
Messages
42
Ha, you've been fooled! This isn't a thread asking how to respawn creeps! ;)

What the problem here is that not ALL of my creeps are respawning.

Testing I've done on the problem:
  1. Regular Melee creeps will always respawn
    • Bandits, Brigands, etc...
  2. Custom Melee creeps will always respawn (NO NAME CHANGE, NO STAT CHANGE)
    • Simply right clicked custom unit off of Bandits, Brigands, etc...
  3. Custom Melee creeps (NAME CHANGED, NO STAT CHANGE) will not respawn
    • Custom unit made from Ghosts, named Restless Spirit
    • Custom unit made from Wraiths, named Vengeful Spirit
  4. Custom Melee creeps (STATS, NAME CHANGED) will not respawn
    • Custom unit made from Infernal Juggernaut that uses an imported model, has custom stats, and has a custom name
It's kind of frustrating, here are the triggers I'm using:
  • Init Respawn
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set rhash = (Last created hashtable)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Custom script: call SaveReal( udg_rhash , GetHandleId(GetEnumUnit()) , StringHash("x") , GetUnitX(GetEnumUnit()) )
          • Custom script: call SaveReal( udg_rhash , GetHandleId(GetEnumUnit()) , StringHash("y") , GetUnitY(GetEnumUnit()) )
  • Respawn Creeps
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Wait rtime seconds
      • Custom script: set udg_r1 = LoadReal( udg_rhash , GetHandleId(GetTriggerUnit()) , StringHash("x") )
      • Custom script: set udg_r2 = LoadReal( udg_rhash , GetHandleId(GetTriggerUnit()) , StringHash("y") )
      • Custom script: set bj_lastCreatedUnit = CreateUnit( GetOwningPlayer(GetTriggerUnit()) , GetUnitTypeId(GetTriggerUnit()) , udg_r1 , udg_r2 , GetRandomReal(0 , 359) )
      • Custom script: call SaveReal( udg_rhash , GetHandleId(bj_lastCreatedUnit) , StringHash("x") , udg_r1 )
      • Custom script: call SaveReal( udg_rhash , GetHandleId(bj_lastCreatedUnit) , StringHash("y") , udg_r2 )
      • Custom script: call FlushChildHashtable( udg_rhash , GetHandleId(GetTriggerUnit()))
      • Unit - Remove (Triggering unit) from the game
The variable rtime is initialized to 30.
All of the creeps belonged to Neutral-Hostile.

I'm not sure if this mattered so I did not list it above, but the creeps that did respawn were creeps for the Village tileset, and the creeps that did not respawn were not. I'd be even more annoyed if this were the case.


Anyway, if you know what's the problem here, thank you!!
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
You refer to triggering unit rtime seconds after it died. At this point the corpse could already be decayed and triggering unit would be null.
I recommend using a method, that does not refer to triggering unit after it died. You can store unit type in a local variable, if you really want to use that wait. Otherwise just use a timer with the hashtable attached to it.

I doubt it matters which tileset your units are or if they are custom units or have a changed name. The fact that this only happends to these units sounds weird.
 
Level 3
Joined
Nov 3, 2015
Messages
42
You refer to triggering unit rtime seconds after it died. At this point the corpse could already be decayed and triggering unit would be null.
I recommend using a method, that does not refer to triggering unit after it died. You can store unit type in a local variable, if you really want to use that wait. Otherwise just use a timer with the hashtable attached to it.

I doubt it matters which tileset your units are or if they are custom units or have a changed name. The fact that this only happends to these units sounds weird.
What would an example trigger look like using your recommended method? I like the one I'm using because it's the first Creep Respawner I've used that didn't bug out entirely.
 
"Combat - death type" might be your problem, Units using "can not be revived, does not decay" are removed right after the "Death-Time" expires: "object Editor"-data.
This death timer data is on default for most units below 3.1 seconds on rare cases 10 seconds, your respawn takes 30 seconds ( units having "can not be revived, does not decay" death type are removed on this point already).
 
Status
Not open for further replies.
Top