• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

"Kills one hero as other one revives" system?

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,023
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)
 
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.
Back
Top