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

[Trigger] Variable Player Event

Status
Not open for further replies.
Level 1
Joined
Apr 28, 2018
Messages
2
Hello!

So as of now I am working on making my "rename" feature in my game a lot more efficient, but I'm not exactly sure how.

Currently I have:
Event:
-When Player1(Red) types -rename as a substring...
-When Player2(Blue) types -rename as a substring...
etc

What I'm looking for:
Event:
-When [Player] types -rename as a substring

Thank you for your help!
 
On map initialization, try declaring this loop.

  • For (Picked player) in (All Players), do (Actions)
    • Loop - (Actions)
      • Trigger - Add to <yourTrigger> the event: (Picked Player) types -rename as a substring.
That's the basic thing about it, and if you want it so that you can add only active players, just add a condition onto the loop Actions
 
Level 1
Joined
Apr 28, 2018
Messages
2
Ah okay, that makes sense. Seems strange they never added a player variable that can do this task to begin with...

Question is though, is it required to loop the action? and if so, why? Is it not sufficient to just add the events via Trigger in one instance?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Seems strange they never added a player variable that can do this task to begin with...
Not strange at all seeing how variables have to have a value and a player variable can represent 1 player.

I do agree that it is strange that they did not assign a player constant to mean any player. StarCraft II did this so one can refer to all players with some events and actions, avoiding the need for a loop.
Question is though, is it required to loop the action?
Yes.
and if so, why?
So that it can create an event for the trigger for every player. Each event created is for a single player. So that events are created for every player the action is rerun using different unique players in a loop.
Is it not sufficient to just add the events via Trigger in one instance?
That would only create 1 event for 1 player. Basically your starting problem.
 
Status
Not open for further replies.
Top