• 🏆 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] Making sure this trigger works

Status
Not open for further replies.
Level 3
Joined
May 21, 2009
Messages
37
Hello, I've been having trouble with this trigger.

  • Actions
    • Set Random_Player = (Random player from Player_Group_I)
    • Set Werewolf = Random_Player
    • Game - Display to (All players) the text: (Name of (Random player from Player_Group_I))
    • Player Group - Remove Random_Player from Player_Group_I
    • For each (Integer A) from 1 to 5, do (Actions)
      • Loop - Actions
        • Set Random_Player = (Random player from Player_Group_I)
        • Set Villager = Random_Player
        • Game - Display to (All players) the text: (Name of (Random player from Player_Group_I))
        • Player Group - Remove Random_Player from Player_Group_I
Additional information:

The trigger is not initially on. I added a "Game - Display text" at the begging of it just to see if it rolls, which, apparently it does.
Random_Player, Villager and Werewolf are all player variables.

How can I make sure this works? I tried putting the "Game - Display the name of random player" just to make sure it picked the players out but it displays nothing. Some thoughts?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Could you explain what the trigger is supposed to do?

When do you set your player group?
Also, you say: "Game - Display to (All players) the text: (Name of (Random player from Player_Group_I))". Wouldn't "Name of Werewolf", or "Name of Villager" be more logical?

But without the details of what you want to achieve, there's not much I can do.
 
Display the name of "Werewolf", not another random player. You call the random player function twice, which won't necessarily bring up the same random player.
In the IntegerA loop actions, don't forget to use:
  • For each (Integer A) from 1 to 5, do (Actions)
    • Loop - Actions
      • Set Random_Player = (Random player from Player_Group_I)
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Player Not Equal to Werewolf
        • Then - Actions
          • Set Villager[(IntegerA)] = Random_Player
        • Else - Actions
 
Level 3
Joined
May 21, 2009
Messages
37
Okay. I just want to assign roles of werewolves ( which in this case only one player gets) and villagers to random players.

Also, you say: "Game - Display to (All players) the text: (Name of (Random player from Player_Group_I))". Wouldn't "Name of Werewolf", or "Name of Villager" be more logical?

I was not sure of the outcome of that. Don't I need to use array variables for that?

Edit: Nevermind, I saw my flaw there regarding the Display message. I'm going to give it a test.
 
Level 3
Joined
May 21, 2009
Messages
37
Okay, here is the edit.

  • Actions
    • Game - Display to (All players) the text: Trigger starts!
    • Set Random_Player = (Random player from Player_Group_I)
    • Set Werewolf[1] = Random_Player
    • Game - Display to (All players) the text: (Name of Werewolf[1])
    • For each (Integer A) from 1 to 5, do (Actions)
      • Loop - Actions
        • Set Random_Player = (Random player from Player_Group_I)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Random_Player Not equal to Werewolf[1]
          • Then - Actions
            • Set Villager[(Integer A)] = Random_Player
            • Game - Display to (All players) the text: (Name of Villager[(Integer A)])
          • Else - Actions
The "Trigger starts!" message displays, but that's it. Sorry if I've gotten it all wrong again. Also, does it have any importance if I test it with AI as opposed to actual players?
 
Last edited:
Level 2
Joined
Jun 30, 2011
Messages
18
  • Set Random_Player = (Random player from Player_Group_I)
When you do that in your edit, you had werewolf[1] set to Random_Player, and you just made two people enter Random_player.
Not to mention, on the then, you do this:
  • Set Villager[(Integer A)] = Random_Player
Basically meaning werewolf[1] is still set to Random_Player, and now Villager [1-5] is set to Random_Player.
And the AI doesn't make a difference. They are considered Players to the Triggers. (Thats why in Player Control Comparison you see Neutral).
Now what I said all above is without seeing the map and not knowing exactly what the triggers do. Because right now all you have is a message appearing and them being added to a group but NOTHING else.
 
Last edited:
Level 2
Joined
Jun 30, 2011
Messages
18
Make sure the Random_Player is a player group or has it's own array as well. Because you set Villagers [1-5] as a Random Player (5 people can't be 1 player).

I am not an Experienced Trigger at ALL, as you can tell, just saying what I think it could be. Just trying to help.
 
Status
Not open for further replies.
Top