removeHeadgear unit;
The first component, removeHeadgear, is the actual command that describes what is to be removed from the following component. The following component, unit, details which solider the command will affect, in this case, to remove any headgear he may be wearing.
This line is placed in the INIT line (shown below):
There are a few options for the unit component that will allow for tweaking of who is affected by the command. Perhaps the easiest one to learn and use is this. It will run the command on whoever the INIT line belongs too, in this case, s_marksman.
A sample of the code that may be used would :
removeHeadgear this;
removeHeadgear s_marksman;
Both commands will remove the headgear, but the second line will always affect the s_marksman soldier regardless of whose INIT line the code is written in. This can be useful when rearming an entire squad as only one soldier will need to have all the code inside of their INIT line.
What about altering weapons or items? This is done in a very similar fashion, the difference comes between the use of all and allassigned. Here is some sample code to remove the items from a unit:
removeallitems this;
removeallassigneditems this;
This can get a little confusing. The first line will not remove any items that are currently being used or are assigned to the player. For example, a map or GPS device. The second line will remove every item on the character, including assigned items such as the map. Only removing stored items can come in handy for clearing a unit but not having to re-add all the base items like a map or compass.
Weapons can also be removed using this command:
removeAllWeapons this;
This will, as the command shows, remove all weapons and attached items from the soldier. This is useful for rearming the soldier with the weapons that you want them to have.
It is also possible to completely clear the soldier of everything, using a combination of all these commands:
removeHeadgear this:
removeGoggles this;
removeVest this;
removeBackpack this;
removeUniform this;
removeAllWeapons this:
removeAllAssignedItems this;
This will remove absolutely everything from the soldier, weapons, clothing, maps, ammo etc. Here is what the character will look like after using this code:
Now a blank slate has been created to allow for full customisation with no possibility of leftover items or conflicting items. Here is a summary of all the code:
_________________________________________________________________________________
The base command:
removeHeadgear unit;
Remove all Clothing:
removeHeadgear this:removeGoggles this;
removeVest this;
removeBackpack this;
removeUniform this;
Remove all Weapons:
removeAllWeapons;
Remove all items and only stored ones;
removeAllAssignedItems;
removeAllItems
Remove Everything and make blank slate:
removeHeadgear this:removeGoggles this;
removeVest this;
removeBackpack this;
removeUniform this;
removeAllWeapons this:
removeAllAssignedItems this;
That is how to remove items of different types and create a blank slate for customisation. The next post will detail how to add Weapons and Ammo as well as adding and removing attachments.