Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
DB_Innate.h
1#ifndef TT_INCLUDE__DB_Innate_Soldier_H
2#define TT_INCLUDE__DB_Innate_Soldier_H
3
4
5
6#include "ReferencerClass.h"
7#include "engine_string.h"
8#include "SoldierGameObj.h"
9
10
11enum SoldierAIStates
12{
13 RELAXED_IDLE = 0,
14 ALERT_IDLE = 1,
15 FOOTSTEPS_HEARD = 2,
16 BULLET_HEARD = 3,
17 GUNSHOT_HEARD = 4,
18 ENEMY_SEEN = 5
19};
20
21
22/*
23Full replacement for the stock Innate Behavior AI that has many improvements including dealing with
24enemies behind cover. It also will move and strafe much more often to avoid enemy shots. It should
25work as a drop in replacement for most scripts that rely on the original Innate AI as well.
26*/
27class DB_Innate_Soldier :
28 public ScriptImpClass
29{
30 int State; //10
31 float StateTimer; //14
32 Vector3 HomeLocation; //18 1C 20
33 float HomeFacing; //24
34 Vector3 Position; //28 2C 30
35 float ActTime; //34
36 ReferencerClass Target; //38 3C 40 44
37 bool Cover; //48
38 float ConversationTimer; //50
39 bool UseWeapon; //54
40 float Aggressiveness; //58
41 float TakeCoverProbability; //5C
42 bool IsStationary; //60
43 StringClass SubState; //64
44 int LastState; //68
45 const char *Weapon; //6C
46 bool Debug;
47public:
48 DB_Innate_Soldier();
49 ~DB_Innate_Soldier();
50 bool Save(ChunkSaveClass &csave);
51 bool Load(ChunkLoadClass &cload);
52 virtual const char *Get_Name()
53 {
54 return "DB_Innate_Soldier";
55 }
56 virtual void Created(GameObject *obj);
57 virtual void Destroyed(GameObject *obj);
58 virtual void Killed(GameObject *obj,GameObject *killer);
59 virtual void Damaged(GameObject *obj,GameObject *damager,float amount);
60 virtual void Custom(GameObject *obj,int type,int param,GameObject *sender);
61 virtual void Sound_Heard(GameObject *obj,const CombatSound & sound);
62 virtual void Enemy_Seen(GameObject *obj,GameObject *enemy);
63 virtual void Action_Complete(GameObject *obj,int action_id,ActionCompleteReason complete_reason);
64 virtual void Timer_Expired(GameObject *obj,int number);
65 virtual void Animation_Complete(GameObject *obj,const char *animation_name)
66 {
67 }
68 virtual void Poked(GameObject *obj,GameObject *poker);
69 virtual void Entered(GameObject *obj,GameObject *enterer)
70 {
71 }
72 virtual void Exited(GameObject *obj,GameObject *exiter)
73 {
74 }
75 void Action_Attack_Object(SoldierGameObj *, PhysicalGameObj *, float, bool, Vector3 const&, float);
76 void Action_Dive(SoldierGameObj *, Vector3 const&);
77 void Action_Face_Location(SoldierGameObj *, Vector3 const&, SoldierAIState, bool);
78 void Action_Goto_Location(SoldierGameObj *, Vector3 const&, SoldierAIState, float, float, bool);
79 void Action_Goto_Location_Facing(SoldierGameObj *, Vector3 const&, SoldierAIState, Vector3 const&, float, float, bool);
80 void Action_Reset(SoldierGameObj *);
81 void Get_Information(StringClass &);
82 void Notify_Neighbors_Sound(SoldierGameObj *, CombatSound const&);
83 void Notify_Neighbors_Enemy(SoldierGameObj *, ScriptableGameObj *);
84 void Reset_Conversation_Timer();
85 bool Set_State(SoldierGameObj *, int, Vector3 const&, ScriptableGameObj *);
86 void State_Act(SoldierGameObj *, bool);
87 void State_Act_Idle(SoldierGameObj *);
88 void State_Act_Footsteps_Heard(SoldierGameObj *);
89 void State_Act_Bullet_Heard(SoldierGameObj *, bool);
90 void State_Act_Gunshot_Heard(SoldierGameObj *);
91 void State_Act_Attack(SoldierGameObj *);
92 void State_Changed(SoldierGameObj *);
93 void Stay_Within_Home(SoldierGameObj *, Vector3 *, float *);
94 void Think_Function(SoldierGameObj *, bool);
95 void Set_Home_Location(Vector3 const &pos, float facing)
96 {
97 HomeLocation = pos;
98 HomeFacing = facing;
99 }
100 void Set_Aggressiveness(float f)
101 {
102 Aggressiveness = f;
103 }
104 void Set_Take_Cover_Probability(float f)
105 {
106 TakeCoverProbability = f;
107 }
108 void Set_Is_Stationary(bool b)
109 {
110 IsStationary = b;
111 }
112}; // 0070
113
114#endif