• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger Help Please

Status
Not open for further replies.
Level 11
Joined
May 10, 2008
Messages
1,001
Me and a fellow comrade of mine are making this Alterac Valley map and were trying to figure out how to control the reinforcements directions... and what i mean is:

Theres a unit called "The General" and we want to give him abilities which will change the direction of the spawning troops (troops spawn in front of him periodiclly)

Please help
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Wheres the problem?

You have a few statements there and no actual problem you have doing them.

What I would do is create a spawn system which gives a type, rate, owner and desternation for each spawn on the map. I would use 4 parralel arrays with an integer for the number of spawns.. When a new spawn is made, I simply add it to the array in a clean index (using the number to find that). When a spawn is killed or stopped, you remove it from the array by getting the far top spawn (last added) and overwriting the removed one and reducing the number stored by 1. As the order does not mater, there would be no problems in doing this

As for your ability. As this is not often used (only once every few seconds on average). I would use an O(n) itteration through all spawn objects and find the ones who are owned by the general (how that is done is up to you can can be done in many ways). When a spawn belonging to the general is found, simply change the desternation point to the target point of the spell being cast.
 
Status
Not open for further replies.
Top