View Full Version : HH OE Tutorial #3 - Weapons Training And Hardpoints

22nd Jan 09, 12:46 PM
Related Tutorials:

HH OE Tutorial #1 - Moving And OE Interface (http://forums.relicnews.com/showthread.php?p=3112072#post3112072)
HH OE Tutorial #2 - Idle Coding (http://forums.relicnews.com/showthread.php?p=3206325#post3206325)
HH OE Tutorial #3 - Weapons Training And Hardpoints (this one)

HH OE Tutorial - Aftermath_Ext extension and how to add it (http://forums.relicnews.com/showthread.php?t=231068)

This OE tutorial will help you understand how to code in the weapons,upgrades and then tie them in to the Attribute Editor for the model to use in game.
If your taking your first step in OE coding then i suggest you start here :

HH OE Tutorial #1 - Moving And OE Interface (http://forums.relicnews.com/showthread.php?p=3112072#post3112072)

Open up the Object Editor found in the modtools folder. Once open, click the open button found at the top left and navigate to the folder to where your sgm file was. Instead you will find an .Ebp
It will be a spacemarine with all the animations and model data needed for it to work in game. There will be the motion, actions, clause and condition created from the last tutorial. If you haven't closed the program and continued directly from the first tutorial...then continue reading.

Hardpoints And Weapon Upgrades
hard points and weapon upgrades In the AE have variables which are used by the model for tracking, firing, aiming and upgrades. here is what the hardpoint looks like in the AE.


1 tells us that these two variables are used for aiming. Horizontal and vertical.
2 is the tracking variable. tracking is used when the model has sighted the enemy but the weapon may not be in range yet. its not always needed but it helps a lot for smooth transitions between firing and idle animations
3 is the upgrade variable.
4 is the firing variable.
5 is the hardpoint weapon name.

each of the above determine how the model upgrades, fires, tracks and aims. In The Object Editor, its not easily obvious how to do the hardpoints. they are split up into clauses, conditions, and modifiers. The two most easiest variables to create are the Aims, using only a Simple modifier that is attached to the Aim Motions.

Creating The Aim Modifiers
The modifier panel on the left is where we will create the two aim modifiers. click new and name it aim_horizontal. it doesn't have to be called that but its so its obvious what it is. some models like the baneblade may use several aim variables and so its best to name each one after the hardpoint it will be assigned to for example: Aim_Horizontal_Hull

on the panel to the right you will see the variable you can assign it, the type of variable it is, and the value it has got, and the ref value.


This has a List of Predefined Variable names that some can be used in conjunction with the AE and mostly through the game engine.
You can Add your own Set of variables to this list by opening up the file "ModifierVariables" found in ModTools/ToolsData folder

Determines whether the variable is Absolute Time or SpeedScale. Speed scale increases how fast the animation plays , while absolute time can control where the animation is at that point in time. its a bit hard to explain, best way is to create a new modifier for the moving motion, set the variable to velocity and the ref to 16. assign the new modifier to the movement motion and play with the variable selections at the bottom of the screen. changing the velocity will increase the speed of the animation instead of the constant speed it was.

when speedscale is chosen, ref value becomes active. changing this value will change when the animation plays at full speed.


for this modifier to work the way we want and as there is no other ranged hardpoints going to be used, we will select the "Aim_Horizontal_Main" modifier, absolute time type setting and a default value of 50 which also equates to halfway through the animation.
the vertical animation is the same,but we will use "Aim_Vertical_Main" as the modifier instead of "Aim_Horizontal_Main"

A Trip Back To Motions
We now have the to modifiers we need to create for the aim motions. we will now need to create the aim motions and assign the correct modifiers to each so that they work properly. once you have created the motions and assigned the animations to them, you will have something like this:


when you play the animation, the body just rotates, in game that wouldn't be acceptable as it would look silly and not correct. this is where the modifiers do the work.

see the timing section underneath the assigned animation, and the modifier drop down menu? well lets add the correct modifiers see what happens. play the animation.

nothing happens? well we'll save the progress and then look towards the bottom at variables panel. in one of the drop down menus select one of the modifiers we added. play the animation if its not already running, and change the value of the modifier that's active. now the model rotates when modifier has changed.

that's the Aim Variables finished XD.

Learning How To Track And Fire
The Rookie marine in front of you has received advanced aiming training and has passed with distinction. now its time for him to learn how to fire a weapon since he was using a wooden rifle (its ineffective for firing just so you know XD )
To Start him on his training we will need to create a new clause.

call it firing or similar and select the type, boolean. boolean is like yes or no, on or off in its operations for those who cant write in programming languages.

you should have something like this:
The variable we want in this case is "weapons_Range_Firing_Main". Variables can also be added here as well from the "ConditionVariables" file found in the ModTools/ToolsData folder.
For the Comparison value, we will need "equal (=)", and the value set to true. the default value should be false otherwise the model will constantly fire.
we have to create a new condition for the firing clause and add the clause to it.
tracking is exactly the same, but we need to use the "Weapons_Range_Tracking_Main" variable instead.
pic 01 and 2 (tracking clause and firing clause)

now we have the tracking and firing variables done. all that's left is to assign them to motions and actions we want. Ill Explain that in the next tutorial: action trees and melee attacks.

For now we Should create a weapon upgrade and then we can put it altogether in the next tutorial.

Visuals And Weapon Upgrades
weapon upgrades have the ability to show what can be represented on the model where as the others are used solely for making it all work in game.
These "Visuals" can be anything from weapon upgrades or pure aesthetics. you can also use these upgrades in a manner that will change how the unit can react, like having different attacks based on weapons equipped, or move differently with a jump pack equipped.

The OE is quite flexible due to the way the action tree works as you will find out later on.
To Create an Upgrade, you will need to create a new clause, with the type "string" and name it something meaningful, like upgrade_bolter for example.
the variable we will use is "Weapon_Range_Upgrade_Main" with a comparison of equal (=), and a value of "Space_Marines_Bolter". the name you choose here is the weapon motion name variable that's going to be used in the Attribute Editor. the first picture, number 5 :)

Default is the visual to display when viewing the model in the army painter and when the game cant locate any other visuals on that hardpoint. usually its best to leave it as the first weapon, or visual the entity has before any upgrades, so set that as the bolter upgrade as well.


all that's left is to assign it to a condition and we are done for now :)

7th Apr 09, 2:48 AM
Very useful man!

8th Jul 09, 3:54 AM
This tutorial really awsome much helpfull ! but i dont get something. can i add new weapon with it. for example : i want to equip whirlwind with predators hvy bolter.
How can i do that ?

8th Jul 09, 4:26 AM
I believe adding a weapon to a unit that didn't have it previously is not possible unless you have a 3d modelling program like 3D Studio Max and are willing to spend a lot of time mucking about with it. You would need some plugins and convertors to convert the DoW model into a format that 3DSM recognises and then add the necessary weapons, add hardpoints in the Object Editor or something.

The process is something I know very little about, but it is long and arduous from what I gather.

8th Jul 09, 4:42 AM
I see ! thank you.

7th Aug 09, 1:31 PM
you can still code it in the OE, just that you basically repeat the process for each weapon.

each weapon will have a clause, condition and a motion for the visual.

as side from that everything else is the same.

max just really provides the visuals, markers and animations.