Unit Battalions

S

Skitz_24

Guest
Anyone who has played Battle for Middle Earth will know what I am talking about with this.

I am wondering if you can make it so a group of, lets say 6 units, unit a single unit [yes I know this sounds really weird].

Let me use footmen as an example...

Normally a footman in just one single unit, when you select it, it is just that SINGLE unit. I want it so that when you select it, the group of units, is all selected, but the only count as one...

I honestly have no real way to sanely describe this I am sorry, I am just wondering if it is possible to do this, and if it is, is it also possible to make it so they level up?
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
Such as in Dawn of War. Or Company of heroes.

Well, the first idea that comes to my mind is to make 1 type of footman who will be the leader of your troop.
A second type of footman gets the locust ability. This way you can only click on the leader.
Every time you give an oder to the leader, all his locust underlings will receive the same ( via trigger) and follow him.
It'd be a kinda complicated system, though ..
 

Seannny

Why GUI when you can Jass?
Reaction score
46
well.. lets see.. The way I can see this working.. is...hmmm

You could make a trigger to where, when you train one footman, it created 4 or 5 more near it, and every second or so, orders those units to your unit. The problem is, then they will never be able to fight in battle..

let me think...

I dunno man i dont think it can be done without some seriously complex triggers
 
S

Skitz_24

Guest
@ s3rius
the locust thing won't work b/c then the others can't get attacked and if the leader dies, well then u have a bunch of useless footmen that can't move

@Seanny
There has to b something right? :p

Anyone else have any suggestions and what not?
 
S

Skitz_24

Guest
For now I want to try this for a single player map
Then I will try it for Multi player
 

Seannny

Why GUI when you can Jass?
Reaction score
46
What you could do is have the units spawn, and have them repeat the actions that the other unit has to do, the battalion leader. then have it to where if one of the other units is selected, force the user to deselect it. then, when the battalion leader dies, All the units die.
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
when the battalion leader dies, All the units die.
You could add all units into a group varialbe. When the leader dies you get a random unit out of that group and promote it to the leader.
 

San-D

New Member
Reaction score
15
I had that same idea, based on dawn of war. I have an idea, but I never tested it. It has a few triggers:

Variables:
-Point (point)
-Place (integer)
-GroupMember (unit)


1.(Optional) Make a dummy ability to reinforce/refill a group's number of units
2.Trigger 2 - Lets say u want the units to be 200 apart, and there is a max of 9 units in group:

Code:
Melee Initialization
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Animate Dead
    Actions
        Set Point[1] = (Position of (Casting unit))
        Set Point[2] = (Point[1] offset by (200.00, 0.00))
        Set Point[3] = (Point[1] offset by (-200.00, 0.00))
        Set Point[4] = (Point[1] offset by (0.00, 200.00))
        Set Point[5] = (Point[1] offset by (0.00, -200.00))
        Set Point[6] = (Point[1] offset by (200.00, -200.00))
        Set Point[7] = (Point[1] offset by (-200.00, -200.00))
        Set Point[8] = (Point[1] offset by (200.00, 200.00))
        Set Point[9] = (Point[1] offset by (-200.00, 200.00))
        Set Place = (Place + 1)
        Unit - Create 1 Footman for Player 1 (Red) at Point[Place] facing Default building facing degrees
        Set GroupMember[Place] = (Last created unit)

The Initial value of the Place must be 1

4.Trigger 3 Make a trigger that when a unit from the GroupMember var dies, u set Place = Place-1

5.(This has lots of writing!) When u order a unit, make the computer tell all the rest of them to be ordered to do the same but at their respective offset points!
 
S

Skitz_24

Guest
That might work, wit h a little tinkering :p

If I can get this working I will think about making a system or a Tutorial for the Repository

Also as an advanced thing, if I could make it so I could select each member of the battalion, that would be a bonus XD
 

San-D

New Member
Reaction score
15
Simple!

Trigger:

U need a Battalion variable (unit group)

Code:
Melee Initialization
    Events
        Player - Player 1 (Red) Selects a unit
    Conditions
        (Unit-type of (Triggering unit)) Equal to Footman
    Actions
        Selection - Select (Battalion)

I DONT KNOW THE EVENT RESPONSE TO UNIT SELECTION!!! if it doesnt work, know that Triggering Unit is wrong
 
S

Skitz_24

Guest
Okay, well later tonight I will test all this out and see if it works ^___^

If it does work I will see if I can get it to work for multiplayer :D
 

San-D

New Member
Reaction score
15
I'm not pretty sure whats the difference between Single and Multiplayer but IT should work everywhere as long as you dont put in WAIT actions, or so I've learned...:confused: (I've never played anything online!!!)
 
S

Skitz_24

Guest
Okay, well is there anyone who wants to explain to me things that will work in Single Player but not Multiplayer?
 

WolSHaman

knowledgeably ignorant
Reaction score
51
I made a squad system awhile ago that you might like... each player gets 1 computer player, and whenever a unit trains, a bunch of units owned by a computer player train w/ him, and also you can attach commanders to squads. Want me to post the triggers here?
Note: I won't be able to post them immediately, as I'm leaving soon, but you could expect to see it by the end of the night.
 

Romek

Super Moderator
Reaction score
964
You'd have to use an incredible amount of unitgroups.
You'll basically need a unitgroup version of PUI. :p
and when 1 unit in the group is selected, they all receive the same orders.
and only 1 unit from each group an be selected at a time, but maybe add a selection circle to the rest of them to show they're part of the group (I think its a model)
 
S

Skitz_24

Guest
Sure WolSHaman if you wanna post your triggers it would be nice :D

You make a point Romek
BTW, happy birthday :D
 

WolSHaman

knowledgeably ignorant
Reaction score
51
K I just updated my squad system, so here's the new and improved version:
First, some things that I must note:
-Each player must have 1 computer player, and this player must be 6 player slots below them. For example, player 1 must have player 7 as his computer player, player 2 must have player 8 etc.
-The computer players cannot train any units.
-Each commander can only attach to 1 type of squad unit. For example, the bomber commander can only attach to a bomber squad, a fighter commander can only attach to a fighter squad etc.
Now, here's the relevant triggers
upon a unit training, its custom value must be set, this is important for ordering, and you must set the custom values of all the other computer players who spawn at that time. Here's the example:
Code:
Bomber
    Events
        Unit - A unit Finishes training a unit
    Conditions
        (Unit-type of (Trained unit)) Equal to Bomber Squad
    Actions
        Unit - Set the custom value of (Trained unit) to (Number of living Bomber Squad units owned by (Owner of (Trained unit)))
        For each (Integer A) from 1 to 4, do (Actions)
            Loop - Actions
                Set unitspawnpoint = (Position of (Trained unit))
                Unit - Create 1 Bomber Squad for (Player(((Player number of (Owner of (Trained unit))) + 6))) at unitspawnpoint facing Default building facing degrees
                Unit - Set the custom value of (Last created unit) to (Custom value of (Trained unit))
                Custom script: call RemoveLocation (udg_unitspawnpoint)
So now whenever a bomber is trained, 4 other bombers will spawn owned by that unit's respective computer player, and their custom values will all be equal. Now comes the part for moving, attacking and stopping in unison. If you're wondering, the "smart" command refers to right clicking, because right clicking to a point and hitting ctrl+m or the move button issue different orders. Now, here's the triggers:
for stopping:
Code:
Stop bomber and commander
    Events
        Unit - A unit Is issued an order with no target
    Conditions
        ((Unit-type of (Ordered unit)) Equal to Bomber Commander) or ((Unit-type of (Ordered unit)) Equal to Bomber Squad)
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
                (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Not equal to (Order("stop"))
    Actions
        Set orderedgroup = (Units owned by (Player(((Player number of (Owner of (Ordered unit))) + 6))) matching ((Custom value of (Matching unit)) Equal to (Custom value of (Ordered unit))))
        Unit Group - Pick every unit in orderedgroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Unit-type of (Picked unit)) Equal to Bomber Commander) or ((Unit-type of (Picked unit)) Equal to Bomber Squad)
                    Then - Actions
                        Unit - Order (Picked unit) to Stop
                    Else - Actions
for moving
Code:
Move Bomber and commander
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        ((Unit-type of (Ordered unit)) Equal to Bomber Commander) or ((Unit-type of (Ordered unit)) Equal to Bomber Squad)
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
                (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Not equal to (Order("move"))
                (Issued order) Not equal to (Order("smart"))
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
            Then - Actions
                Set orderedgroup = (Units owned by Player 7 (Green) matching ((Custom value of (Matching unit)) Equal to (Custom value of (Ordered unit))))
                Unit Group - Pick every unit in orderedgroup and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Unit-type of (Picked unit)) Equal to Bomber Commander) or ((Unit-type of (Picked unit)) Equal to Bomber Squad)
                            Then - Actions
                                Set movepoint = ((Target point of issued order) offset by 200.00 towards (90.00 x (Real((Integer A)))) degrees)
                                Unit - Order (Picked unit) to Move To movepoint
                                Custom script: call RemoveLocation (udg_movepoint)
                            Else - Actions
            Else - Actions
and for attacking
Code:
Attack Bomber and commander
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        ((Unit-type of (Ordered unit)) Equal to Bomber Commander) or ((Unit-type of (Ordered unit)) Equal to Bomber Squad)
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
                (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Not equal to (Order("smart"))
                (Issued order) Not equal to (Order("attack"))
    Actions
        Set orderedgroup = (Units owned by (Player(((Player number of (Owner of (Ordered unit))) + 6))) matching ((Custom value of (Matching unit)) Equal to (Custom value of (Ordered unit))))
        Unit Group - Pick every unit in orderedgroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Unit-type of (Picked unit)) Equal to Bomber Commander) or ((Unit-type of (Picked unit)) Equal to Bomber Squad)
                    Then - Actions
                        Unit - Order (Picked unit) to Attack (Target unit of issued order)
                    Else - Actions
Don't worry about attack-moving, even though the support player will move while the main unit attack-moves, the main unit will stop, then attack, thus issuing a new order to the other units, telling them to stop.
K almost done! However, if the unit owned by the player gets destroyed, then another unit must step up, so we need this trigger to get the next unit to step up
Code:
update bomber
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Bomber Squad
        (Player number of (Owner of (Triggering unit))) Less than 7
    Actions
        Set replacementgroup = (Units owned by (Player(((Player number of (Owner of (Triggering unit))) + 6))) matching ((Custom value of (Dying unit)) Equal to (Custom value of (Matching unit))))
        Unit Group - Pick every unit in replacementgroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of units in replacementgroup) Greater than 0
                        (Unit-type of (Picked unit)) Equal to (Unit-type of (Dying unit))
                    Then - Actions
                        Unit - Change ownership of (Picked unit) to (Player(((Player number of (Owner of (Picked unit))) - 6))) and Change color
                        Unit Group - Remove all units of replacementgroup from replacementgroup
                        Custom script: call DestroyGroup (udg_replacementgroup)
                        Skip remaining actions
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Number of units in replacementgroup) Greater than 0
                                (Unit-type of (Picked unit)) Equal to Bomber Commander
                            Then - Actions
                                Unit - Change ownership of (Picked unit) to (Player(((Player number of (Owner of (Picked unit))) - 6))) and Change color
                                Unit - Set the custom value of (Picked unit) to 99999
                                Unit Group - Remove all units of replacementgroup from replacementgroup
                                Custom script: call DestroyGroup (udg_replacementgroup)
                                Skip remaining actions
                            Else - Actions
                                Set groupthatneedsvaluechange = (Units owned by (Owner of (Triggering unit)) of type Bomber Commander)
                                Unit Group - Add all units of (Units owned by (Owner of (Triggering unit)) of type Bomber Squad) to groupthatneedsvaluechange
                                Unit Group - Add all units of (Units owned by (Player(((Player number of (Owner of (Triggering unit))) + 6))) of type Bomber Squad) to groupthatneedsvaluechange
                                Unit Group - Add all units of (Units owned by (Player(((Player number of (Owner of (Triggering unit))) + 6))) of type Bomber Commander) to groupthatneedsvaluechange
                                Unit Group - Pick every unit in groupthatneedsvaluechange and do (Actions)
                                    Loop - Actions
                                        Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 1)
Now you can make squads, however, for each individual unit you must make these triggers for. Now, this is just another thing that you don't need, but if you want to be able to train commanders and add them to squads, first make an ability which targets an ally, and then changes owners to the computer player who is 6 spaces up. To do that use this trigger:
Code:
Bomber commander
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Unit-type of (Target unit of ability being cast)) Equal to Bomber Squad
        (Unit-type of (Casting unit)) Equal to Bomber Commander
        (Ability being cast) Equal to Attach to squad (Archimonde)
    Actions
        Unit - Set the custom value of (Casting unit) to (Custom value of (Target unit of ability being cast))
        Unit - Change ownership of (Casting unit) to player[((Player number of (Owner of (Casting unit))) + 6)] and Change color
Note, each commander can only attach to 1 type of unit. For example, a bomber commander couldn't attach to a fighter squad, just another bomber squad.
 
S

Skitz_24

Guest
Wow, thank you WolSHaman, now I have something to look off of when doing this. :D

I am going to try and make something [in GUI right now] where you have a hero, and you can train units and add them to his squad.

Then I will make unit battalions from there.

If I get it working I will post the stuff here for others to see :D

Wish me luck.
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
I just had an idea for the battalion system... exactly how hard it would be to implement it I'm not sure but here it goes anyways.

When you create a unit it is added to a unit group and a structure is created out of the map area for that group. The structure will have triggered abilities like -

- create another unit for battalion (like in dawn of war)
- move target (just your usual rally point for the structure)
- attack move (custom spell targeting a point or a unit)

etc, etc.

Then whenever a unit is added to the battalion it is added to the unit group, and when ever a unit in that group is selected the structure representing that unit group will be auto selected for the player. Order all units through triggers to follow the orders of the structure and you have a battalion that works as one, and doesn't have problems when a leader dies or whatever.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top