• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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