Jump to content
Sign in to follow this  

Wanted: custom formation script pack (resolved)

Recommended Posts

Hi everyone,


I am looking for a copy of General Barron's custom formation script which was released in around 2003. Unfortunately it is long gone from ofpec.com


For your reference I'm quoting its readme (posted by BlackScorpion):




By General Barron
made with OFP v1.46
Thank you for trying out my script. Please read this file before 
using the scripts, as there are many important points that aren't 
immediately obvious.

A) Overview

B) Using the Scripts

C) Making Formations

D) Final Word

E) Version History


These scripts allow the easy creation and use of new formations.
They can be used by AI squads as well as squads with the player
in them, leader or not. Works very much like the in-game formations. 
Only now, you can create your own. It's as simple as plotting points 
on a graph, with the leader at the center.
The formations work with infantry squads, vehicle squads, or 
combinations of the two.
There are actually four scripts involved in using this pack:

1) "<insert name here> formation.sqs"
This is made by you: the editor. It is called by passing the name 
of the GROUP (NOT the unit!wink_o.gif which you want to apply the formation to. 
It is a small script that passes the locations of each unit in the formation to 
formup.sqs. I have included some formations I made in this download, 
as well as a template to follow when you make your own.

2) "formup.sqs"
Called by a formation script, this script assigns each squad member 
his place in the formation by calling formunit.sqs. It cycles through each 
set of coordinates until it is out of squad members.

3) "formunit.sqs"
This script is individually applied to each member of the squad, 
and does the real work of keeping that unit at his place in formation. 
It does this using some trigonometry and some "domove" commands.

4) "formstop.sqs"
If the group is led by an AI unit, this script is called on each group 
member. This prevents the AI from constantly issuing the "fall back into 
formation" command. This script replaces the old "formldr.sqs" that was 
used in v1.2. Unlike before, when the leader is done moving, the rest of 
the squad does fall into its "custom formation".


Applying a formation is easy: simply call your formation script 
by typing [group] exec "<insert name here> formation.sqs". All you 
pass to the script is the name of the GROUP you want to apply the 
formation to. You can call the script via radio, on a waypoint, in a 
trigger, or through any other way your heart desires.
IMPORTANT: Make sure you pass a GROUP, NOT A UNIT!!! 
The script won't work if you pass it a unit. Make sure you don't make 
the easy mistake of typing "this" instead of "group this"!
The script will assign the list of coordinates from the formation 
in numerical order to the squad members. #2 gets the first point, 
#3 the second, etc, for all the members. If members die after the 
script is called, no one will change locations, as in a real formation. 
If the script is called when, say, #3 is dead, it will skip over #3 and 
assign his location to #4, and so on.
When leading a squad with the formation, it will help to have 
them face in the direction you are moving, if you stop a lot. This 
will result in a tighter formation, because the members don't have to 
turn around each time you move.

I have included an easy way to end the formation. Simply change 
the squad's "real" formation to anything but wedge. This can be done 
by the player, or at a waypoint, or by using the command "<group> 
setformation <formation>". When the script is called, it changes the 
squad's "real" formation to wedge, and as long as the squad is in that 
formation, the script will still run. Once the script is "turned off" by changing 
out of wedge, changing back into wedge formation will not "turn it back on". 
You have to call the script again, via radio, waypoint, etc.

While in most ways, the "real" formations and the ones made by 
this script act the same, there are a few key areas to take note. For 
one, since there are many "do move" commands involved, this script 
creates much radio chatter, if the player is in a group using the script. 
Therefore, the script turns off the radio if the player is in a group using it.
You can change this if you want, in "formup.sqs". The radio is not turned 
back on once the formation ends. I suggest you turn off the radio at the 
start of the mission, for consistancy. If you want to use "sidechat" or similar 
radio commands in your mission, you will need to turn on the radio, play 
the radio chatter, WAIT for a second or so, then turn off the radio again.
Another difference can be seen when a player is leading. If the 
player gives a move order to a soldier, the soldier will move there and 
stay there. However, once the player starts moving again, the soldier 
will fall back into formation, unless issued the "stop" command. I may 
come up with a fix for this problem in a later version. If you can figure out 
a fix for this, please let me know.
The final difference has to do with vehicles, which are now usable 
with these formations (as of v1.2). With "real" formations, vehicles 
will spread further apart then infantry. That is to say, in a standard line, 
men might spread 5 meters apart, while vehicles might spread 20 
meters apart. Custom formations do not change in this way. Vehicles 
will stay the same distance as soldiers will.


Okay, this is what you've been waiting for. Making formations is 
very, very simple. I have tried my best to make it as simple as possible.

Basically, all you do is make a list of X/Y coordinates. Each 
coordinate is where a unit will move to, relative to the leader. A 
coordinate of (-10, 20) means that that unit will always try to be 
10 meters to the leader's left, and 20 meters in front of the leader.
Think of it as a graph, or coordinate system, with the leader at the
center. It helps to use graph paper to map out your formations 
before typing them in.
For example:
2 |
| 5
| 6
3 |
And so on, with 11 coordinates total (the leader is always at the 
center, so you don't need to give him coordinates) . When the leader 
rotates, all the squad members will still remain in their position 
relative to the leader (i.e. in front of him, to his right, etc.).
Each coordinate is an array with 2 elements. An array is then 
made out of the arrays, and formup.sqs is called. Don't worry 
about any of that though: just copy the template, rename it, and 
change each of the X's and Y's with the coordinates you want.

First and foremost: Remember that squads using your formation 
won't always have 12 members (unless you only use it on 12 man 
squads). Look at what your formation will look like with less men. 
You usually should be able to see the general shape of the formation 
with at least 4 or 5 men.
To make realistic formations, you need to understand some things. 
First off, a squad is made up of 3 fireteams, of 4 men each. The 
fireteam is the smallest unit organization. Individually, fireteams make 
formations, such as column, echelon, line, skirmish, et. al. A squad 
formation is made by placing these three groups in a line, at an angle, 
etc. See the included wedge formation for an example of this.
Generally, men should spread well-apart. The problem with the 
in-game formations is that one grenade can take out almost an entire 
squad. With a 15 meter blast radius, men would have to be at least 30 
meters apart for a really good spread. At the very least, spread your 
men no closer then 10 meters, except for special-purpose formations. 
My formations are all spread well-apart, which may look funny compared 
to OFP's formations.
Be creative! See the disperse or drill formation for an example of a 
different sort of formation. If you think a very odd or specific formation 
would be great for your mission, go right ahead! Formations made 
for the field, for example, aren't going to work right in an urban setting.
Lastly, don't just look at your formation on "desert island"! Set up a 
few enemies on a real island and see how your formation works in 
a real situation.


I hope you enjoy this script. Feel free to email me any comments, 
complaints, or suggestions. I especially would like to hear about any 
bugs you may happen to come across. I have written here all the 
"quirks" about the script that I know.
If you use my scripts in a mission, please give me some credit for 
it. Just a line in the readme mentioning where you got the custom 
formations would be nice. I suggest that you also instruct the player 
on how to use the formations (i.e. using "wedge" formation, and 
telling squad members to "stop" if they don't want them to fall back 
into formation). And if you do make a good mission, let me know! 
I'd love to play it.

Enjoy, and remain Semper Fidelis!
-General Barron


Version 1.1
First working version. Vehicles do not work as of yet.

Version 1.2
Added a new formation. Script now works with vehicles. Fixing it
was easier than I thought it would be smile_o.gif

Version 1.3
Improved how the script works with AI squads. Replaced "formldr.sqs" 
with "formstop.sqs". The rest of the squad no longer stops when the leader 
stops, but rather finishes falling into formation. Also made a few minor 
changes to the other scripts.

Version 1.4

Code revision in formUnit.sqs to make the AI hold much tighter formations;
also uses less CPU power.

Version 1.5
Fixed a bug introduced in v1.4 that made script not work. Guess if I did a final 
test before posting v1.4  :P. Also cleaned up the math in formUnit.sqs, resulting in 
less calculations by CPU. Fixed bug in formStop.sqs, so that script now ends when 
the unit it is run on has been killed.

Share this post

Link to post
Share on other sites

Great, thank you. I found parts of it in the rescripted combat patrol mission after posting yesterday but not the whole set of scripts with the example formations.

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this