HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Victory

05-13-2008, 04:39 PM#1
ch6tal
anyone knows how to make a victory condition that works "when all other players are defeated/left the game"?

p.s i wanted to ask but i dont know where is there a limit to the amount of rep a person can give?
05-13-2008, 05:48 PM#2
abriko
Third post here and you are still posting questions about script in General development -.-
Your question is not about Victory.. just about how to know if you player left or defeated. Easy, create 2 triggers ( 1 when a player leave, 1 when a player is defeated) (or just 1 if you make leave the player who is defeated ). Add a condition,
if
trigger execution of the 2 triggers = player in game at start -1
then
Victory ( for all .. we don't care, he is alone now ^^ )

Just an idea, u can think about a lot of idea.
05-13-2008, 06:30 PM#3
ch6tal
i searched in wc3c and found this thread http://wc3campaigns.net/showthread.p...hlight=victory so i found my trigger although it's kinda long

i didn't know it's wrong to ask trigger qustions here you are the first one to comment me about it next time i will post it at trigger forum
05-13-2008, 10:35 PM#4
abriko
This trigger won't help a lot for you ^^
05-14-2008, 04:57 AM#5
ch6tal
it works but i need a trigger for each player (8 triggers)
05-14-2008, 07:34 AM#6
abriko
It works only for leaving player...
05-14-2008, 10:23 AM#7
ch6tal
i added a condition for defeat
05-14-2008, 11:47 AM#8
abriko
Condition ? There is a difference between a player left not defeated and a player left and defeated ?
05-14-2008, 02:11 PM#9
ch6tal
sry i meant event not condition. the event i have is player 1 leaves game, player 1 is defeated, player 2 leaves game ...
i dont know if there's a difference between them but just in case i added both
05-14-2008, 09:27 PM#10
DioD
To detect player win, you need to count enemys of every player, if some one have no enemys - he won.

Trigger:
Melee Initialization
Collapse Events
Player - Player 1 (Red) leaves the game
Player - Player 2 (Blue) leaves the game
Player - Player 3 (Teal) leaves the game
Player - Player 4 (Purple) leaves the game
Player - Player 5 (Yellow) leaves the game
Player - Player 6 (Orange) leaves the game
Player - Player 7 (Green) leaves the game
Player - Player 8 (Pink) leaves the game
Player - Player 9 (Gray) leaves the game
Player - Player 10 (Light Blue) leaves the game
Player - Player 11 (Dark Green) leaves the game
Player - Player 12 (Brown) leaves the game
Conditions
Collapse Actions
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Collapse Player Group - Pick every player in (All enemies of (Picked player)) and do (Actions)
Collapse Loop - Actions
Set b[a] = (b[a] + 1)
Set a = (a + 1)
Collapse For each (Integer A) from 0 to a, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
b[a] Equal to 0
Collapse Then - Actions
Game - Victory (Player(a)) (Show dialogs, Show scores)
Collapse Else - Actions
Do nothing

on GUI it some thing like this.

Code:
function CountEnemy takes nothing returns nothing
    set udg_b[udg_a] = udg_b[udg_a] + 1
endfunction

function GetEnemy takes nothing returns nothing
    call ForForce( GetPlayersEnemies(GetEnumPlayer()), function CountEnemy )
    set udg_a = udg_a + 1
endfunction

function Trig_Melee_Initialization_Actions takes nothing returns nothing
    local integer I = 0
    local force F = CreateForce()
    set udg_a = 0
    
    loop
       call ForceAddPlayer(F,Player(I))
       set I = I + 1
       exitwhen I == 13
    endloop
    
    call ForForce( F, function GetEnemy )
    
    set I = 0
    loop
    
        if udg_b[i] == 0 then
            call CustomVictoryBJ( ConvertedPlayer(udg_a), true, true )
        endif
        
        set I = I + 1
        exitwhen I == 13
    endloop
    
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(0) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(1) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(2) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(3) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(4) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(5) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(6) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(7) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(8) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(9) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(10) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Melee_Initialization, Player(11) )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction