HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Last Unit Wins

11-08-2004, 08:21 PM#1
Slugge
It should be something like this : 10 units spawn in region, catapults fire wildly at the players, last unit standing gets 1 unit created at another region, please help me with this... i having a hard time doing so that last player standing create 1 unit!!!
11-08-2004, 09:21 PM#2
Dead-Inside
When a unit owned by player X, set "Players left" variable -1, when it's down to 1, the variable, (You check it in the same trigger as you set it -1, AFTER you're set it -1 btw), you create the unit for the owner of the unit in the region where the others died.
11-09-2004, 09:30 AM#3
Mezzer
Or you could do this:
First trigger checks in a loop for the number of units in a region and if that number is 1 (or whatever) it runs the second trigger (which creates units or whatever) and turns then turns off
11-09-2004, 12:56 PM#4
Dead-Inside
... Which I won't suggest because it creates unessecary lagg.
11-10-2004, 05:31 AM#5
Slugge
well, i use this trigger :
Code:
 Mad Chieftains Win System
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Tauren Chieftain
        (Mad Chieftains View <gen> contains (Dying unit)) Equal to True
    Actions
        Set RegionCountInteger = 0
        Unit Group - Pick every unit in (Units in Mad Chieftains View <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Life of (Killing unit)) Greater than 0.00
                    Then - Actions
                        Set RegionCountInteger = (RegionCountInteger + 1)
                        Set RegionUnit = (Killing unit)
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                RegionCountInteger Equal to 1
            Then - Actions
                Unit - Create 1 Footman for (Owner of (Killing unit)) at (Center of Point Counter <gen>) facing Default building facing (270.0) degrees
            Else - Actions

but it doesnt seem to work, what wrong?
11-10-2004, 09:36 AM#6
Dead-Inside
Well.. you're picking everyone but you're checking for the killing unit... Killing unit should be picked unit, shouldn't it? (Not in the last If/Then/Else though!)

And you should use a boolean comparsion, not a real (Life) comparsion. "(Picked Unit) equal to Alive".
11-10-2004, 01:20 PM#7
Slugge
aint this if its only 2 players?!?

well i got it to work :D, but one more question....

if the units aint going to kill each other, but killed by players that cant win (in this case brown)

then what am i doint wrong in this code :

Code:
 Wild Catapults Win System
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Wisp
        (Wild Catapults View <gen> contains (Dying unit)) Equal to True
    Actions
        Set RegionCountInteger = 0
        Unit Group - Pick every unit in (Units in Wild Catapults View <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Life of (Picked unit)) Greater than 0.00
                    Then - Actions
                        Set RegionCountInteger = (RegionCountInteger + 1)
                        Set RegionUnit = (Picked unit)
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                RegionCountInteger Equal to 1
            Then - Actions
                Unit - Create 1 Footman for (Owner of (Killing unit)) at (Center of Point Counter <gen>) facing Default building facing (270.0) degrees
            Else - Actions
11-10-2004, 05:56 PM#8
Dead-Inside
Add another condition, check the player, if it's one of the non-playing (Say player 12) then the IfThenElse won't run for the picked unit. You with me?
11-10-2004, 06:44 PM#9
Slugge
no not really, please go in details... would be alot better.... tell me what to change and tell me what to add... and player 11 shouldnt be there either :D
11-11-2004, 05:36 AM#10
Dead-Inside
Add these two conditions;
(Picked player) not equal to Player 11
(Picked player) not equal to Player 12

Player comparsion I think, it's one of the Player - anyway.
11-11-2004, 06:09 AM#11
thedevil
Quote:
Originally Posted by Slugge
It should be something like this : 10 units spawn in region, catapults fire wildly at the players, last unit standing gets 1 unit created at another region, please help me with this... i having a hard time doing so that last player standing create 1 unit!!!
So if u have only 2 player why dont use event player food use become [X] it will be more simple to do :))