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

A Unit Respawn system that is compatible with UnitIndexer?

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Im trying to respawn, only a few, units when they die at their starting position. Is there one that only respawns certain units for a player, easy to use, and is compatible with Unit Indexer? (doesn't use Unit custom values)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Im trying to respawn, only a few, units when they die at their starting position. Is there one that only respawns certain units for a player, easy to use, and is compatible with Unit Indexer? (doesn't use Unit custom values)

why dont just save unit x, y coordinate to global real variables when its indexed?

so use indexing system and make a x,y real check

  • indexer trigger
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: set udg_X[udg_UDex] = GetUnitX(udg_UDexUnits[udg_UDex])
      • Custom script: set udg_Y[udg_UDex] = GetUnitY(udg_UDexUnits[udg_UDex])
  • respawn
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set CV = (Custom value of (Triggering unit))
      • Custom script: if udg_X[udg_CV] == GetUnitX(GetTriggerUnit()) and udg_Y[udg_CV] == GetUnitY(GetTriggerUnit()) then
      • Set p = (Position of (Triggering unit))
      • Unit - Create 1 Footman for Player 1 (Red) at p facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_p)
      • Custom script: endif
if u sue custom script for unit create then dont even need set p and removelocation
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
why dont just save unit x, y coordinate to global real variables when its indexed?

so use indexing system and make a x,y real check

  • indexer trigger
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: set udg_X[udg_UDex] = GetUnitX(udg_UDexUnits[udg_UDex])
      • Custom script: set udg_Y[udg_UDex] = GetUnitY(udg_UDexUnits[udg_UDex])
  • respawn
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set CV = (Custom value of (Triggering unit))
      • Custom script: if udg_X[udg_CV] == GetUnitX(GetTriggerUnit()) and udg_Y[udg_CV] == GetUnitY(GetTriggerUnit()) then
      • Set p = (Position of (Triggering unit))
      • Unit - Create 1 Footman for Player 1 (Red) at p facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_p)
      • Custom script: endif
if u sue custom script for unit create then dont even need set p and removelocation

Because i want to index where they START, not when they die..? I can easily just do position of dying unit for that
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Because i want to index where they START, not when they die..? I can easily just do position of dying unit for that

its do that :p its give the start position, actually when unit enter to ur map it is indexed and that moment get his x/y value and not when he die

when he die u just check if start position==dieing position or no like i wrote
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
its do that :p its give the start position, actually when unit enter to ur map it is indexed and that moment get his x/y value and not when he die

when he die u just check if start position==dieing position or no like i wrote

Thanks for trying i guess, i just used the unit indexer value rather than custom value
 
Status
Not open for further replies.
Top