• 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.

"Kills one hero as other one revives" system?

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,025
Ok I'm having a major problem with this and I've tried lots of things. Im trying to create a hero system which only allows you to have one hero at a time but allows you to rechoose them at any point through the game.

Example: if player revives one hero from altar then his current one needs to die to make room for the one he's just brought but I cant remove it from the game as it needs to be stored in the hero altar for later resurection. Ive tried killing every unit of type when player revives their hero but this kills the reviving/summoning hero as soon as it re-enters game.

All help appreciated with this

(ps: I don't have jass or know much about variables)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Simple, you store the active hero in a unit variable (a variable is like a maths variable).
You then when they get another hero store it in a unit array under a unique index and change ownership to neutral, hide it and then set the active hero to the fresh hero.

If they buy another hero, you simply have to check if there is one stored in the array under that hero type's slot and if not do above. If there is one you remove the fresh hero and simply set the old hero as the new one from the array (ofcourse unhiding it).
 
Status
Not open for further replies.
Top