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

Make units follow another unit in a line

Status
Not open for further replies.
Level 1
Joined
Aug 16, 2011
Messages
3
I am horrible with triggers and try to stay in data and terrain but since I don't have a trigger expert to help with my project here is my question. How do I get a line of units to follow a lead unit. You would only be in charge of the lead unit and have the other units following behind him for show. I need a straight line at all times. If you are looking for a reference on what I am wanting to do look at the game Earthbound. I am recreating Earthbound with the SC2 editor so that is exactly what I want.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
So you are after a line (straight) and not a snake (follows where leader goes)?

You will probably need triggers for a line system. perodically order the unit to go to an offset behind the facing angle of the leader unit. To prevent the other units taking orders, make them unselectable (like interceptors).

Making a snake like system is slightly more trickey. You oculd get the units to patrol (follow) the leader in a chain. For more accurate follow steps approach you will need a trigger that fires every time the leader moves a certain distance.
 
Level 1
Joined
Aug 16, 2011
Messages
3
Ahh thank you good idea. I didn't know how to word it but yeah a snake. I think what you are saying will fulfill that though because of the periodic change. Just set up an event that occurs every second or so. Comparison to check if unit is currently under control of player 1. Action to change facing (at work right now so can't look up specific action). Is that right?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
No...
For a basic snake, just order all members to follow the leader in a chain (so first member folows leader, second member follows first member etc). You can make the members unselectable like interceptors so no need to worry about orders being issued to them.

If you want a more advanced snake, you will have to store the position of the leader every so far (use a perodic trigger to measure distance). Obviously use a queue structure for this to store positions.
 
Level 1
Joined
Aug 16, 2011
Messages
3
I'm kind of lost on the second part. I think I'll have to do some testin tonight with the info from you and I'll post tomorrow on how it worked out.
 
Status
Not open for further replies.
Top