• 🏆 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!

Reveal Player

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hello,

in my map I want to reveal a player if his gold exceeds/reaches 400, till it is less than 400 again.

I figured out the following as starting point.

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 400.00
    • Conditions
    • Actions
      • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility from (Position of (Triggering unit)) to a radius of 512.00.
Now how could I make the trigger work universally (not just for player1) , so basically every player who reaches 400 gold is revealed for ALL 11 enemies.

Thanks in advance!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
You can adjust 24 in: For each (Integer A) from 1 to 24, do (Actions)
To the number of Players in your game.
  • Share Vision Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 24, do (Actions)
        • Loop - Actions
          • Trigger - Add to Share Vision <gen> the event (Player - (Player((Integer A)))'s Current gold becomes Greater than or equal to 400.00)
          • Trigger - Add to Share Vision <gen> the event (Player - (Player((Integer A)))'s Current gold becomes Less than 400.00)
  • Share Vision
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current gold) Greater than or equal to 400
        • Then - Actions
          • -------- Shared Vision = ON --------
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked player) Not equal to (Triggering player)
                • Then - Actions
                  • Player - For (Triggering player), turn Shared vision On toward (Picked player)
                • Else - Actions
        • Else - Actions
          • -------- Shared Vision = OFF --------
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked player) Not equal to (Triggering player)
                • Then - Actions
                  • Player - For (Triggering player), turn Shared vision Off toward (Picked player)
                • Else - Actions
The Vision is done with the Action: Set Aspect of Alliance.
 

Attachments

  • Vision Gold 1.w3m
    17.3 KB · Views: 13
Level 7
Joined
May 30, 2018
Messages
290
You can adjust 24 in: For each (Integer A) from 1 to 24, do (Actions)
To the number of Players in your game.
  • Share Vision Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 24, do (Actions)
        • Loop - Actions
          • Trigger - Add to Share Vision <gen> the event (Player - (Player((Integer A)))'s Current gold becomes Greater than or equal to 400.00)
          • Trigger - Add to Share Vision <gen> the event (Player - (Player((Integer A)))'s Current gold becomes Less than 400.00)
  • Share Vision
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current gold) Greater than or equal to 400
        • Then - Actions
          • -------- Shared Vision = ON --------
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked player) Not equal to (Triggering player)
                • Then - Actions
                  • Player - For (Triggering player), turn Shared vision On toward (Picked player)
                • Else - Actions
        • Else - Actions
          • -------- Shared Vision = OFF --------
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked player) Not equal to (Triggering player)
                • Then - Actions
                  • Player - For (Triggering player), turn Shared vision Off toward (Picked player)
                • Else - Actions
The Vision is done with the Action: Set Aspect of Alliance.


Thanks for this solution! Can you explain to me why the integer goes from 1 to 24? :thinking:
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
It's a For Loop, you choose an Integer (Integer A in this case) and a starting value for this Integer (1) and an end value for this Integer (24) and it counts up like this:

Set Integer A = 1 then do Actions
Set Integer A = 2 then do Actions
Set Integer A = 3 then do Actions
etc...
Set Integer A = 24 then do Actions

Integer A is an Integer variable that Blizzard provided for us. You could create your own Integer variable and reference that instead:
  • Actions
    • For each (Integer YourInteger) from 1 to 10, do (Actions)
      • Loop - Actions
        • Game - Display to (All players) for 30.00 seconds the text: (String(YourInteger))
This is extremely useful when working with Arrays and Player Numbers.

In this particular case I'm using Integer A to represent the Player. I use "Convert Player to Index" which takes a number and gives you the corresponding Player. So if you Convert 1 you'll get Player 1 and if you Convert 12 you get Player 12. I then add these Players to the Events in the Share Vision trigger:
  • Trigger - Add to Share Vision <gen> the event (Player - (Player((Integer A)))'s Current gold becomes Greater than or equal to 400.00)
Adding the Events like this isn't necessary, it's a shortcut so that you don't have manually add the Events to the Share Vision trigger yourself. This is how you would normally do it (which is perfectly fine, but tedious):
  • Example
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 400.00
      • Player - Player 1 (Red)'s Current gold becomes Less than 400.00
      • Player - Player 2 (Blue)'s Current gold becomes Greater than or equal to 400.00
      • Player - Player 2 (Blue)'s Current gold becomes Less than 400.00
      • Player - Player 3 (Teal)'s Current gold becomes Greater than or equal to 400.00
      • Player - Player 3 (Teal)'s Current gold becomes Less than 400.00
    • Conditions
    • Actions
So in the For Loop, 1 to 24 is used to represent Player 1 to Player 24, adding these Players to the Events in the Share Vision trigger.
 
Last edited:
Level 7
Joined
May 30, 2018
Messages
290
It's a For Loop, you choose an Integer (Integer A in this case) and a starting value for this Integer (1) and an end value for this Integer (24) and it counts up like this:

Set Integer A = 1 then do Actions
Set Integer A = 2 then do Actions
Set Integer A = 3 then do Actions
etc...
Set Integer A = 24 then do Actions

Integer A is an Integer variable that Blizzard provided for us. You could create your own Integer variable and reference that instead:
  • Actions
    • For each (Integer YourInteger) from 1 to 10, do (Actions)
      • Loop - Actions
        • Game - Display to (All players) for 30.00 seconds the text: (String(YourInteger))
This is extremely useful when working with Arrays and Player Numbers.

In this particular case I'm using Integer A to represent the Player. I use "Convert Player to Index" which takes a number and gives you the corresponding Player. So if you Convert 1 you'll get Player 1 and if you Convert 12 you get Player 12. I then add these Players to the Events in the Share Vision trigger:
  • Trigger - Add to Share Vision <gen> the event (Player - (Player((Integer A)))'s Current gold becomes Greater than or equal to 400.00)
Adding the Events like this isn't necessary, it's a shortcut so that you don't have manually add the Events to the Share Vision trigger yourself. This is how you would normally do it (which is perfectly fine, but tedious):
So in the For Loop, 1 to 24 is used to represent Player 1 to Player 24, adding these Players to the Events in the Share Vision trigger.

Thanks for explaining!

I have another completely different question: How could I integrate a text message, that says that said player, who exceeded the set gold amount, is revealed? Can I integrate it into the Share Vision Trigger or do I need to make an entirely new trigger for that?

I made an entirely new trigger and thought of something like this.

  • Vision Alert
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 385.00
      • Player - Player 2 (Blue)'s Current gold becomes Greater than or equal to 385.00
      • Player - Player 3 (Teal)'s Current gold becomes Greater than or equal to 385.00
      • Player - Player 4 (Purple)'s Current gold becomes Equal to 385.00
      • Player - Player 5 (Yellow)'s Current gold becomes Equal to 385.00
      • Player - Player 6 (Orange)'s Current gold becomes Equal to 385.00
      • Player - Player 7 (Green)'s Current gold becomes Equal to 385.00
      • Player - Player 8 (Pink)'s Current gold becomes Equal to 385.00
      • Player - Player 9 (Gray)'s Current gold becomes Equal to 385.00
      • Player - Player 10 (Light Blue)'s Current gold becomes Equal to 385.00
      • Player - Player 11 (Dark Green)'s Current gold becomes Equal to 385.00
      • Player - Player 12 (Brown)'s Current gold becomes Equal to 385.00
    • Conditions
    • Actions
      • Set VariableSet VisionAlert = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • VisionAlert Equal to True
        • Then - Actions
          • Game - Display to (All players) for 2.00 seconds the text: |cffffff00A player ...
          • Set VariableSet VisionAlert = False
        • Else - Actions
I just don't want the message to permanently pop up after it appeared once after reaching the set amount of gold. So everytime gold increases even further it shouldn't pop up anymore.
(the "greater than" are not uniform on purpose, they just serve as examples) + funny enough: I guess you can use an interger Variable to merge all the individual player events, like you explained before ?
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
No need for new triggers. Simply modify the Share Vision trigger to use a Boolean (Array) that is toggled between true/false.
  • Share Vision
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current gold) Greater than or equal to 400
          • Vision_Bool[(Player number of (Triggering player))] Equal to False
        • Then - Actions
          • -------- Display Message --------
          • Set VariableSet Vision_Bool[(Player number of (Triggering player))] = True
          • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + |cffff0000 is being revealed!|r)
          • -------- --------
          • -------- Shared Vision = ON --------
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked player) Not equal to (Triggering player)
                • Then - Actions
                  • Player - For (Triggering player), turn Shared vision On toward (Picked player)
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering player) Current gold) Less than 400
              • Vision_Bool[(Player number of (Triggering player))] Equal to True
            • Then - Actions
              • -------- Display Message --------
              • Set VariableSet Vision_Bool[(Player number of (Triggering player))] = False
              • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + |cff00ff00is no longer being revealed!|r)
              • -------- --------
              • -------- Shared Vision = OFF --------
              • Player Group - Pick every player in (All players) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked player) Not equal to (Triggering player)
                    • Then - Actions
                      • Player - For (Triggering player), turn Shared vision Off toward (Picked player)
                    • Else - Actions
            • Else - Actions
 

Attachments

  • Vision Gold 2.w3m
    18 KB · Views: 14
Level 7
Joined
May 30, 2018
Messages
290
No need for new triggers. Simply modify the Share Vision trigger to use a Boolean (Array) that is toggled between true/false.
  • Share Vision
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current gold) Greater than or equal to 400
          • Vision_Bool[(Player number of (Triggering player))] Equal to False
        • Then - Actions
          • -------- Display Message --------
          • Set VariableSet Vision_Bool[(Player number of (Triggering player))] = True
          • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + |cffff0000 is being revealed!|r)
          • -------- --------
          • -------- Shared Vision = ON --------
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked player) Not equal to (Triggering player)
                • Then - Actions
                  • Player - For (Triggering player), turn Shared vision On toward (Picked player)
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering player) Current gold) Less than 400
              • Vision_Bool[(Player number of (Triggering player))] Equal to True
            • Then - Actions
              • -------- Display Message --------
              • Set VariableSet Vision_Bool[(Player number of (Triggering player))] = False
              • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + |cff00ff00is no longer being revealed!|r)
              • -------- --------
              • -------- Shared Vision = OFF --------
              • Player Group - Pick every player in (All players) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked player) Not equal to (Triggering player)
                    • Then - Actions
                      • Player - For (Triggering player), turn Shared vision Off toward (Picked player)
                    • Else - Actions
            • Else - Actions

Thanks, awesome!
 
Status
Not open for further replies.
Top