[Guide] Adding/Altering extra Vehicles/Attachments to F3

Party-approved future science plus handbooks for the revolution
Post Reply
User avatar
Eagle_Eye
Posts: 209
Joined: Wed Feb 11, 2015 2:35 am
Location: Cork, Ireland

[Guide] Adding/Altering extra Vehicles/Attachments to F3

Post by Eagle_Eye » Wed Jun 24, 2015 9:07 pm

Hello all,

I had a thought that one of the hard parts of making missions is when you come up with a great ORBAT, have all you units looking great in your head, and everything turns to mush once you open up the editor. Obviously F3 contains a great prebuilt ORBAT with Infantry squads, Vehicles and Attachments. Sometimes however, you just have to have that extra MMG team, or 20 man sniper squad. So I thought I would put together a small checklist that people can use when they want to create/alter units from the F3 default.

DISCLAIMER: This is not saying that you should alter the units, in fact it might be a terrible Idea. The FolkARPS Platoon is the way it is for a reason, so always think hard before making changes. Furthermore, this is what I personally do. There might be better/less terrible ways to get this to work, in which case please enlighten and correct me. Also, I have no claim/experience with F3 inner workings apart from what I have figured out and self taught. All credit goes to the F3 team and their great coding/documentation.

What do?
So Comrade, you want to add your new team to the prolific and glorious ranks of the party platoon! Let us use the educational device of an example:

I would like to add a nice GMG MRAP crew to my mission
Excellent, so you want to add a GMG MRAP, along with a driver and gunner to destroy our enemies from afar. There are multiple steps to keep in mind, lets run through them quickly.
  1. Pick an abbreviation for the element, and keep it close to your heart.
  2. Devise the group name
  3. Devise the name of the units and description
  4. Sort out the units loadout for the F3 assignGear function
  5. Include the units in the groupMarker function
  6. Include the units in the groupID function
Excellent, now we have a nice reference to look at, lets get at it!

1) We want a GMG team, so lets call it GMG, neh?
Great, an easy choice. In game (and by extension probably on comms) the element will be known as GMG1. Other common examples would be setting up technicals (cars with 50cals), I like TECH1, or TCN1, or something. Often it is useful to change HAT1 to MAT2, or HMG1 to MMG2, or just add MMG3 or MMG4 or MMG5 (6 MMG teams is probably too many MMGs).

2) Whats a group name?
A units group is their actual in-game group (the people that show up on your STHUD or have light blue lines connecting them on the editor). In F3, all of the units have a line of code in their init field which adds them to a group, and the name of that group can be used in other areas of F3 to do great stuff. Lets look at the 4 units in Alpha 1 fireteam: their init fields all contain:

Code: Select all

GrpNATO_A1 = group this;
which assigns each unit in the squad to the group called GrpNATO_A1. So we are going to make a new group called GrpNATO_GMG1, simple stuff. This will go in the init of our two crewmembers. Lets say we put down 1 "crewman" (our gunner) and 1 "repair specialist" (our driver) in the editor, we can put in both their init boxes:

Code: Select all

GrpNATO_GMG1 = group this; 
3) And the Unit name follows from the group name?
Perfect Comrade, you're catching on. Each unit in the group gets a name, and also a description. The NAME will reference the unit in the code side of things, while the DESCRIPTION will appear as the text in the slotting screen. So back to A1 fireteam. The teamleader has

Code: Select all

NAME: unitNATO_A1_FTL
and his description reads:

Code: Select all

NATO Alpha 1 Fireteam Leader
All makes sense. In our case we have 2 units the driver and gunner, so we'll have :

Code: Select all

NAME: unitNATO_GMG1_D
for the driver and :

Code: Select all

NAME: unitNATO_GMG1_G
for the gunner. Description writes itself - "NATO GMG Hunter Driver" and "NATO GMG Hunter Gunner". We can also give the empty GMG Hunter a name. Generally this follows the format of "vehNATO_CAR0" or "vehNATO_GMG1" or something.

4) Our units need GUNS!
Of course comrade, retake your seat, we're getting to that. Again, F3 has our back. In the unit init, we see a line that reads:

Code: Select all

["ftl",this] call f_fnc_assignGear;
which is of course giving our fireteam leader his normal equipment as we all know and love. If you check out the f/assignGear script, its possible to see a whole host of keywords which will describe all of our common FA units, rat/aar/ar/ftl/co and so on. In this script we can also give people "medkits" (see the "m" for medic section) or "toolkits" (see the "vd" vehicle driver or "pcc" air crew chief). Note however: To use a toolkit, the unit must be of type "repair specialist" in the editor screen.

So we can give our repair specialist his gear by adding for the driver :

Code: Select all

["vd",this] call f_fnc_assignGear;
and for the gunner (crewman).

Code: Select all

["vg",this] call f_fnc_assignGear;
F3 in all its glory also allows for a similar method to stock up the truck. The f_fnc_assign gear function also contains definitions for cars, trucks, IFVs and ammo boxes. So in the init for our Hunter GMG (which is called vehNATO_GMG1) we can put:

Code: Select all

["v_car",this] call f_fnc_assignGear;
A couple of other neat things we can do with the init box:
Alot of the time (especially in adversarials), the thermal optics present with static and mounted guns are too powerful. If you believe this to be true (it will be 100% of the time for PvP, and needs some thinking about for coops), then its possible to disable the thermals in a vehicle by adding to its init (in this case the GMG hunter's init box):

Code: Select all

this disableTIEquipment true;
Also, we want the crew to begin the mission inside the MRAP. This can be achieved for our 2 men by adding a 3rd statement to their init:

Code: Select all

this moveindriver vehNATO_GMG1;
for the driver and:

Code: Select all

this moveingunner vehNATO_GMG1;
for the gunner. Now our attachment is initialised correctly in game, and ready to machine gun some grenades.

Another issue that crops up is the question of what if we have no GMG team slotted? The "condition of presence" box in the unit editor for the car can be used to sort this out. In this box we can put:

Code: Select all

!(isnill unitNATO_GMG1_D)
This line will ensure the GMG hunter will only be present if the driver is slotted, and will avoid extra clutter at spawn, and remove the temptation for people to cheat and take the car when there is no crew assigned.

To give a quick recap, this is what the init box of each of the 3 units (driver, gunner, empty car) look like:
Driver, NAME: unitNATO_GMG1_D

Code: Select all

GrpNATO_GMG1 = group this;
["vd",this] call f_fnc_assignGear;
this moveindriver vehNATO_GMG1;
Gunner, NAME: unitNATO_GMG1_G

Code: Select all

GrpNATO_GMG1 = group this;
["vg",this] call f_fnc_assignGear;
this moveingunner vehNATO_GMG1;
GMG Hunter, NAME: vehNATO_GMG1

Code: Select all

["v_car",this] call f_fnc_assignGear;
this disableTIEquipment true;
5) Brilliant, I've started up the mission preview, but I can't see people on my map! What's going on!
Relax comrade. The excellent markers that we take for granted every week do not appear by magic. Our "friendly fire shields" as I like to think of them, require careful planning, along with a trip to the f/groupMarkers folder. In this folder we find the script for "f_setLocalGroupMarkers". Here each group (remember the name we gave the group earlier) is given a marker which will appear on allies maps.

Each faction is represented, so we are looking for the "case "blu_f":" section. Each group is described in the following way:

Code: Select all

["GrpNATO_A1", 1, "A1", "ColorRed"] spawn f_fnc_localGroupMarker;
So for our new GMG team we can make a new entry that looks like:

Code: Select all

["GrpNATO_GMG1", 7, "GMG1", "ColorOrange"] spawn f_fnc_localGroupMarker;
Here we see the syntax is as follows

Code: Select all

[GroupName,MarkerType,MarkerText,Color] 
(I've chosen 7 for IFV's/APC's, the map text will be GMG1, and the marker will be orange, typical for attachments)

ONE MORE IMPORTANT NOTE COMRADE: The previous bit of code can be incredibly handy if your mission involves 2 or more allied factions (most obviously if you have NATO and FIA units in the same mission that are both player controlled). By default in F3, these NATO and FIA units will not see the other faction on the map, which can potentially lead to problems. A little bit of copy and paste in the groupMarkers scripts can make sure that NATO groups show up for FIA and vice versa.

5) Are We DONE? I can't really FEEL MY ARMS ANYMORE!
Hmm, maybe we should reduce the party allotment of "attention enhancers" for these party mandated tutorial sessions. Either way, we are almost done. The last file to alter is located in the f/setGroupID folder. The scripts in here function similarly to the groupMarker scripts, we need to add a new entry under the appropriate faction using the new groupname.

So the new entry here might look like:

Code: Select all

["GrpNATO_GMG1","NATO GMG1 -"],
where the , (comma) is very important to include between entries.
"What does this do?" you slur into you desk at me (definitely less amphetamines next time). Well this bit of code makes sure that other references to the new group will have a nicely formatted bit of text. Most obviously, this sets the VON text chat names when comrades type in the chat, easing the logistics of figuring out who is talking.

And thats about it. All we need to do now is make sure that any other specialized parts of F3 (for example mapClickTeleport) which use unit/group names are sufficiently supplied with the new units/group names. Another final check is that any triggers or other scripts that use unit names are suitably written to account for any changes to the groups and units.

And so we have it. Feel free to ask questions/suggest changes corrections, this isn't a hand-holding tutorial, and I am just pointing you in the general direction, so apologies for typos/lack of shiney pictures. Hopefully this helps someone to create some great missions, I look forward to playing it! And before you go, I have one last disclaimer: I have not touched upon in this post the Buddy Team Colours module that is in F3, which can be used to further customise groups. I shall assume that if you got this far you can figure it out yourself, and really for a 2 man attachment team there is no need to worry about it.

Post Reply