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

[Trigger] Battalions of Units

Status
Not open for further replies.
Level 13
Joined
Dec 3, 2005
Messages
501
Alright right now I have to where when you train a: Battalion. It creates 11 Infantry units and an Officer. Now I want it so when you select and issue a command to the officer the rest will also heed the command. I want it to be so it's the same units that were created with the officer are the same ones that take the command. and when all the units in the battalion die the officer dies. Mind you there will be trainable battalions.
 
Level 6
Joined
Feb 2, 2005
Messages
205
Hmm you will have to trigger that, in first place create 10 Soldiers and 1 Officer. Triggering the Attacks ordered to the officer will be more complicated, the Trigger must work for more than one Battalion tought. Therefore you should work with the Units Costume Value and using Groups for every Battalion in game. The ordering and dieing conditions are the hardest one to create. If you want an example Trigger i'll do one for you.
 
Level 6
Joined
Feb 2, 2005
Messages
205
well my solution will bee enhanced gui, and would look like this, it isnt complete, didnt test it either. It will requiere an dummy Unit to be build. Here are my three Triggers. If you need commt on them just say, and i ll comment then, no time atm :)

  • Spawn Battalion
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Battalion
    • Actions
      • Unit - Remove (Trained unit) from the game
      • Unit - Create 1 Captain for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
      • Unit Group - Add (Last created unit) to BattalionGroup[(BattalionsTrained[(Player number of (Owner of (Triggering unit)))] + (100 x (Player number of (Owner of (Triggering unit)))))]
      • Unit - Set the custom value of (Last created unit) to BattalionsTrained[(Player number of (Owner of (Triggering unit)))]
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Swordsman for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
          • Unit Group - Add (Last created unit) to BattalionGroup[(BattalionsTrained[(Player number of (Owner of (Triggering unit)))] + (100 x (Player number of (Owner of (Triggering unit)))))]
          • Unit - Set the custom value of (Last created unit) to BattalionsTrained[(Player number of (Owner of (Triggering unit)))]
      • Set BattalionsTrained[(Player number of (Owner of (Triggering unit)))] = (BattalionsTrained[(Player number of (Owner of (Triggering unit)))] + 1)
  • Captain Point
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Unit-type of (Ordered unit)) Equal to Captain
    • Actions
      • Custom script: local string udg_tmp_order
      • Custom script: local location udg_tmp_point
      • Set tmp_order = (String((Issued order)))
      • Set tmp_point = (Target point of issued order)
      • Unit Group - Pick every unit in BattalionGroup[((Custom value of (Ordered unit)) + ((Player number of (Owner of (Ordered unit))) x 100))] and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to tmp_order tmp_point
      • Custom script: call RemoveLocation(udg_tmp_point)
  • Captain target object
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Ordered unit)) Equal to Captain
    • Actions
      • Custom script: local string udg_tmp_order
      • Custom script: local unit udg_tmp_unit
      • Set tmp_order = (String((Issued order)))
      • Set tmp_unit = (Target unit of issued order)
      • Unit Group - Pick every unit in BattalionGroup[((Custom value of (Ordered unit)) + ((Player number of (Owner of (Ordered unit))) x 100))] and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to tmp_order tmp_unit
      • Custom script: set udg_tmp_unit = null
What is still to do? Destroying the Groups as soon as they are empty + killing the officer when all units are down.
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
Group Array Battalions (size 1)
Integer CurrentCommValue = 0
Point loc
Point loc2

  • Create Commander
    • Events
      • Unit - A Unit Finishes Training a Unit
    • Conditions
      • Or - Any Conditions are true
        • Unit-Type of (Trained Unit) Equal to (commander type n)
        • ...
        • (list all other commanders)
    • Actions
      • Set loc = Position of Trained Unit
      • Set loc2 = Rally-Point of Triggering Unit
      • Unit - Set Custom Value of Trained Unit to CurrentCommValue
      • (create appropriate number of units for the commanders, eg:)
      • If Unit-Type of Trained Unit Equal to Soldier Commander
        • Then - Actions
          • For Each Integer A from 1 to 11, do actions
            • Loop - Actions
              • Unit - Create 1 Soldier at loc
              • Custom script: if GetLocationX(udg_loc2)!=0 and GetLocationY(udg_loc2)!=0 then
              • Unit - Order Last Created Unit to Attack-Move to loc2
              • Custom script: endif
              • Unit - Add Last Created Unit to Battalions[CurrentCommValue]
        • Else - Actions
      • Custom script: call RemoveLocation( udg_loc )
      • Custom script: call RemoveLocation( udg_loc2 )
      • Set CurrentCommValue = CurrentCommValue + 1
-----------------------------------------------------

  • Commander Death
    • Events
      • Unit - A Unit Dies
    • Conditions
      • (same ol' commander check)
    • Actions
      • (do stuff with units in his group)
      • Custom script: call DestroyGroup( udg_Battalions[GetUnitUserData(GetTriggerUnit())])
-----------------------------------------------------

  • Commander Order
    • Events
      • Unit - A Unit is issued an order targeting an Object
      • Unit - A Unit is issued an order targeting a Point
      • Unit - A Unit is issued an order with no target
    • Conditions
      • (check if the unit is a commander, as usual)
    • Actions
      • Set loc = Target Point of Issued Order
      • Pick Ever Unit in Battalions[Custom Value of Triggering Unit] and do actions
        • Custom script: if GetLocationX(udg_loc)==0 and GetLocationY(udg_loc)==0 then
        • If Targeted Unit Equal to NoUnit then
          • Then - Actions
            • Unit - Order Picked Unit to String((issued order))
          • Else - Actions
            • Unit - Order Picked Unit to String((issued order)) Targeted Unit
        • Custom script: else
        • Unit - Order Picked Unit to String((issued order)) loc
        • Custom script: endif
      • Custom script: call RemoveLocation( udg_loc )


Similar to godless, but I skip out the player factoring in the array (useless), compressed the order triggers into one, fixed leaks, issue the original order from the rally point, and added a death trigger.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
No, I haven't tested them, as I tend to write them off when I don't have access to much other than the internet (I do alot of foruming off my dad's mac laptop)

I may throw together a test map fairly soon though, because I need a similar system (in JASS, but the same general idea)

EDIT: one weird bug I've found, think it's a thread crash. Almost got a fully working testmap, though.
 
Last edited:
woohoo

Hey, I managed to make that system to work :thumbs_up:

However is pretty simple for now, I expect your suggestions and features. In current version you train the capt'n, which comes with 12 soldiers. When you issue order to the capt'n, all soldiers will follow his orders. Still you can move single soldiers around individually.

The system is far from finished though, because I need some essential informations from you:
-how much battallions should be the maximum? (to set the proper size of the array)
-should be the officer a hero? (so you can select it via icon)
-how would the battallion die and death's effect on the food supply?
-what if the officer dies? (should he be invulnerable and die after the whole battallion die?)
-and some more that will come up

I want to ask you if you can test this also multiplayer to check if it works

Btw, I inserted a basic melee system, where the soldiers will switch to bayonet attack when attacked from the close range. Although the ability to 'bayonet charge' is not implemented yet.

I hope this helps. :smile:
 

Attachments

  • battalion.w3x
    102.8 KB · Views: 74
Level 13
Joined
Dec 3, 2005
Messages
501
Hey, I managed to make that system to work :thumbs_up:

However is pretty simple for now, I expect your suggestions and features. In current version you train the capt'n, which comes with 12 soldiers. When you issue order to the capt'n, all soldiers will follow his orders. Still you can move single soldiers around individually.

The system is far from finished though, because I need some essential informations from you:
-how much battallions should be the maximum? (to set the proper size of the array)
-should be the officer a hero? (so you can select it via icon)
-how would the battallion die and death's effect on the food supply?
-what if the officer dies? (should he be invulnerable and die after the whole battallion die?)
-and some more that will come up

I want to ask you if you can test this also multiplayer to check if it works

Btw, I inserted a basic melee system, where the soldiers will switch to bayonet attack when attacked from the close range. Although the ability to 'bayonet charge' is not implemented yet.

I hope this helps. :smile:

Awesome!

To answer you questions:
Maximum amount of Battalions? Hmmm....I don't know I thought it might just be unlimited. If that's not possible I'll come up with a number.

The Officer should be invisible and invulnerable. He dies once every unit in the battalion dies.

I'll test it and give comments :D

Thanks alot btw.
 
Level 13
Joined
Dec 3, 2005
Messages
501
Tested the map and it was perfect! Except for the captain dying and w/e

Just make it to where the Captain only dies once every unit in the battalion is dead :D

Would it be possible to reinforce Battalions? Like since one lost like 3 guys reinforce those 3? If not that's no big deal.

THNX THNX THXN THNX!
 
Level 13
Joined
Dec 3, 2005
Messages
501
No just one of his Battalions I had 3 he had 1 and when his 2nd was made it had 1 guy in it.

PS: The Bayonet system worked great. I sent a Battalion in close to his men and they all switched to melee mode :D
 
Now I got the death system working properly (I hope), now I am still undecided if give the ability to reinforce to the barracks or the general. If I give it to a general, the barracks will not have a cooldown and the barrack will be able to spit out an enourmous number of soldiers at once. If it would be a barrack's ability, do you have to select a general or just one soldier of that group? Also I think it would be harder to implement the AI for.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
I don't exactly know how your squad system works right now, but can't you do something like this:

A Barracks can train both captains and soldiers. Whenever a captain is trained, he is assigned a custom value (e.g. captain 1 has 1; captain 2 has 2, etc.). A captain also has 2 (targettable) abilities: "Add soldier" and "Remove Soldier".
Whenever a captain casts 'add soldier' ability on a soldier-type unit, the custom value of this soldier is changed into the captain's one. Whenever a captain casts "remove soldier", it is changed into 0 (Captains can't have custom value of 0).
Whenever a captain is issued an order, every soldier with the same custom value receives the same order.

I don't know if this could be implemented but I think it only has pro's:
- whenever you train a captain, you check if another captain already uses a custom value. If not, you assign this value to the custom value of the captain. This means that you can use custom values of dead captains for new captains, which means you don't end up with a captain with custom value of e.g. 8796054 but it always stays in the range of 1 - 100 or 200.
- You can have squads with 25 soldiers instead of 11 soldiers. You can assign a max. number of soldiers in 1 squad by checking whenever a captain casts "add soldier" if the amount of soldiers with the same custom value is still lower than e.g. 26.
- Barracks don't suddenly train 5 new soldiers at once when a captain asks for reinforcements
- Soldiers can be transferred from 1 squad to another. Could be useful so you can easily send fresh troops into battle commanded by captain 1, and order captain 2 to take all wounded troops to a field hospital.
- Soldiers with custom value of 0 either are "reinforcements" build by a barracks or troops who just lost their captain. They cannot receive any orders from a captain unless this captain first adds them to his squad. Therefor, reinforcements can be send to ANY squad, rather than to 1 specific squad.
- ...

While I think your system is different from this one, it could be worth considering... if it's possible...

(yay, post 700)
 
I think I get what you mean. The problem is that you will be required to add soldiers everytime you will train a captain, which is impossible task in heat of battle. Also reinforcing would be tedious.

About your pro's:
-I use an array to store unit groups, which is not that much different and I looked after removing the unit group after the battallion has died (not implemented in the version posted here, but it is on my disk now), this method is also easier to implement.
-In no circumstances, you cannot issue an order to more than 12 units at once with a single trigger command, so battallion with more than 12 units (excluding the captain) it makes no sense. However this trigger appears to be MUI, so you are theoretically able to order 12x12+12=144+12=156 units at once (having 12 battallions of 12 units, each battallion has a captain)
-As I said training one per one soldier and attaching it is tedious and it is not good option in the heat of the battle.
-Retreating single units? Well this is still possible, as long you do not issue orders to the captain, but in this game are single units supposed fight to death as this game feature larger scale battles.
-...
-...

You can still make your own system :wink:
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
I think I get what you mean. The problem is that you will be required to add soldiers everytime you will train a captain, which is impossible task in heat of battle. Also reinforcing would be tedious.

About your pro's:
-I use an array to store unit groups, which is not that much different and I looked after removing the unit group after the battallion has died (not implemented in the version posted here, but it is on my disk now), this method is also easier to implement.
-In no circumstances, you cannot issue an order to more than 12 units at once with a single trigger command, so battallion with more than 12 units (excluding the captain) it makes no sense. However this trigger appears to be MUI, so you are theoretically able to order 12x12+12=144+12=156 units at once (having 12 battallions of 12 units, each battallion has a captain)
-As I said training one per one soldier and attaching it is tedious and it is not good option in the heat of the battle.
-Retreating single units? Well this is still possible, as long you do not issue orders to the captain, but in this game are single units supposed fight to death as this game feature larger scale battles.
-...
-...

You can still make your own system :wink:

I never said that you can't keep it like it is now: whenever you train a captain, a standard squad is trained too, just like it's done now. I just said that, in addition to that, you could train soldiers separatelly (see point 3)

- ok, basically there's no real difference between storing it in a custom value or in an arrayed variable. it was just another way :)
- You could add every unit with the same custom value to a temp. unit group, then loop through that group picking a random unit, giving him the order and removing him from the temp. group. and picking the next unit in the group. By giving each unit the order separatelly, you can technically have a captain give orders to 25 units.
- a Barracks has 11 slots that can be reserved for units. you could use a few for training 1 unit, 2 units or 5 units simultanously. This way you can easily train your reinforcements without having to use the full queue of your barracks for 7 soldiers. Need 11 soldiers for your dead squad? build 2 times 5 soldiers and 1*1 soldier. only requires 3 clicks for 11 soldiers.
- as soon as you give an order to your captain, the retreating unit will follow that order, which means that it's going to be much easier to succesfully retreat a unit with my method than with yours. Besides, if you're not planning to retreat a unit in a battle because it's a large scale battle to death anyway, why bother adding something like "reinforcements" to a captain or a barracks? Just train a new captain and let the old fool die :). It'd be much more effective and less buggy (i.e. barracks training reinforcements way to quickly)
- ...?
- ...

I might, but I probably won't... I don't have enough time already to do a small part of what I want to do...
 
-cycling between unit groups is much faster than cycling among all units
-that system of training unit looks ugly (yes thats important to me) and harder to implement AI with it and you will still have to manually attach soldiers.
-being large scale battle, usually you want to have whole battallions retreat when your army is losing, one soldier does not mean nothing, after that, you replenish your battallions at full and maybe train additional ones
 
Level 13
Joined
Dec 3, 2005
Messages
501
I like your idea Eleandor. It would be great for a small scale tactics map. Mixing divisions up and what not. It would be GREATLY appreciated if you posted a map demonstrating your style of this system.

Any progress thus far on your system Mechanical_man?
 
Level 13
Joined
Dec 3, 2005
Messages
501
I had read that before I was just wondering if anything else had been updated.

Also. How do you modificate the trigger like for more and different units.

Like in my map I want 3 different Battalion types. Infantry, Calvary, and Artillery. Artillery only having 3 cannons in it. Calvary having 6 men in it. Infantry having 12.
 
Status
Not open for further replies.
Top