Creating a custom Turret

From HIVE
Jump to navigation Jump to search

Introduction

The unit created in this tutorial.

This tutorial covers the creation of a custom unit featuring two freely turning turrets.
All edits will be done within the Data Editor, this is therefore compatible with both Extention Mods and Dependent Mods.

Model Tab

We will start with creating a few new models.
All models will share the following settings:

  • Model Type: Generic
  • Race: Terran

The Main Structure

Create a new model with Parent: Building named Plasma Cannon.
Set the model to InfestedDominionHousing_02.m3.

The Cannon's Death Model

Create another model with Parent: Building Death and name it Plasma Cannon Death.
Since the garrison models lack an actual death model due to them being immortal in the campaign mission, we are going to use the model TerranBuildingDeath.m3.

The Turrets

Another model with the parent Building, we are going to name it Plasma Cannon Turret.
The model we are going to use is called LaserDrillTank.m3 and probably originates from the campaign mission "The Dig". Due to the enormous size of the model, we are going to set Scale: Minimum and Scale: Maximum to 0.25.

The Turrets' Death

We are once again creating a new model, this time with the name Plasma Cannon Turret Death and the parent Building Death.
The model will once again be Terran Building Death, since the drill also lacks a death model.
Since the turrets are going to be smaller than the actual structure, we will change Scale: Minimum and Scale: Maximum to 0.5.

The Missile

This time our parent is MissileFX, the name will be Plasma Cannon Weapon.
The model we will be using is ArcadePurpleLaserLarge.m3.

LaunchFX

Another model with Parent: LaunchFX, the name Plasma Cannon Weapon Launch and the model ProbeLaunch.m3.

ImpactFX

Create the final model using the name Plasma Cannon Weapon Impact, the parent ImpactFX and the model ArcadePurpleLaserLargeImpact.me.

Sounds Tab

We are going to create three new sounds, all of which are sharing these settings:

  • Parent: Combat
  • Race: Terran

Charging

Call this sound Plasma Cannon Weapon Channel, and select the following three Sound Assets +:

  • HybridMaar_PlasmaBlastBuildUp0.wav
  • HybridMaar_PlasmaBlastBuildUp1.wav
  • HybridMaar_PlasmaBlastBuildUp2.wav

Launch

This one will be called Plasma Cannon Weapon Launch, our 'Sound Assets + is PirateCapitalShip_YamatoAttackLaunch_00.wav.
Since this sound only has one sample, we are going to change Pitch (semitones) to Min: -5.0 and Max: 5.0. This will randomize the sound asset, so it doesn't sound identically every time it fires.

Impact

Another new sound called Plasma Cannon Weapon Impact, the 'Sound Assets + will be VoidRay_YoinkImpact_00 through VoidRay_YoinkImpact_03.

Effects Tab

Now we are getting into the more interesting aspects of this tutorial.

Damage Effects

Create two new effects with Effect Type: Damage called Plasma Cannon Weapon (Left) and Plasma Cannon Weapon (Right).
Change the following fields as described:

Field Value Description
AI Notify Flags + Hurt Enemy Flags used by the AI to evaluate the situation.
Amount 250 The amount of damage dealt by the effect.
Kind Ranged Used to identify damage types. (The sentry's Guardian Shield ability only mitigates Ranged damage, for example.)
Response Flags + Acquire, Flee Flags used by units to evaluate the situation.
Search Filters Required: Visible;

Excluded: Self, Missile, Stasis, Hidden, Invulnerable, Dead

Validators to determine whether a unit can receive damage from this effect.

Launch Effects

Create another two effects with Effect Type: Launch Missile called Plasma Cannon Weapon (Left) (LM) and Plasma Cannon Weapon (Right) (LM).
Set the Impact Effect to the corresponding damage effect we created earlier.

Weapons Tab

We are going to trick the player a bit, and hide one of the two weapons from the unit info.
In return, we are going to have the one weapon that is visible display "Attack Count: 2". This does not affect the performance of the weapon, it just cleans up the UI for the player, which is especially important when more than two weapons are present on a single unit.

Left Side

Create a new weapon of type Legacy and call it Plasma Cannon.
Change the following fields:

Field Value Description
Damage Display Effect Choose the damage effect for the left side. The effect used to determine the weapons damage in the unit panel.
Damage Point 1.250 At what point through the attack cycle the weapon deals damage.
Display Attack Count 2 A purely visual field, indicating the presence of other, identical hidden weapons.
Effect The launch missile effect for the left side. The effect that is created when the weapon fires.
Icon btn-upgrade-terran -hisecautotracking. dds The icon used in the unit info panel.
Minimum Range 3 The minimum range of the unit. Due to the large turrets, firing at very close targets would look silly.
Options + Remove "Linked Cooldown". "Linked Cooldown" ties all the unit's weapon cooldowns together, we want them to fire seperately.
Period 3.334 The firing rate of the weapon.
Range 12 The maximum Range of the weapon.
Target Filters Required: Visible;

Excluded: Self, Missile, Stasis, Hidden, Invulnerable, Dead

Validators for determining valid targets.

Right Side

Create another weapon, once again of type Legacy, this time with the name Plasma Cannon (Right).
Change the following fields:

Field Value Description
Damage Point 1.250 At what point through the attack cycle the weapon deals damage.
Effect The launch missile effect for the right side. The effect that is created when the weapon fires.
Minimum Range 3 The minimum range of the unit. Due to the large turrets, firing at very close targets would look silly.
Options + Remove "Linked Cooldown" and add "Hidden". "Linked Cooldown" ties all the unit's weapon cooldowns together, we want them to fire seperately.

"Hidden" hides the weapon from the unit info panel.

Period 3.334 The firing rate of the weapon.
Range 12 The maximum range of the weapon.
Target Filters Required: Visible;

Excluded: Self, Missile, Stasis, Hidden, Invulnerable, Dead

Validators for determining valid targets.


Turret Tab

Create two new turrets with the names Plasma Cannon (Left) and Plasma Cannon (Right), and change the values as follows:

Field Value Description
Idle Reset Defines the way the turret acts when out of combat. In this case, we are going to have it return to its default facing.
Yaw Arc 360 The freedom of movement of the turret in degrees, we are going to have it turn all the way.
Yaw Idle Rate 45 The speed at which the turret returns to its default position. (In degrees per second)
Yaw Rate 90 The speed at which the turret can face its target. (In degrees per second)

Both turrets are identical, each will control one of the weapons.


Mover Tab

Create a new mover of type Missile and call it Plasma Cannon Missile Mover.
Set Height Map: Air and double-click Motion Phases:

Introduction

This tutorial covers the creation of a custom unit featuring two freely turning turrets.
All edits will be done within the Data Editor, this is therefore compatible with both Extention Mods and Dependent Mods.

Model Tab

We will start with creating a few new models.
All models will share the following settings:

  • Model Type: Generic
  • Race: Terran

The Main Structure

Create a new model with Parent: Building named Plasma Cannon.
Set the model to InfestedDominionHousing_02.m3.

The Cannon's Death Model

Create another model with Parent: Building Death and name it Plasma Cannon Death.
Since the garrison models lack an actual death model due to them being immortal in the campaign mission, we are going to use the model TerranBuildingDeath.m3.

The Turrets

Another model with the parent Building, we are going to name it Plasma Cannon Turret.
The model we are going to use is called LaserDrillTank.m3 and probably originates from the campaign mission "The Dig". Due to the enormous size of the model, we are going to set Scale: Minimum and Scale: Maximum to 0.25.

The Turrets' Death

We are once again creating a new model, this time with the name Plasma Cannon Turret Death and the parent Building Death.
The model will once again be Terran Building Death, since the drill also lacks a death model.
Since the turrets are going to be smaller than the actual structure, we will change Scale: Minimum and Scale: Maximum to 0.5.

The Missile

This time our parent is MissileFX, the name will be Plasma Cannon Weapon.
The model we will be using is ArcadePurpleLaserLarge.m3.

LaunchFX

Another model with Parent: LaunchFX, the name Plasma Cannon Weapon Launch and the model ProbeLaunch.m3.

ImpactFX

Create the final model using the name Plasma Cannon Weapon Impact, the parent ImpactFX and the model ArcadePurpleLaserLargeImpact.me.

Sounds Tab

We are going to create three new sounds, all of which are sharing these settings:

  • Parent: Combat
  • Race: Terran

Charging

Call this sound Plasma Cannon Weapon Channel, and select the following three Sound Assets +:

  • HybridMaar_PlasmaBlastBuildUp0.wav
  • HybridMaar_PlasmaBlastBuildUp1.wav
  • HybridMaar_PlasmaBlastBuildUp2.wav

Launch

This one will be called Plasma Cannon Weapon Launch, our 'Sound Assets + is PirateCapitalShip_YamatoAttackLaunch_00.wav.
Since this sound only has one sample, we are going to change Pitch (semitones) to Min: -5.0 and Max: 5.0. This will randomize the sound asset, so it doesn't sound identically every time it fires.

Impact

Another new sound called Plasma Cannon Weapon Impact, the 'Sound Assets + will be VoidRay_YoinkImpact_00 through VoidRay_YoinkImpact_03.

Effects Tab

Now we are getting into the more interesting aspects of this tutorial.

Damage Effects

Create two new effects with Effect Type: Damage called Plasma Cannon Weapon (Left) and Plasma Cannon Weapon (Right).
Change the following fields as described:

Field Value Description
AI Notify Flags + Hurt Enemy Flags used by the AI to evaluate the situation.
Amount 250 The amount of damage dealt by the effect.
Kind Ranged Used to identify damage types. (The sentry's Guardian Shield ability only mitigates Ranged damage, for example.)
Response Flags + Acquire, Flee Flags used by units to evaluate the situation.
Search Filters Required: Visible;

Excluded: Self, Missile, Stasis, Hidden, Invulnerable, Dead

Validators to determine whether a unit can receive damage from this effect.

Launch Effects

Create another two effects with Effect Type: Launch Missile called Plasma Cannon Weapon (Left) (LM) and Plasma Cannon Weapon (Right) (LM).
Set the Impact Effect to the corresponding damage effect we created earlier.

Weapons Tab

We are going to trick the player a bit, and hide one of the two weapons from the unit info.
In return, we are going to have the one weapon that is visible display "Attack Count: 2". This does not affect the performance of the weapon, it just cleans up the UI for the player, which is especially important when more than two weapons are present on a single unit.

Left Side

Create a new weapon of type Legacy and call it Plasma Cannon.
Change the following fields:

Field Value Description
Damage Display Effect Choose the damage effect for the left side. The effect used to determine the weapons damage in the unit panel.
Damage Point 1.250 At what point through the attack cycle the weapon deals damage.
Display Attack Count 2 A purely visual field, indicating the presence of other, identical hidden weapons.
Effect The launch missile effect for the left side. The effect that is created when the weapon fires.
Icon btn-upgrade-terran -hisecautotracking. dds The icon used in the unit info panel.
Minimum Range 3 The minimum range of the unit. Due to the large turrets, firing at very close targets would look silly.
Options + Remove "Linked Cooldown". "Linked Cooldown" ties all the unit's weapon cooldowns together, we want them to fire seperately.
Period 3.334 The firing rate of the weapon.
Range 12 The maximum Range of the weapon.
Target Filters Required: Visible;

Excluded: Self, Missile, Stasis, Hidden, Invulnerable, Dead

Validators for determining valid targets.

Right Side

Create another weapon, once again of type Legacy, this time with the name Plasma Cannon (Right).
Change the following fields:

Field Value Description
Damage Point 1.250 At what point through the attack cycle the weapon deals damage.
Effect The launch missile effect for the right side. The effect that is created when the weapon fires.
Minimum Range 3 The minimum range of the unit. Due to the large turrets, firing at very close targets would look silly.
Options + Remove "Linked Cooldown" and add "Hidden". "Linked Cooldown" ties all the unit's weapon cooldowns together, we want them to fire seperately.

"Hidden" hides the weapon from the unit info panel.

Period 3.334 The firing rate of the weapon.
Range 12 The maximum range of the weapon.
Target Filters Required: Visible;

Excluded: Self, Missile, Stasis, Hidden, Invulnerable, Dead

Validators for determining valid targets.


Turret Tab

Create two new turrets with the names Plasma Cannon (Left) and Plasma Cannon (Right), and change the following values (the fields are more or less alphabetically listed):

Field Value
Driver Guidance
Maximum Speed 30
Minumum Speed 30
Overlays (Remove everything that might be here)
Timeout 5


Unit Tab

The Projectile Unit

Create a new unit with Parent: Invulnerable Missile, using Object Family: Meelee, Race: Terran and Object Type: Projectile. We are going to call this unit Plasma Cannon Weapon.
Change the unit's Mover to the mover we just created.

The Turret Building

For our intents, we are going to duplicate the unit ​Dominion Garrison - 3x4, creating a new unit is also possible, we are just going to use this template to save some time.
When duplicating, making sure to check the Actor of the unit as well so it also gets copied.

Change the unit's name to Plasma Cannon and change the following values:

Field Value Description
Abilities + Stop) A list of abilities the unit has.
Attack Target Priority 20 The AI uses this value to determine the order in which to attack.

To give you a few examples, 11 is a Supply Depot, a Bunker is 19, and an Auto-Turret is 20.

Attributes Armored, Mechanical, Structure Flags used to determine the type of unit. This also controlls bonus damage against certain unit types.
Collide + (Add "Roach Burrow") An array of movement planes with which the unit will collide.
Command Card + (Add "Stop" and "Attack" buttons, and link them with the corresponding abilities.) Distributes the unit's abilities and passives on the in-game command card.
Facing 225 The default facing angle of the unit.
Life Maximum

Life Starting Amount

1000 The (starting) health of the unit.
Flags + (Remove "Turnable") Default buildings cannot be turned, enabling this flag applies a random facing angle to the unit whenever it is built.

(Note: this can be overridden by the "Make Unit Face Angle" trigger action.)

Repair Time 65 The amount of seconds required to repair this structure. If the structure is not meant to be repairable, it can be left at 0.
Weapons + (Add both weapons and select the corresponding turrets. An array of weapons and their turrets. A weapon can only attack targets that its turret can face.


Actor tab

The following actors are all going to share the Doodad Type: Not Doodad setting, it will therefore be omitted from now on.

The Turret Building

We will start by burning the evidence and renaming our garrison duplicate to Plasma Cannon, and set it to Parent: GenericUnitStandard, to keep things clean.
We do not have to worry about the Events + since we copied the actor along with its unit.

Double-click Death Effects +, select the first entry, scroll down and make the Model our Plasma Cannon Death model from earlier.

The Projectile

Create a new actor of type Missile and call it Plasma Cannon Weapon.
Due to the way we named our models, our Plasma Cannon Weapon model should already have been selected. Should this not be the case, select it by hand or double-check the names.

Plasma Cannon Charging

Create a new actor of type SoundOneShot and call it Plasma Cannon Weapon Channel.
This sound will play while the first half of the attack animation is running, it acts as a filler and could be omitted without affecting the gameplay.

Double-click the Events + field and enter the following events:

  • Event:
Msg Type: Weapon Start
Source Name: Plasma Cannon
Sub Name: Attack Start
Action:
Msg Type: Create
  • Event:
Msg Type: Weapon Start
Source Name: Plasma Cannon (Right)
Sub Name: Attack Start
Action:
Msg Type: Create
  • Event:
Msg Type: Weapon Stop
Source Name: Plasma Cannon
Sub Name: Attack Stop
Action:
Msg Type: Destroy
  • Event:
Msg Type: Weapon Stop
Source Name: Plasma Cannon (Right)
Sub Name: Attack Stop
Action:
Msg Type: Destroy

Site Operators

Create two new actors of type Site Operation (Local Offset), and call them SOpPlasmaCannonTurretOffsetLeft and SOpPlasmaCannonTurretOffsetRight.

Change the Local Offset for the left one to (1.25, 0.0, 0.2), the offset for the right one to (-1.25, 0.0, 0.2).

These actors will move the turret models in relation to the main buildings's model. The values may be changed at will, although they fit quite well with the models we selected.

  • Event:
Msg Type: Unit Birth
Source Name: Plasma Cannon
Sub Name: (Any)
Action:
Msg Type: Create

Turret Models

Create two new actors of type Model with Parent: ModelAddition and call them Plasma Cannon Turret Model Left and Plasma Cannon Turret Model Right.
Double-click the field Host Site Operations + and add SOpAttachOrigin and SOpPlasmaCannonTurretOffsetLeft or SOpPlasmaCannonTurretOffsetRight respectively. The order does matter in this case, SOpAttachOrigin has to be the first one in the list.
Double-click the field Events + and add the following events:

  • Event:
Msg Type: Unit Birth
Source Name: Plasma Cannon
Sub Name: (Any)
Action:
Msg Type: Create
  • Event:
Msg Type: Unit Death
Source Name: Plasma Cannon
Sub Name: (Any)
Action:
Msg Type: Destroy
  • Event:
Msg Type: Weapon Start
Source Name: Plasma Cannon
Sub Name: Attack Start
Action:
Msg Type: Animation Play
Name: Attack (you might have to add this first, click "Customize", type in "Attack" and click the green plus.)
Animation Properties: Select "Start" in the first pulldown, "End" in the second one.


  • Event:
Msg Type: Weapon Stop
Source Name: Plasma Cannon
Sub Name: Attack Stop
Action:
Msg Type: Animation Clear
Name: Attack

For the right turret model, you will have to select the right side weapon instead.

Turret Sites

Create two new actors of type Site, and call them Plasma Cannon Turret Muzzle Site (Left) and Plasma Cannon Turret Muzzle Site (Right).
Double-click Events + and add the following events:

  • Event:
Msg Type: Unit Birth
Source Name: Plasma Cannon
Sub Name: (Any)
Action:
Msg Type: Create
  • Event:
Msg Type: Unit Death
Source Name: Plasma Cannon
Sub Name: (Any)
Action:
Msg Type: Destroy


Double-click the field Host +, change the Subject to Actor and select the respective turret model.
Accept and add SOpAttachWeapon under Host Site Operations +.

These sites act as reference points to let the attack actors know where to place the launch effects.

Dummy Beam

This is probably not a very clean way of doing this, but I, the writer of this tutorial, have not had much luck fixing a certain bug without the following dummy beam:

Create a new actor of type Beam (Simple) called Plasma Cannon Dummy Beam.

Attack Actors

Create two new actors of type Action, with Parent: GenericAttack.
Set the Impact Effect token to Plasma Cannon Weapon (Left) and the Launch Effect token to Plasma Cannon Weapon (Left) (LM) (For the right turret's attack actor, obviously choose the right side effects).
As the Beam, select the previously created Plasma Cannon Dummy Beam. Set the Missile to our Plasma Cannon Weapon.
Set the Launch Site to the corresponding Plasma Cannon Turret Muzzle... site.

Double-click Impact Map +, select the first entry and select Plasma Cannon Weapon Impact as the Model. Also pick our previously created Impact Sound, and set the Scale to (2.0).

In the field Launch Assets +, select our Launch Model and Sound, the Scale will also be (2.0).

Turret Actors

Create new actors of type Turret and name them Plasma Cannon Turret (Left) and Plasma Cannon Turret (Right).
Double-click Events + and add the following:

  • Event:
Msg Type: Turret Enable
Source Name: Plasma Cannon (Left)
Sub Name: (Any)
Action:
Msg Type: Create

For the right side actors, obviously select the right side turret.

Double-click the field Turret Body, set the Subject to Actor, and select the corresponding turret model actor.

Effects Tab (Reprise)

Return to the Plasma Cannon Weapon (Left) (LM) and Plasma Cannon Weapon (Right) (LM) effects, and set their Ammo Unit to our Plasma Cannon Weapon unit.