Defeat

wc345

Member
Reaction score
1
How can i make a defeat like in TD when you got no more chances ? like if it is 0 or less to be a defeat ?
 

Inflicted

Currently inactive
Reaction score
63
Something like this (note, freehand)

Life Reduction Trigger:
Events
Unit enters region
Conditions
Owner of entering unit is Player 12
Actions
Remove Unit
Set Lives = Lives - 1
If/Else Statement
IF Lives = 0
THEN:
Pick all Players = User and Playing
Game - Show defeat message for picked player saying "you are out of lives eg"

Erm, if you can't get that. Please mention what you are struggling with.
 

wc345

Member
Reaction score
1
I can't figure out with this IF/THEN/ELSE,i will post what i have :

DIE

Die
Events
Unit - A unit enters Region 004 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
Actions
Unit - Explode (Triggering unit)

TURN ON

Turn On
Events
Time - Elapsed game time is 50.00 seconds
Conditions
Actions
Trigger - Turn off (This trigger)
Trigger - Turn on Spawn 2 <gen>

SPAWN 1

Spawn
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Unit - Create 30 Frost Wyrm for Player 12 (Brown) at (Center of Region 000 <gen>) facing Default building facing degrees
Wait 10.00 seconds
Unit - Create 4 Abomination for Player 12 (Brown) at (Center of Region 000 <gen>) facing Default building facing degrees

SPAWN 2

Spawn 2
Events
Time - Every 60.00 seconds of game time
Conditions
Actions
Unit - Create 4 Crypt Fiend for Player 12 (Brown) at (Center of Region 000 <gen>) facing Default building facing degrees


MOVE 1

Move 1
Events
Unit - A unit enters Region 000 <gen>
Unit - A unit enters Region 004 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
(Owner of (Entering unit)) Equal to Player 12 (Brown)
Actions
Unit - Order (Entering unit) to Move To (Center of Region 001 <gen>)

MOVE 2

Move 2
Events
Unit - A unit enters Region 003 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
(Owner of (Entering unit)) Equal to Player 12 (Brown)
Actions
Unit - Order (Entering unit) to Move To (Center of Region 004 <gen>)




LEADERBOARD LIVES

Leaderboard Lives
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Leaderboard - Create a leaderboard for (All players) titled <Empty String>
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 1 (Red) controller) Equal to User
(Player 1 (Red) slot status) Equal to Is playing
Then - Actions
Set PlayerRedLives = 30
Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label Lives and value PlayerRedLives
Else - Actions
Do nothing
Leaderboard - Show (Last created leaderboard)


LEADERBOARD UPDATE

Leaderboard Update
Events
Unit - A unit enters Region 004 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
Actions
Set PlayerRedLives = (PlayerRedLives - 1)
Leaderboard - Change the value for Player 1 (Red) in (Last created leaderboard) to PlayerRedLives


That's it...
 

Inflicted

Currently inactive
Reaction score
63
yw, if there is anything you struggle with. Please ask, or leave me a PM for a private response or demo map with an example.

edit:
combine your trigger "Die" and "Leaderboard Update".

Do this:

Leaderboard Update
Events
Unit - A unit enters Region 004 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
Actions
Set PlayerRedLives = (PlayerRedLives - 1)
Leaderboard - Change the value for Player 1 (Red) in (Last created leaderboard) to PlayerRedLives
Unit - Explode (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PlayerRedLives = 0
Then - Actions
Defeat Trigger
Else - Actions

Sorry it is rough hand, just using your triggers and abit of pseudo.

Try to avoid the function 'Do Nothing' - otherwise your triggers are fine.
 

wc345

Member
Reaction score
1
But how can i put this :

If - Conditions
PlayerRedLives = 0


I can't find a something with variable in the Conditions ?
 

Smitty

Member
Reaction score
20
Make it a real variable, then have game event- a real variable (playerlives) becomes equal to 0.
 

Inflicted

Currently inactive
Reaction score
63
Thats the IF part of the IF/ELSE statement.
And this:
" PlayerRedLives = 0 "
Is an integer comparison.

Go to Conditions, Integer, Very top of the Box is a section for variables.
 

Smitty

Member
Reaction score
20
But he wants an event, not a condition, surely, for a defeat trigger? But yeh, that'd work.
 

Inflicted

Currently inactive
Reaction score
63
The event would be the unit entering the region, its quicker just to check lives in that same trigger.
But usage of another trigger to constantly check what the real is doing is possible.
Also note that this is an integer.

Preventing a double post, lol, edit:

And now the leaderboard is only dialog without numbers :/

Apon the loss of a life, adjust the leaderboard.

Quick question, are lives shared by the team or are they for individuals?
 

wc345

Member
Reaction score
1
Can i do it without in the leaderboard trigger ? because it's seems not working to me...It says defeat but don't count,there no numbers in the box :(
 

Inflicted

Currently inactive
Reaction score
63
I have my editor infront of me now, I can make you a demo quick.
What system do you want, team lives or individual lives?
 

wc345

Member
Reaction score
1
Well i make a TD map for 2 players which is not in team,they must survive and if one of them lose his lives to says Defeat...
 

Inflicted

Currently inactive
Reaction score
63
[del]okay, give me 5 minutes.[/del]

ok done, hope this helps. Sorry I did not test it.
 

Attachments

  • life system demo.w3x
    14 KB · Views: 121

Inflicted

Currently inactive
Reaction score
63
Here are the triggers:
Trigger:
  • Create Stuff
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled Lives
      • Set Player1Lives = 30
      • Set Player2Lives = 30
      • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label (Name of Player 1 (Red)) and value Player1Lives
      • Leaderboard - Add Player 2 (Blue) to (Last created leaderboard) with label (Name of Player 2 (Blue)) and value Player2Lives

Trigger:
  • Lose a life
    • Events
      • Unit - A unit enters Team 1 Loses Here &lt;gen&gt;
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 12 (Brown)
    • Actions
      • Set Player1Lives = (Player1Lives - 1)
      • Leaderboard - Change the value for Player 1 (Red) in (Last created leaderboard) to Player1Lives
      • Unit - Explode (Entering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player1Lives Equal to 0
        • Then - Actions
          • Game - Defeat Player 1 (Red) with the message: Defeat! You have no...
          • Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
        • Else - Actions

Trigger:
  • Lose a life 2
    • Events
      • Unit - A unit enters Team 2 Loses here &lt;gen&gt;
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 12 (Brown)
    • Actions
      • Set Player2Lives = (Player2Lives - 1)
      • Leaderboard - Change the value for Player 2 (Blue) in (Last created leaderboard) to Player1Lives
      • Unit - Explode (Entering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player2Lives Equal to 0
        • Then - Actions
          • Game - Defeat Player 2 (Blue) with the message: Defeat! You have no...
          • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
        • Else - Actions

Variables:
Player1Lives - Integer
Player2Lives - Integer

It isn't much, I tried to keep it as basic and easy to implement as possible.
To change the starting lives, merely change:

Set Player1Lives = 30
Set Player2Lives = 30

From my trigger Create Stuff [lol]
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top