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!
I'm making a Mutiplayer type Pacman map. How would I make the "Ghosts" randomly follow player's main unit? And possible switch followed units if the followed unit is to fast for the ghost.
Good question, the solutions aren't hard, but they're many.
The simplest thing to do would be something like this:
Melee Initialization
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area) owned by GhostAI) and do (Actions)
Loop - Actions
Set tmp_unit = (Random unit from (Units in (Playable map area) matching ((Owner of (Matching unit)) Not equal to GhostAI)))
Unit - Order (Picked unit) to Attack tmp_unit
Custom script: call RemoveUnit(udg_tmp_unit)
You can change the timer value, to keep them chasing after the same person longer.
This is nice and simple, it has it's problems. For e.g. if a unit kills the one it's following you may find it sat still for several seconds before the trigger runs again, neither does it check to see if the ghost has nearly caught a unit, a simple condition along the lines of if units are within x of picked unit would solve that though.
If this isn't quite good enough for you feel free to post back with some more detail on what you want it to do and I'd be happy to assist you further
Wait I just found a bug... when it runs the trigger it removes all the map's units. I think it's because of the Custom script: call RemoveUnit(udg_tmp_unit) part.
Add Custom Script: set bj_wantDestroyGroup = true before the Pick Every Unit action, and remove the other custom script(you don't need to remove unit variables).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.