• 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.

player ingame trigger

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,290
Your question is very vague. I will have to give multiple answers of which there is a possibility none are what you want.

Since triggers only run when a session is active and a session needs at least 1 player to run in the first place then simply running a trigger at the " map initialization" event results in a trigger that runs if a (at least 1) player is in the game. There is no need to run another trigger as the current trigger can handle all the actions.

If you want a trigger that runs another trigger if a slot is controlled by a human then at map initialization you pick each player in all players group and check their controller and slot status. If they are user controlled and human then you run your other trigger, possibly using a global player variable to pass it the player handle.

If you want a trigger that runs when a player with a specific user name is in game (can be spoofed, faked or duplicated so is not a safe way of identifying a specific user) then you pick each player in the all players group and if their player name is equal to your specific player name string then you run the other trigger. You can use a global player variable to pass the player handle to that trigger. Do remember that BatteNet 1 allows you to change your account name letter case ('a' and 'A' count as same letter) without creating another account so you should perform a case insensitive comparison by converting the player name to either upper or lower case depending on the constant used for comparison.

If the game is intended to be hosted by custom build host robots then you might be able to use them to authenticate specific players by injecting messages into the session. They could then use more concrete authentication (logins, IP addresses etc) to determine the identity of a specific player in a way not vulnerable to spoofing. If the source for the robots is kept close there is very little chance of people hosting the map and authenticating when not intended.
 

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,290
become not a created
How can a player become a created hero in the first place? A player is a player and will always be a player. Trying to make it anything else will probably cause the game to crash with a segmentation fault error.

If you want empty players to not get a hero then simply do not make one for that player if their slot status is not equal to playing. This would be done in the loop you use to create either the hero selectors or the heroes themselves. If the heroes are pre-placed then you pick every player in the all players group and if their slot status is not equal to playing then you pick all units belonging to picked player and remove the picked unit.

To adjust the number of kills needed you modify the kill threshold variable based on the number of players not playing. You can get the number of players not playing by incrementing a global integer every time a picked player from the all players group has a slot status of not playing. This global variable can then be used to adjust the global variable for the kill threshold downwards (eg -5 kills per player missing).

These actions can be run at map initialization for convenience. They could also be deferred until the gameplay actually starts (so that early droppers are ignored) and even re-run every time a player leaves.
 
Level 11
Joined
Jun 2, 2013
Messages
613
Not sure what you are needing... Is this what you are asking?

  • Untitled Trigger 002
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) slot status) Equal to (==) Is playing
        • Then - Actions
          • Trigger - Run Your Trigger <gen> (checking conditions)
        • Else - Actions
          • Do nothing
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Hello!,please can you guys tell me how to make a trigger if a player is ingame to run a trigger?
So i want if one player(or more)is not ingame become not a created hero and that a different player have to kill a smaller nummber of some heros to win
Ok

  • Player Leave
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 10 (Light Blue) leaves the game
      • Player - Player 11 (Dark Green) leaves the game
      • Player - Player 12 (Brown) leaves the game
    • Conditions
    • Actions
      • -------- Update Required Hero Kills --------
      • Set TempPlayer = (Triggering player)
      • Set TempInteger = (Team number of TempPlayer)
      • Set RequiredHeroKills[TempInteger] = (RequiredHeroKills[TempInteger] - 1)
      • -------- Reset Hero --------
      • Set TempInteger = (Player number of TempPlayer)
      • Unit - Add Invulnerable (Neutral) to Heroes[TempInteger]
      • Set TempLocation = (TempPlayer start location)
      • Unit - Order Heroes[TempInteger] to Move To TempLocation
      • Custom script: call RemoveLocation(udg_TempLocation)
This trigger will make the hero of the leaving player walk back to base and makes it invulnerable.
You can also just remove the unit but that looks weird.
It also lowers the required amount by 1... you might want to change that to whatever you want.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
What he wants (as far as I can read) is a Hero Arena map.
You as team have to kill enemy heroes equal to 10 times the amount of enemy heroes (for example).
When a player leaves, the amount of kills required must be lowered and the hero of the leaving player must be removed from the game.
 
Not sure what you are needing... Is this what you are asking?

  • Untitled Trigger 002
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) slot status) Equal to (==) Is playing
        • Then - Actions
          • Trigger - Run Your Trigger <gen> (checking conditions)
        • Else - Actions
          • Do nothing

Yea that can be useful thanks.
What he wants (as far as I can read) is a Hero Arena map.
You as team have to kill enemy heroes equal to 10 times the amount of enemy heroes (for example).
When a player leaves, the amount of kills required must be lowered and the hero of the leaving player must be removed from the game.

No you have to kill one time all heros of a different type in game
 
Last edited by a moderator:
Status
Not open for further replies.
Top