• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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