• 🏆 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] Units keep respawning lower that their initial spawn point.

Status
Not open for further replies.
Level 2
Joined
Jan 5, 2014
Messages
12
Hello,

I have a few triggers that at the start of the map set the respawn point of every hostile unit as their initial position, but every time I kill one, it respawn just a bit lower from the spot that they should be spawning.

Here are the triggers:


  • Set respawn point
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Hashtable - Save (X of (Position of (Picked unit))) as 0 of (Key (Picked unit)) in RespawnPoints
          • Hashtable - Save (Y of (Position of (Picked unit))) as 1 of (Key (Picked unit)) in RespawnPoints
  • Reset spawn pont
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Hashtable - Save (Y of (Position of (Triggering unit))) as 1 of (Key (Triggering unit)) in RespawnPoints
      • Hashtable - Save (X of (Position of (Triggering unit))) as 0 of (Key (Triggering unit)) in RespawnPoints
  • Respawn enemies
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Wait 3.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at ((Center of (Playable map area)) offset by ((Load 0 of (Key (Triggering unit)) from RespawnPoints), (Load 1 of (Key (Triggering unit)) from RespawnPoints))) facing Default building facing degrees
And here is the result:

(Where is should respawn)
Screenshot - dbcce9ebcb8ceaf0f1b00c246b519dac - Gyazo

(Where is respawns)
Screenshot - 71dc5ec5f73e28db7bf1b5c807ec1d92 - Gyazo
 
Level 1
Joined
Jun 7, 2018
Messages
2
It would be better to save the position of the unit directly into the hashtable, like this.
  • Set respawn point
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Position of (Picked unit)) as 0 of (Key (Picked unit)) in RespawnPoints
  • Reset spawn point
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Hashtable - Save Handle Of(Position of (Triggering unit)) as 0 of (Key (Triggering unit)) in RespawnPoints
  • Respawn enemies
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Wait 3.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Load 0 of (Key (Triggering unit)) in RespawnPoints) facing Default building facing degrees
 
Status
Not open for further replies.
Top