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

Are formations/lines possible with groups of troops?

Status
Not open for further replies.
Level 4
Joined
Apr 5, 2009
Messages
83
I'm wondering if its possible to force a group of troops into a formation using possibly JASS, or some very complicated model edits or triggers?

I'm currently working on a civil war map and though you can still execute strategic maneuvers...having organized ranks and formations would help.

Maybe if strict ranks aren't possible, is there a way to increase the organization of large groups of troops?

Any help is appreciated, thank you.

Also is there a way to make 2x1 pathing blocker texture? (or is there a default one?) currently the "large" and basic ground pathing blockers are too large and too small...respectively. (This is for shooting over stone walls, fences, trenches, etc)
 
Level 4
Joined
Jul 15, 2009
Messages
29
One way is to use the Object Editor. Under the "Formation Rank" field you can edit the value to anything between 1-12, I think. Your guys will follow the formation they are set to as long as Group Formation is on, located on the toolbar to the right of the in-game minimap.
 
Level 4
Joined
Dec 9, 2008
Messages
52
Here's a way to do it with a dummy "leader" unit. It looks pretty until they go into combat. If you want permanent formation orders that'd take a bit more work.

Make a new map, kill the melee trigger and put in these two triggers named "init" and "formation" and make these global variables: "order" an integer, "leader" a unit, "followers" a unit group, and "loc" a point. Or maybe I could just find a way to upload the map .... =)

Anyway I hope this example at least gives u some ideas. It looks pretty cool to see all the footmen in formation like this. Oh yeah, the dummy unit is the footman standing in front of all the others. Anything he does, the other 50 will do.

Code:
function Trig_init_Actions takes nothing returns nothing
    local integer ix = 0
    local unit u
    call FogMaskEnableOff(  )
    call FogEnableOff(  )
    loop
        exitwhen ix == 50
        set u = CreateUnit(Player(0),'hfoo',ix*96-2000,0,90)
        call GroupAddUnit(udg_followers,u)
        set ix = ix + 1
    endloop
    set udg_leader = CreateUnit(Player(0),'hfoo',96*25-2000,128,90)            
endfunction

//===========================================================================
function InitTrig_init takes nothing returns nothing
    set gg_trg_init = CreateTrigger(  )
    call TriggerAddAction( gg_trg_init, function Trig_init_Actions )
endfunction

Code:
function follow takes nothing returns nothing
    local real leader_x = GetUnitX(udg_leader)
    local real leader_y = GetUnitY(udg_leader)
    local real follower_x = GetUnitX(GetEnumUnit())
    local real follower_y = GetUnitY(GetEnumUnit())
    local real offset_x = leader_x - follower_x
    local real offset_y = leader_y - follower_y
    local real order_x = GetLocationX(udg_loc)
    local real order_y = GetLocationY(udg_loc)
    call IssuePointOrderById(GetEnumUnit(),udg_order,order_x-offset_x,order_y-offset_y)
endfunction

function Trig_formation_Actions takes nothing returns nothing
    if GetTriggerUnit() == udg_leader then
        set udg_order = GetIssuedOrderId()
        set udg_loc = GetOrderPointLoc()
        call ForGroup(udg_followers, function follow)   
    endif
endfunction

//===========================================================================
function InitTrig_formation takes nothing returns nothing
    set gg_trg_formation = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_formation, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddAction( gg_trg_formation, function Trig_formation_Actions )
endfunction
 
Level 4
Joined
Apr 5, 2009
Messages
83
One way is to use the Object Editor. Under the "Formation Rank" field you can edit the value to anything between 1-12, I think. Your guys will follow the formation they are set to as long as Group Formation is on, located on the toolbar to the right of the in-game minimap.

Aye yes, this is fairly useful, the issue is they don't follow it into combat.

Thanks though, at least I can force all infantry into rows of 2 now when they don't have an officer leading them. :grin:

Sometimes the most obvious things elude you.

Here's a way to do it with a dummy "leader" unit. It looks pretty until they go into combat. If you want permanent formation orders that'd take a bit more work.

Make a new map, kill the melee trigger and put in these two triggers named "init" and "formation" and make these global variables: "order" an integer, "leader" a unit, "followers" a unit group, and "loc" a point. Or maybe I could just find a way to upload the map .... =)

Anyway I hope this example at least gives u some ideas. It looks pretty cool to see all the footmen in formation like this. Oh yeah, the dummy unit is the footman standing in front of all the others. Anything he does, the other 50 will do.

Code:

Code:

Wow this is great! I'll be sure to use it and get back with the results.

I can have a general or an officer on a horse leading large groups of troops this way :D.

Should be easy to assign unit groups to officers as all troops come in the form of reinforcements as the battle rages on. Units come onto the battlefield, start this trigger up and players have some great unit command!

Thank you so much.

This adds a whole new dynamic to the map! If your officer is taken out, you lose additional command over your units. (In addition to losing the morale bonus)
 
Level 6
Joined
May 19, 2004
Messages
267
Unfortunately, the system is even older than the video (early 2008). I had problems finding the source-map, so I suspect it's gone.
I've been thinking about remaking it sometime though, can't promise anything.
 
Level 4
Joined
Apr 5, 2009
Messages
83
Aye yes, that is in fact exactly what I'm looking for. You hit the nail on the head.

Also thank you very much for the GUI version of the leader system, I can test both dgriff's and that one to see which facilitates the most command and ease of use.


+rep
 
Level 6
Joined
May 19, 2004
Messages
267
I'd definately remake it if I didn't have other projects to work on atm.
The old system was mostly JASS with some GUI for the API I think.
If I'd rewrite it I could make it alot more advanced now that I can use vJass.

Hopefully dgriffs or the GUI system will fit your needs.
 
Status
Not open for further replies.
Top