I'm trying to store and update the location of a Hero on the field. Repeating the the trigger every few seconds handles the point updates, but what I'm having trouble with is storing said point for each player.
Example:
Player gets a hero using a dialog -> Create Point (Hero location)
^Repeat for all players, creating a separate point for each player.
I already know I could make 10 separate point triggers, and have 10 separate update triggers. There must be an easier way though.
Well, since it is triggered by clicking on a dialog item, you can register by whom it was clicked. Then, after picking a random point (if it's random), you spawn a hero there and save that point in an array of points with an index of Triggering Player.
1. Create a global variable with the type point and make it an array. Use the hero owner as the index. You should already store the heroes in a similar way.
2. Create 1 trigger which iterates over all active players and updates the points. You could use a threaded action definition with 2 loops within each other, too (never ending + player iteration).
I'm not sure why you need that. If you only need to know the position of a unit, you can get that with a simple function.
Alright, so I here is the situation:
I'm trying to store and update the location of a Hero on the field. Repeating the the trigger every few seconds handles the point updates, but what I'm having trouble with is storing said point for each player.
Example: Player gets a hero using a dialog -> Create Point (Hero location) ^Repeat for all players, creating a separate point for each player.
I already know I could make 10 separate point triggers, and have 10 separate update triggers. There must be an easier way though.
Well, since it is triggered by clicking on a dialog item, you can register by whom it was clicked. Then, after picking a random point (if it's random), you spawn a hero there and save that point in an array of points with an index of Triggering Player.
1. Create a global variable with the type point and make it an array. Use the hero owner as the index. You should already store the heroes in a similar way.
2. Create 1 trigger which iterates over all active players and updates the points. You could use a threaded action definition with 2 loops within each other, too (never ending + player iteration).
I'm not sure why you need that. If you only need to know the position of a unit, you can get that with a simple function.
I'm making a base survival map, and I need to make the target of the waves the "King" for each player. Is there a better way that I don't know about?
@nytemare3701: Go Use the Position of Unit function and store the kings in an unit array.
Position of (kings[ playerWhichShouldBeAttacked ])
@Ahli634: Go
Worked perfectly. Thanks!