Last man standing map

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

marios3000
Newcomer
Posts: 8
Joined: July 29th, 2008, 11:51 am

Last man standing map

Post by marios3000 »

I want to make a trigger (or something) that when all players on the map have died and one is remaining it will give victory to that specific player, but i dont know how. Any help would be appreciated.
Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Re: Last man standing map

Post by Black-Hole »

Heres a Peaty simple one, you need to create a Variable when the game starts for the trigger to work properly.
Spoiler for Start of game:

Code: Select all

Initialization
    Events
        Map initialization
    Conditions
    Actions
        Set PlayerGroup = (All players matching ((((Picked player) controller) Equal to User) and (((Picked player) slot status) Equal to Is playing)))
Spoiler for Victory Trigger:

Code: Select all

Victory
    Events
        Unit - A unit Dies
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Dying unit)) Equal to No unit-type
            Then - Actions
                Player Group - Remove (Owner of (Dying unit)) from PlayerGroup
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of players in PlayerGroup) Equal to 1
            Then - Actions
                Player Group - Pick every player in PlayerGroup and do (Actions)
                    Loop - Actions
                        Game - Victory (Picked player) (Show dialogs, Show scores)
            Else - Actions
marios3000
Newcomer
Posts: 8
Joined: July 29th, 2008, 11:51 am

Re: Last man standing map

Post by marios3000 »

Thats is very helpfull thanks but is there a way to add lives? Like a variable for each player that will lower with each death until it gets to zero or something like that?
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: Last man standing map

Post by Syre »

You could try this..idk if it will work, i just edited Black-Hole's trigger to add lives.

Add this under his first trigger, the map initialization one.
Spoiler:

Code: Select all

For each (Integer A) from 1 to 10, do (Actions)
    Loop - Actions
        Set Lives[(Integer A)] = 3
(Lives is a Interger array variable)

And change his other to.
Spoiler:

Code: Select all

Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Dying unit)) Equal to Unit.
            Lives[(Player number of (Owner of (Dying unit)))] Greater than 0
        Then - Actions
            Set Lives[(Player number of (Owner of (Dying unit)))] = (Lives[(Player number of (Owner of (Dying unit)))] - 1)
        Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    Lives[(Player number of (Owner of (Dying unit)))] Equal to 0
                Then - Actions
                    Player Group - Remove (Owner of (Dying unit)) from PlayerGroup
                Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            (Number of players in PlayerGroup) Equal to 1
                        Then - Actions
                            Player Group - Pick every player in PG and do (Game - Victory (Picked player) (Show dialogs, Show scores))
                            Player Group - Pick every player in (All players matching (((Matching player) is in PlayerGroup) Equal to False)) and do (Game - Defeat (Picked player) with the message: Defeat!)
                        Else - Actions
I added a defeat action too, feel free to remove if you wish.
Image
marios3000
Newcomer
Posts: 8
Joined: July 29th, 2008, 11:51 am

Re: Last man standing map

Post by marios3000 »

Wow. Thanks dude. I will try it out and tell you if it worked.
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: Last man standing map

Post by Syre »

Oh..one more thing, in the trigger i made the loop from 1 - 10, im not sure how many players are in your map so i assumed it was 5v5. If its 6v6, change the 10, to 12.
Image
marios3000
Newcomer
Posts: 8
Joined: July 29th, 2008, 11:51 am

Re: Last man standing map

Post by marios3000 »

Well you guessed it correctly my map is 5v5. Anyway i can't seem to be able to find every action in the editor so could you please make and upload a map that will have the triggers in so that i can take them from there?

I am really gratefull to you.
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: Last man standing map

Post by Syre »

Alright, here you go. Since this map uses variables, you will have to check something to make the variables transfer over. In your map, click File, then click Preferences.. Then on the window that pops up, check "Automatically create unknown variables while pasting trigger data"
You do not have the required permissions to view the files attached to this post.
Image
marios3000
Newcomer
Posts: 8
Joined: July 29th, 2008, 11:51 am

Re: Last man standing map

Post by marios3000 »

Well dude thanks a lot. I used it on my map and it works like a charm. Made a few minor fixes to suit it better to my map, but i am realy gratefull to you.
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: Last man standing map

Post by Syre »

Nah, Black-hole deserves the credits, i just made a minor edit to his work. Glad its working fine though, wasent sure if by adding that it would work or not anymore.
Image