• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Event that happens with any player

Status
Not open for further replies.
Level 2
Joined
Mar 18, 2018
Messages
8
How can I make an event like: Player 1 (Red) current gold becomes equal to 100. But instead of one specific player (red), it triggers when any player's current gold becomes equal to 100?
 
Level 13
Joined
May 10, 2009
Messages
868
As far as I know, there's no generic player events. You have to add the same event multiple times to a trigger. Then, use Get Triggering Player function in order to reference which player fired that specific trigger. If you don't want to click a lot on those events when creating them, use a loop in a trigger that runs when map initializes.
  • Initialize generic player events
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Player earns 100 gold <gen> the event (Player - (Picked player)'s Current gold becomes Equal to 100.00)
  • Player earns 100 gold
    • Events
    • Conditions
    • Actions
      • -------- Do whatever --------
You can also use this loop instead of Player Group
  • Initialize generic player events
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: set udg_MaxPlayers = bj_MAX_PLAYERS
      • For each (Integer A) from 1 to MaxPlayers, do (Actions)
        • Loop - Actions
          • Trigger - Add to Player earns 100 gold <gen> the event (Player - (Player((Integer A)))'s Current gold becomes Equal to 100.00)
The difference between Player Group (All Players) and that specific For Loop is that the player group will only add active users and computers. It ignores neutral, rescuable and inactive players.
 
Level 2
Joined
Mar 18, 2018
Messages
8
Okay thanks, I'll try to work it out this way then, I just hoped I was blind to an easier solution, but this is also good. At least a lot better than what I tried.
 
Status
Not open for further replies.
Top