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

TD - Player Lives

Level 3
Joined
Aug 11, 2005
Messages
28
Player Lives:
In the most Tower Defense Maps players have lives or chances.
Usually when the lives or chances reach 0 the players loses the game.
Players loses lives when a creep enters the center where the creeps are supposed to be removed from the game.

Variable:
You have to create a variable to create the players lives.



You can change the amount of lives by editing the Initial Value.
In my TD I’ve set the Player lives to 50.

Set Player Lives:
Code:
Events
        Unit - A unit enters Creep Remove
    Conditions
        (Owner of (Triggering unit)) Equal to Player 10 (Light Blue)
    Actions
        Set Player_Lives = (Player_Lives - 1)
        Game - Display to (All players) for 5.00 seconds the text: (WARNING - + ((String(Player_Lives)) +  lives left!))
        Trigger - Run Defeat (checking conditions)

Then have another trigger like this:

Defeat:
Code:
Events
        Player - Player 10 (Light Blue)'s Food used becomes Equal to 0.00
    Conditions
        Player_Lives Equal to 0
    Actions
        Player Group - Pick every player in (All players) and do (Game - Defeat (Picked player) with the message: You have failed!)
 
Top