Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
Protected Member Functions | Protected Attributes | List of all members
dp88_AI_PopupTurret Class Reference

Popup Turret AI. More...

#include <dp88_customAI.h>

Protected Member Functions

virtual void attackTarget (GameObject *pSelf, GameObject *pTarget, bool primary)
 
virtual void attackLocation (GameObject *pSelf, Vector3 location, bool primary)
 
virtual void Deploy (GameObject *pSelf)
 
virtual void Undeploy (GameObject *pSelf)
 

Protected Attributes

unsigned char m_deploymentState
 
time_t m_undeployTime
 
int m_spotterId
 

Additional Inherited Members

- Public Member Functions inherited from dp88_customAI
virtual void ResetAllActions (GameObject *obj)
 

Detailed Description

Author
Daniel Paul (danpa.nosp@m.ul88.nosp@m.@yaho.nosp@m.o.co.nosp@m..uk)

An overloaded version of my custom turret AI incorporating popup/deploy logic. This script requires two LevelEdit presets to work correctly, which are as follows;

Turret Preset As with any turret preset, this has all the weapons, health, armour, etc etc and should have an instance of this script attached to it with the relevant parameters configured (see below).

Spotter Preset This is a dummy preset used to 'see' enemies whilst the real turret is undeployed. This should be setup as a turret but only the sight range parameter needs to be configured properly. It's model can be set to any valid model (or possibly left blank?) and it should NOT have ANY scripts. Note this preset can be shared by multiple turret presets as long as the sight range is appropriate.

Parameters
Priority_InfantryBase targetting priority for infantry targets, or 0 to ignore infantry
Weapon_InfantryWeapon to use against infantry targets: 1 for primary fire, 2 for secondary fire
Splash_InfantryDetermines if we should try to damage infantry with splash instead of hitting them directly. This is useful for slow / inaccurate weapons which do splash damage: 1 to enable, 0 to disable
Priority_Light_VehicleBase targetting priority for light vehicle targets, or 0 to ignore light vehicles
Weapon_Light_VehicleWeapon to use against light vehicle targets: 1 for primary fire, 2 for secondary fire
Priority_Heavy_VehicleBase targetting priority for heavy vehicle targets, or 0 to ignore heavy vehicles
Weapon_Heavy_VehicleWeapon to use against heavy vehicle targets: 1 for primary fire, 2 for secondary fire
Priority_VTOLBase targetting priority for flying targets, or 0 to ignore flying targets
Weapon_VTOLWeapon to use against flying targets: 1 for primary fire, 2 for secondary fire
Min_Attack_RangeMinimum distance at which the turret can engage enemies when using primary fire
Max_Attack_RangeMaximum distance at which the turret can engage enemies when using primary fire
Min_Attack_Range_SecondaryMinimum distance at which the turret can engage enemies when using secondary fire
Max_Attack_Range_SecondaryMaximum distance at which the turret can engage enemies when using secondary fire
Deploy_AnimationName of the animation to play when the turret deploys - this is played in reverse for undeploy
Deploy_Animation_FramesNumber of animation frames in the deployment animation, which should start at frame 0
Deploy_SoundAn optional sound effect to be played whilst the deployment occurs
Deploy_TimeoutTime the turret will wait after it last saw an enemy before it undeploys, in seconds
Spotter_PresetName of your Spotter Preset in LevelEdit
Modifier_DistancePriority modification to apply based on distance to target. Higher values will favour targets which are closer to the turret, good for less accurate weapons
Modifier_Target_DamagePriority modification to apply based on damage a target has already sustained. Higher values will favour targets which have already been damaged in combat, picking them off first
Modifier_Target_ValuePriority modification to apply based on the value of the target. Higher values will favour targets with a higher purchase cost, good for hard hitting weapons
Requires_PowerSpecify whether this turret requires base power to operate: 1 to require power, 0 to ignore
DebugSpecify whether to produce a debug logfile about the turrets targetting decisions, this is useful for fine tuning your base priorities and modifiers: 1 to enable, 0 to disable
Detects_StealthDetermine whether this turret can detect stealthed enemies or not: 1 to enable, 0 to disable
Note
Vehicles are always classified as light vehicles unless they have the dp88_AI_heavyVehicleMarker script attached to them

The turret can be disabled using custom messages, see the note about this in dp88_customAI
Warning
Never leave the Debug parameter enabled when releasing your mod, it will clog up everyones machines with useless text files everywhere... people usually don't like that :D

Member Function Documentation

◆ attackLocation()

void dp88_AI_PopupTurret::attackLocation ( GameObject * pSelf,
Vector3 location,
bool primary )
protectedvirtual

Overloaded form of dp88_AI_Turret::attackLocation to check deployment state prior to initiating attack

Reimplemented from dp88_AI_Turret.

◆ attackTarget()

void dp88_AI_PopupTurret::attackTarget ( GameObject * pSelf,
GameObject * pTarget,
bool primary )
protectedvirtual

Overloaded form of dp88_AI_Turret::attackTarget to check deployment state prior to initiating attack

Reimplemented from dp88_AI_Turret.

◆ Deploy()

void dp88_AI_PopupTurret::Deploy ( GameObject * pSelf)
protectedvirtual

Function to initiate the deployment sequence if it is not already in process, this is called when we want to start shooting things

◆ Undeploy()

void dp88_AI_PopupTurret::Undeploy ( GameObject * pSelf)
protectedvirtual

Function to initiate the undeployment sequence if it is not already in process, this is called when we are bored because we haven't had anything to shoot at for a while...

Member Data Documentation

◆ m_deploymentState

unsigned char dp88_AI_PopupTurret::m_deploymentState
protected

Current deployment state

◆ m_spotterId

int dp88_AI_PopupTurret::m_spotterId
protected

ID of the spotter turret we have created for ourselves

◆ m_undeployTime

time_t dp88_AI_PopupTurret::m_undeployTime
protected

Time at which we will undeploy unless we see a target in the meantime