• 🏆 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!

Squad System

Status
Not open for further replies.
Level 6
Joined
Aug 24, 2006
Messages
253
I'm working on a WWIII kind of map, and I want to make it somewhat realistic in the way it works. So I'm trying to base it around a squad system for the infantry, along with a few other things based off that.

So when a someone trains a unit, I want the rest of that squad to appear with it. I want to avoid the thing where you click on, it automatically chooses the other eleven as well. So instead I'm making it a six player game and I want to make the remaining six slots be the secondary units that spawn and follow the main one.
But I want to be able to have the squads be divided up, so that way someone can have say two fire teams of six units instead of one with twelve. I'm also making it so that when a tank or something is trained, then you have to assign a squad to run it, which would take several units from one squad and leave the rest as infantry.
And another issue I come across is transports. Is there a way to make it save units following the leader, and then load them back when the leader is dropped off?
 
Level 8
Joined
May 27, 2007
Messages
170
Use a trigger to create the rest of the squad whenever a squad leader is trained. Then add all the squad members to a unit group variable, something like this:

  • Create Squad
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Squad Leader
    • Actions
      • Unit - Create 1 Squadie for (Whichever Player you want) at (Position of (Trained unit)) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to SquadMembers
      • -------- Repeat these actions to create all the different squadies you need --------
Then you can issue that unit group with the orders you want. Such as:

  • Issue Squad Orders
    • Events
    • Conditions
    • Actions
      • Unit Group - Order SquadMembers to Follow Squad Leader
As for dividing your squads up, all I can think of is to give the Squad Leader a custom ability probably based off Channel (Unit Target) which you can use to dismiss units from the squad. Then add the dismissed unit to a new Unit Group variable.

When you load the Squad Leader into a transport. Just use something like:

  • Leader In Transport
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Unit-type of (Loading unit)) Equal to Footman
    • Actions
      • Unit Group - Pick every unit in SquadMembers and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
And when he unloads:

  • Leader Out Of Transport
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Unload (Air Transports)
    • Actions
      • Unit Group - Pick every unit in SquadMembers and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to (Position of (Target unit of ability being cast))
          • Unit - Unhide (Picked unit)
Not so sure about how the unload trigger would run but it's all I could find at a quick glance.

I hope that helps a bit. This is a bit of a complex thing to explain fully here though. There might be a simpler way to do things but that is all I can think of at the minute. I also suggested those thing assuming you are allowing the player only one squad at a time (which can be split to make more).
 
Level 6
Joined
Aug 24, 2006
Messages
253
So for multiple squads would it be easiest to make a new unit group each time one is made or split?
 
Level 6
Joined
Aug 24, 2006
Messages
253
Well there's going to be multiple squads for each player. So the system would have to be dynamic if I'm using unit groups, which I don't know how to do if it's even possible.
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
look up eleandor's grouping system. you can choose which buildings produce squads, how many units are trained per squad, and abilities such as formations/dismiss,recruit/stop commanding,start commanding. however, units are only ordered when directed by the leader, which has an sfx of choice on top of his head.
you cannot apply this to preexisting units though, i think, and each unit still costs food.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
you cannot apply this to preexisting units though, i think, and each unit still costs food.

You *could* apply it to preexisting units if you know the very basics of jass. I might add a more explicit tutorial to how to create squads...

The fact that each unit still costs food could be solved too, with the same reasoning used to apply it to preexisting units.

My system can't split up a group, although with a little bit jass knowledge you could make this yourself.
 
Level 6
Joined
Aug 24, 2006
Messages
253
I've looked at yours and I'm trying to learn JASS enough to start figuring it out, but I'm still at a pretty basic level.

Thanks, I'll see if I can look up the one you're talking about, Steel Stallion.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
What features did you mention?

If you're talking about creating groups of pre-set units, that's already possible since version 1.00, and the latest one has some example triggers added to the FAQ.

(right, rechecked your pm), if you're talking about adding bonuses to formations, well, I might do it if I get the time.
 
Level 6
Joined
Aug 24, 2006
Messages
253
Alright, thanks everyone. I'm looking at Eleandor's system mostly and I think I'm going to try and modify parts of it so that it'll work.
 
Status
Not open for further replies.
Top