mylemonblue
You can change this now in User CP.
- Reaction score
- 7
What I am trying to accomplish is picking every individual hero on the map at game initialization (Not counting passive non-computer/player controled heroes). Now, every so often the game will get the average of their levels and then store it in a variable. At game start a bunch of level 1 creeps are on the map based off heroes and as the average level of the player controled heroes goes up, the creep hero's levels will go up.
Now, I was able to count the number of heroes
But the problem comes up when it comes time to average their levels. THere is currently three player owned heroes on the map. Right now they are pre-placed, but I want to try and figure out if, later, an additional player hero comes into the game. I figure I can add the preplaced ones into an array, but what about entering new ones? Something along the lines of this? ->
Whipped up in a moment of "Why didnt I think of that before posting this!?", but I still think there is a better way to go about this.
I'm confusing myself a little I guess.
When testing my original method which was more or less the same as the first trigger in the post except it was "avg = avg + 1", I would always get '0' when testing it with
The hero arena map Terminus Arena had a similar function which is what I am trying to recreate, but the map is protected (Thankfully. It is a great map.) and the author is no longer active and hasn't updated it in over a year it seems.
Now, I was able to count the number of heroes
Trigger:
- CountHeroes
- Events
- Time - Elapsed game time is 0.67 seconds
- Conditions
- Actions
- Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Picked unit) is A Hero) Equal to (==) True) and ((Owner of (Picked unit)) Not equal to (!=) Neutral Hostile))) and do (Actions)
- Loop - Actions
- Unit Group - Add (Picked unit) to unitsGroup
- Loop - Actions
- Set avg = (Number of units in (Units in (Playable map area) matching (((Picked unit) is A Hero) Equal to (==) True)))
- Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Picked unit) is A Hero) Equal to (==) True) and ((Owner of (Picked unit)) Not equal to (!=) Neutral Hostile))) and do (Actions)
- Events
But the problem comes up when it comes time to average their levels. THere is currently three player owned heroes on the map. Right now they are pre-placed, but I want to try and figure out if, later, an additional player hero comes into the game. I figure I can add the preplaced ones into an array, but what about entering new ones? Something along the lines of this? ->
Trigger:
- Untitled Trigger 002
- Untitled Trigger 002
- Events
- Unit - A unit enters (Playable map area)
- Conditions
- ((Entering unit) is A Hero) Equal to (==) True
- Actions
- Set uHero[tmpInt] = (Entering unit)
- Unit Group - Add uHero[tmpInt] to unitsGroup
- Set tmpInt = ((Number of units in unitsGroup) + 1)
- Events
- Untitled Trigger 002
Whipped up in a moment of "Why didnt I think of that before posting this!?", but I still think there is a better way to go about this.
I'm confusing myself a little I guess.
When testing my original method which was more or less the same as the first trigger in the post except it was "avg = avg + 1", I would always get '0' when testing it with
Trigger:
- TallyAverage Level
- Events
- Player - Player 1 (Red) types a chat message containing -avg as An exact match
- Conditions
- Actions
- Game - Display to (All players) the text: (String(avg))
- Events
The hero arena map Terminus Arena had a similar function which is what I am trying to recreate, but the map is protected (Thankfully. It is a great map.) and the author is no longer active and hasn't updated it in over a year it seems.