• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Thanks for trying i guess, i just used the unit indexer value rather than custom value

unit indexer just give custom value to unit :p
actually in that moment when unit created then he get already custom value with indexer so if u store his coordinate in that moment then it is start position, so not hard to compare start coordinate with current :)
 
Status
Not open for further replies.
Top