• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Murder game . . . Not allow a player to have more than one role

Status
Not open for further replies.
Level 6
Joined
Mar 17, 2012
Messages
105
SOLVED


I'm making a murder game, and there are twelve separate roles for people to acquire when the game starts. One of them is the killer. Here is the working trigger for picking the killer:

  • pick killer
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set killer = (Random player from (All players))
      • Wait 5.00 seconds
      • Unit Group - Pick every unit in (Units owned by killer) and do (Actions)
        • Loop - Actions
          • Unit - Add Transform ( into Killer ) to (Picked unit)
      • Game - Display to (Player group(killer)) the text: |cffff0000You are t...
      • Wait 15.00 seconds
      • Game - Display to (Player group(killer)) the text: |cffff0000Don't rev...
      • Wait 10.00 seconds
      • Game - Display to (Player group(killer)) the text: |cffff0000Be decept...
Now, the error in my game is that the randomly picked players may have more than one role. When I test I usually get 2-4 roles. I want each player to have only one role . . . I tried making If/Then/Else statements in each one, but I thought I'd need a player group variable for all of the people who aren't the role that was given to the player and . . . It is just beyond my skill in triggers (and I'm pretty nubby). So, if anyone knows how I can do this, it'd be appreciated greatly. :D
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Create a player group All_Players or Temp_Players (name doesnt matter)
Pick a role from that group, not from all players
When someone gets a role exclude him from that group
Now we have a group with 11 players
Pick new role from that group and so on...
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
  • Player Group - Remove Player[(Player number of (Picked player))] from Players
Edit/ You might use a loop to evade If/Then/Else multiple times but youd need a variable for the roles too
Edit2/ And don't forget to destroy the group in the end because of leak
Something like...
  • If ((Number of players in Players) Equal to 0) then do (Custom script: Custom script: call DestroyForce(udg_Players)) else do (Do nothing)
 
Status
Not open for further replies.
Top