Condition: Is <Player> in <PlayerGroup> ?

Status
Not open for further replies.
Level 9
Joined
Apr 28, 2009
Messages
538
Yeah, well, I'm talking about Player Groups, not Unit Groups.

Detailed info: I have a simple voting "system", and I have to add a condition so that a player cannot vote more that one time.

Here's the trigger in wich I have to add the condition:

  • Invoke Alternate
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 7 (Green) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
    • Conditions
      • (OnESCDialogMain Equal to (==) False)
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions ****Need Help Here*****
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 6.00 seconds the text: You can only vote once.
        • Else - Actions
          • Dialog - Show KickDialog[0] for (Triggering player)
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Working on this...i will edit this post soon.

Here is my version of this...
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • If (((Picked player) slot status) Equal to Is playing) then do (Set NumPlayers = (NumPlayers + 1)) else do (Do nothing)
    • Game - Display to (All players) for 6.00 seconds the text: ((There are + (String(NumPlayers))) + players playing in the game.)
    • Game - Display to (All players) for 14.00 seconds the text: Type -kick [number]...
  • Events
    • Player - Player 1 (Red) types a chat message containing -kick as A substring
    • Player - Player 2 (Blue) types a chat message containing -kick as A substring
    • Player - Player 3 (Teal) types a chat message containing -kick as A substring
    • Player - Player 4 (Purple) types a chat message containing -kick as A substring
    • Player - Player 5 (Yellow) types a chat message containing -kick as A substring
    • Player - Player 6 (Orange) types a chat message containing -kick as A substring
    • Player - Player 7 (Green) types a chat message containing -kick as A substring
    • Player - Player 8 (Pink) types a chat message containing -kick as A substring
    • Player - Player 9 (Gray) types a chat message containing -kick as A substring
    • Player - Player 10 (Light Blue) types a chat message containing -kick as A substring
    • Player - Player 11 (Dark Green) types a chat message containing -kick as A substring
    • Player - Player 12 (Brown) types a chat message containing -kick as A substring
  • Conditions
    • And - All (Conditions) are true
      • Conditions
        • (Integer((Substring((Entered chat string), 7, 8)))) Greater than or equal to 1
        • (Integer((Substring((Entered chat string), 7, 8)))) Less than or equal to 12
  • Actions
    • Set PlayerWhoMightBeKicked = (Player number of (Player((Integer((Substring((Entered chat string), 7, 8)))))))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • ((Player(PlayerWhoMightBeKicked)) slot status) Equal to Has left the game
            • ((Player(PlayerWhoMightBeKicked)) slot status) Equal to Is unused
      • Then - Actions
        • Game - Display to (All players) for 6.00 seconds the text: ((Name of (Player(PlayerWhoMightBeKicked))) + 's slot is empty.)
        • Skip remaining actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Player number of (Triggering player)) Equal to PlayerWhoMightBeKicked
      • Then - Actions
        • -------- Check to see if the player is stupidly voting for himself or not --------
        • Game - Display to (All players) for 6.00 seconds the text: Are you trying to g...
        • Skip remaining actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • PlayerHasVotedForPlayer[((Player number of (Triggering player)) x PlayerWhoMightBeKicked)] Equal to False
      • Then - Actions
        • Set NumVotes[PlayerWhoMightBeKicked] = (NumVotes[PlayerWhoMightBeKicked] + 1)
        • Set PlayerHasVotedForPlayer[((Player number of (Triggering player)) x PlayerWhoMightBeKicked)] = True
        • Game - Display to (All players) for 6.00 seconds the text: (((Name of (Triggering player)) + has lodged a vote against ) + (Name of (Player(PlayerWhoMightBeKicked))))
        • Game - Display to (All players) for 6.00 seconds the text: (((Name of (Player(PlayerWhoMightBeKicked))) + has had ) + ((String(NumVotes[PlayerWhoMightBeKicked])) + vote(s) against him.))
        • Set NumVotesNeededToKick[PlayerWhoMightBeKicked] = (((NumPlayers / 2) - NumVotes[PlayerWhoMightBeKicked]) + 1)
        • Game - Display to (All players) for 6.00 seconds the text: (((Name of (Player(PlayerWhoMightBeKicked))) + needs ) + ((String(NumVotesNeededToKick[PlayerWhoMightBeKicked])) + more vote(s) to be kicked from the game.))
      • Else - Actions
        • Game - Display to (Player group((Triggering player))) for 6.00 seconds the text: ((Sorry, you have already voted for + (Name of (Player(PlayerWhoMightBeKicked)))) + to be kicked.)
        • Skip remaining actions
    • Trigger - Run CheckPlayer <gen> (checking conditions)

  • Events
  • Conditions
  • Actions
    • Set PercentageVotedForKick = ((Real(NumVotes[PlayerWhoMightBeKicked])) / (Real(NumPlayers)))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • PercentageVotedForKick Greater than 0.50
      • Then - Actions
        • Game - Defeat (Player(PlayerWhoMightBeKicked)) with the message: You were kicked.
        • Game - Display to (All players) the text: (Player + ((Name of (Player(PlayerWhoMightBeKicked))) + has received a majority of kick votes and has been kicked.))
      • Else - Actions
        • Game - Display to (All players) for 6.00 seconds the text: (((String((Integer((PercentageVotedForKick x 100.00))))) + percent of players have voted for ) + ((Name of (Player(PlayerWhoMightBeKicked))) + to be kicked.))
 
Status
Not open for further replies.
Top