So I've spent the past few days messing around and found out a few ways on how to attach things to moving entities. All methods require apb file editing so refer to this video if you don't already know how to do that. Knowing how to preview entities and interact with them without having to boot up the game for every small change is also useful. For this we use world builder. You can learn how to use it with the NIS world builder guide.
How It Works
Normally within the game there's the model and anything that isn't part of that model is added through the apb file. An example of this would be weapons on infantry or the hull down ability. These are invisible by default until an animator state reveals them. As far as I know whatever the abp points to will get merged into a blueprint. Imagine an infantry unit with all of its available weapons and accessories on it at the same time.
Keep this hierarchy in mind:
- Model Files - Files such as mua, sua, rgt, etc. Includes states, actions, variables, and other necessary data.
- ABP File - Contains pointers to blueprints and additional information such as vehicle physics and other ABPs.
- Blueprint - Collection of all the model files and the abp file (if any) within the folder that share the same name.
- Entity - Collection of everything above that has a physical manifestation within the game. For example crew and fx are not considered entities as they are only visual.
Editing the ABP File
In this example I gave capes to Grenadiers. Animations and everything work the same as if they were Guards Rifles. Blueprints that normally don't attach to infantry work as well but of course they don't have animations for infantry.
By simply adding this line in the Grenadier's abp file it gives them a cape.
"..\\..\\..\\soviet\\props\\cape\\cape",
In addition to pointing to other ABP files and models you can also edit vehicle physics and offsets. In the above example I changed the vehicle_render_offsetY to 3, which makes it 3 meters above the ground. This is only a visual change as the hitbox will stay at ground level. This can also be used on non-vehicle models such as infantry. I believe the only requirement to enable offsets is to set vehicle_physics to 1. Blueprints added within the abp will still center its location on the parent model but keep the offset of the parent. Attaching blueprints will override any offsets.
All blueprints added to the ABP will merge their events, states, variables, and actions. This can be both beneficial and detrimental. An example of how this within the base game is weapons. Infantry initially do not have weapon states such as rifle_mosin_nagant_visible, it's only because the abp references sovietcommongear.abp and that references rifle_mosin_nagant that this state will be available to the infantry.
It's important to understand the directory system of abp files. Incorrectly referencing a model will result in a blue box. The ".." is equivalent to "one level up". As such the lines may be different depending on where the abp file is located. For example if you want to add a conscript_sergeant to your conscript abp you would add:
"..\\conscript_sergeant\\conscript_sergeant",
But if you wanted to reference the sergeant for a grenadier's abp file it would be:
"..\\..\\..\\soviet\\soldiers\\conscript_sergeant\\conscript_sergeant",
Of course you could just use the second line for both of abp files since it will lead to the same result. I think most of the things in the armies folder shares the same folder system but if you were to reference, for example, in the environments folder you'll have to change the number of "..".
Take care on what you reference as some states may overlap. For an example, I wanted to add a pathfinder beacon on a 222. Both of these blueprints have damage_state but the values do not match.
sdkfz_222 damage_state
- healthy
- wreck
- crush
usf_pathfinder_beacon damage_state
- healthy
- damaged
- destroyed
What ended up happening is when 222's health reached the limit that the beacon would enter a damaged state it would disappear. This is because the 222 would also have a damaged state which it doesn't have. I was able to solve this issue with the settings in the picture but just keep in mind that overlaps can happen and it may not be solvable. This issue can also be bypassed through the use of entity attaching which will be covered later in the guide.
Note that editing abp files will not be included in the mod if you haven't made changes in the attribute editor. To get around this use the rebuild function. If you made changes in the AE then build will work normally.
Garrison Markers
This would be useful if you'd like to attach to a garrison marker on a vehicle or building. If the blueprint has the associated marker for garrisoned units you can attach things to that point. In this example I attached a flag to a medic and had it garrison the half track.
"..\\..\\..\\soviet\\props\\patriotic_flag\\patriotic_flag",
You can garrison non-infantry blueprints but it will have an issue of only updating its position every few frames. To get around this you'll have to add basemotion. Keep in mind that the line below may have to change depending on where the abp is located.
"..\\..\\..\\common\\base\\basemotion\\basemotion",
Most tanks are able garrison units. To do so, add marker_ext and hold_ext in ebps. In the example the Sherman can hold at most 6 units but a Tiger has no garrison markers. Because the infantry are no longer on the ground, the attached blueprints wont be either. Note that the abp used by the parent entity must use the same path as the original entity in order to get garrisoned squads to show up. I don't know why this is. For example if you edit the sherman_m4a3 abp it must be located within the same folder and named sherman_m4a3.abp. This rule is only applicable for showing garrisoned squads, you wont have to do it for other types of attaching.
To hide the decorator for the garrisoned unit go to squad_ui_ext in sbps and set the decoratable to false. In ebps set decorator_visibility to hidden. Note this only works when viewing other players' units. Your own units will still show the decorators next to the hold's decorator.
To prevent the unit from exiting the vehicle go to hold_ext and set disable_unload to true. You can also set percent_unload_on_death to 0 to make sure the unit dies with the vehicle.
The Spawn_Attached Function
The Bulldozer Sherman's ability to create barriers has the unique spawn_attached function. This creates an entity(not a blueprint) and attaches it to a specific marker. Vehicles normally have tons of markers all over for things such as damage, headlights, tracks, etc. All of these points can be attached to but the rotation of the marker cannot be changed. To view the markers use the archive viewer to extract mua files and open it up with the notepad.
name = marker you enter with spawn_attached function
subtype = if labeled 'infantry only' this is a garrison marker
transform_m00 = z axis
transform_m01 =
transform_m02 =
transform_m10 =
transform_m11 =
transform_m12 = z axis
transform_m20 =
transform_m21 = z axis
transform_m22 =
transform_m30 = position x
transform_m31 = position y
transform_m32 = position z
I think the first 9 values are for rotation. They match up for the most part but there's something other than just rotation going on. Note that rotation degrees are multiplied by 180?
Position is from the 0, 0 origin of the blueprint. To get a preview of where the marker is on a blueprint open up the world builder and add the entity you want in the NIS with a 0, 0 position. Then add the entity you're planning on attaching and the values for position and rotation from the mua file. You can use the animator action "ui\camouflage" to make the model transparent for easier viewing. The world builder makes y position 10 be the default for some reason but it will be 0 in game.
The barricade attachments are unique as they use the animator_attach command as opposed to the skeleton_attach for crew. This is the same type of attach command that garrison uses although it's used in a different way. The 4 barricades are the only types of blueprints that can use the attach_bulldozer action. The dirt and snow barricades are by default invisible but it seems the mud and rubble barricades are unfinished and have an ugly fence that can't be hidden well. We can inherit this action from the barricade if we reference it in the abp.
As mentioned before garrison, or more specifically, basemotion have the animator_attach command as well. The passenger_attach action has the lock_position_only value which, unlike the bulldozer_attach function, will ignore rotation on the x axis. This means that it will share the same rotation as the model it's attached to as opposed to the rotation determined by the marker. For whatever reason it isn't 100% as I've tried to attach to projectiles but their rotation changes but attaching to vehicles seems to work fine. Also note that while basemotion and the passenger_attach should prevent rotation, it doesn't but using completemotiontree.abp does.
I'll make two examples to demonstrate the possibilities of the power of attachments. One example will make a civilian car driveable the other will create a new fully functional tank with existing assets.
First I'll open up world builder to use it as a reference. I'll be making the data>art>environment>objects>vehicles>civilian>civilian_coupe. Unfortunately this model doesn't have a mua file and thus has no markers so we wont be able to attach things directly to it. In the picture both the coupe and the kubelwagen have a 0, 0 position. The "driver" is actually the gunner crew for the kubelwagen. Unfortunately the coupe model is offset to the back a bit so the models don't line up well. This will make turning look awkward but it can't be helped unless if I find a way to offset attachments.
If I set the kubelwagen's damage_state to crush it will make the model invisible but leave the crew member. However, the coupe also has this damage state so we will want to use the spawn_attached function for this to keep the states separate.
Next we will need to create an abp file for a dummy blueprint. Since there's only the 2 barricade choices (snow and dirt) and basemotion is shared by all infantry we would quickly run into problems if we wanted to use more than 2 different attach blueprints. By using dummy blueprints it will allow us to use as many unique attachments as we want without worrying about affecting existing blueprints. Dummy blueprints should be something that are not used by neither the map nor the tuning pack. Good dummy blueprints to use would be cinematic or unfinished models as they wont be used by maps and we can avoid using these models with some abp editing.
Here's a list of some useful dummy blueprints:
- armies\german\cin_grenadier\cin_grenadier
- armies\german\cin_ostruppen\cin_ostruppen
- armies\german\ostruppen_winter\ostruppen_winter
- armies\german\tank_hunter\tank_hunter
- armies\german\tank_hunter_winter\tank_hunter_winter
- armies\german\wehrmacht\wehrmacht
- armies\soviet\ania_cin\ania_cin
- armies\soviet\churkin\churkin
- armies\soviet\churkin_book\churkin_book
- armies\soviet\hospital_patient\hospital_patient
- armies\soviet\isakovich\isakovich
- armies\soviet\isakovich_captain\isakovich_captain
- armies\soviet\isakovich_captain_cin\isakovich_captain_cin
- armies\soviet\isakovich_photo\isakovich_photo
- armies\soviet\isakovich_prison_book_cin\isakovich_prison_book_cin
- armies\soviet\isakovich_writer_cin\isakovich_writer_cin
- armies\soviet\pozarsky_officer_cin\pozarsky_officer_cin
- armies\soviet\pozarsky_officer_pist_cin\pozarsky_officer_pist_cin
- armies\soviet\pozharsky\pozharsky
- armies\soviet\recon\recon
- armies\soviet\sniper_female_recon\sniper_female_recon
- armies\soviet\specialist\specialist
Most of these blueprints are actually usable if you add the completemotiontree.abp to their abp. However, some like churkin I couldn't get working at all.
You can also reference an abp directly instead of using the blueprint of the folder's name. This will allow you to have as many abp files within a folder as you want. Note that in the AE this will give a warning as the AE doesn't reference the burn folder. If you don't want the warning use the method above. As an example in the cin_ostruppen folder I'll make an abp filed named test_object.abp. Then in the entity_blueprint_ext the string should be:
armies\german\soldiers\cin_ostruppen\test_object
I'll start by making a dummy blueprint out of the cin_grenadier. I'll create an abp file in data>art>armies>german>soldiers>cin_grenadier and add this:
model =
{
"..\\..\\..\\..\\environment\\objects\\vehicles\\civilian\\civilian_coupe\\civilian_coupe",
"..\\..\\..\\Common\\CompleteMotionTree.abp",
}
As the abp file doesn't reference the grenadier in any way it wont be made for the blueprint. Next I'll change the kubelwagen's abp file.
Instead of using basemotion you can just enter an invalid marker name to have it attach to 0, 0, 0. For example just type in "afaeswgwesg" to the marker.
In the AE I'll clone a blank entity and only add these 3 extensions:
- action_apply_ext
- entity_blueprint_ext
- sim_entity_ext
As this entity is only visual it doesn't need any more extensions than these.
- action_apply_ext - animator_set_variable to make the car only have the canopy down
- variable_value: 0
- action_apply_ext - animator_set_state to hide the head and hands made by completemotiontree.abp
- do_action_state_name: on
- state_machine_name: _using_female
- do_action_state_name: on
- action_apply_ext - picture above
The last step will kill the attached entity when the kubelwagen dies so it doesn't persist forever in the world.If the entity still persists after the death of the parent entity it's probably because it still exists after that entity is "killed" this is most notable with infantry as their body will linger. Under health_ext set the death_seconds to 0 to remove this problem. The spawned_entity_actions are bugged or something and wont actually apply so we have to put the actions on the entity entry itself.
Use the always_on ability method within a lower post. This method is not consistent.
Then make these changes for a clone of the kubelwagen:- combat_ext - delete hardpoints to prevent MG attacks and make the gunner have the correct potision
- crew_ext - delete the driver and change the gunner's bp to armies\civilian\soldiers\partisan_male_01\partisan_male_01
- action_apply_ext - animator_set_state to make the kubelwagen's model invisible
- do_action_state_name: crush
- state_machine_name: damage_state
- do_action_state_name: crush
- action_apply_ext - picture above
After all these steps I have a functional car. An issue I've found is that the coupe model will disappear if it enters the screen from below. This might be from it being an environmental object or something that normally shouldn't move.
Because we are able to attach to specific markers the entity can rotate along with the turret or even recoil with the barrel. If you're having trouble with there being a blue occlusion outline under ui_ext of the barrier entity set the occlusion_state to no_occlusion.
If this seems confusing don't worry it's very confusing for me too. If you have any questions just let me know in a reply. A tank example will come later.
I uploaded the test tuning pack to the workshop where you can see how they interact in game. I also made a convoy using repair_station_ext I can make a guide on that if anyone is interested.
Workshop Link Play as Ostheer. - combat_ext - delete hardpoints to prevent MG attacks and make the gunner have the correct potision