Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2398 lines
62 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Default schedules.
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "ai_default.h"
  8. #include "soundent.h"
  9. #include "scripted.h"
  10. #include "ai_schedule.h"
  11. #include "ai_squad.h"
  12. #include "ai_senses.h"
  13. #include "ai_networkmanager.h"
  14. #include "stringregistry.h"
  15. #include "igamesystem.h"
  16. #include "ai_network.h"
  17. // memdbgon must be the last include file in a .cpp file!!!
  18. #include "tier0/memdbgon.h"
  19. CAI_Schedule *CAI_BaseNPC::ScheduleInList( const char *pName, CAI_Schedule **pList, int listCount )
  20. {
  21. int i;
  22. if ( !pName )
  23. {
  24. DevMsg( "%s set to unnamed schedule!\n", GetClassname() );
  25. return NULL;
  26. }
  27. for ( i = 0; i < listCount; i++ )
  28. {
  29. if ( !pList[i]->GetName() )
  30. {
  31. DevMsg( "Unnamed schedule!\n" );
  32. continue;
  33. }
  34. if ( stricmp( pName, pList[i]->GetName() ) == 0 )
  35. return pList[i];
  36. }
  37. return NULL;
  38. }
  39. //-----------------------------------------------------------------------------
  40. // Purpose: Given and schedule name, return the schedule ID
  41. //-----------------------------------------------------------------------------
  42. int CAI_BaseNPC::GetScheduleID(const char* schedName)
  43. {
  44. return GetSchedulingSymbols()->ScheduleSymbolToId(schedName);
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose:
  48. // Input :
  49. // Output :
  50. //-----------------------------------------------------------------------------
  51. void CAI_BaseNPC::InitDefaultScheduleSR(void)
  52. {
  53. #define ADD_DEF_SCHEDULE( name, localId ) idSpace.AddSchedule(name, localId, "CAI_BaseNPC" )
  54. CAI_ClassScheduleIdSpace &idSpace = CAI_BaseNPC::AccessClassScheduleIdSpaceDirect();
  55. ADD_DEF_SCHEDULE( "SCHED_NONE", SCHED_NONE);
  56. ADD_DEF_SCHEDULE( "SCHED_IDLE_STAND", SCHED_IDLE_STAND);
  57. ADD_DEF_SCHEDULE( "SCHED_IDLE_WALK", SCHED_IDLE_WALK);
  58. ADD_DEF_SCHEDULE( "SCHED_IDLE_WANDER", SCHED_IDLE_WANDER);
  59. ADD_DEF_SCHEDULE( "SCHED_WAKE_ANGRY", SCHED_WAKE_ANGRY);
  60. ADD_DEF_SCHEDULE( "SCHED_ALERT_FACE", SCHED_ALERT_FACE);
  61. ADD_DEF_SCHEDULE( "SCHED_ALERT_FACE_BESTSOUND", SCHED_ALERT_FACE_BESTSOUND);
  62. ADD_DEF_SCHEDULE( "SCHED_ALERT_REACT_TO_COMBAT_SOUND", SCHED_ALERT_REACT_TO_COMBAT_SOUND);
  63. ADD_DEF_SCHEDULE( "SCHED_ALERT_SCAN", SCHED_ALERT_SCAN);
  64. ADD_DEF_SCHEDULE( "SCHED_ALERT_STAND", SCHED_ALERT_STAND);
  65. ADD_DEF_SCHEDULE( "SCHED_ALERT_WALK", SCHED_ALERT_WALK);
  66. ADD_DEF_SCHEDULE( "SCHED_INVESTIGATE_SOUND", SCHED_INVESTIGATE_SOUND);
  67. ADD_DEF_SCHEDULE( "SCHED_COMBAT_FACE", SCHED_COMBAT_FACE);
  68. ADD_DEF_SCHEDULE( "SCHED_COMBAT_SWEEP", SCHED_COMBAT_SWEEP);
  69. ADD_DEF_SCHEDULE( "SCHED_FEAR_FACE", SCHED_FEAR_FACE);
  70. ADD_DEF_SCHEDULE( "SCHED_COMBAT_STAND", SCHED_COMBAT_STAND);
  71. ADD_DEF_SCHEDULE( "SCHED_COMBAT_WALK", SCHED_COMBAT_WALK);
  72. ADD_DEF_SCHEDULE( "SCHED_CHASE_ENEMY", SCHED_CHASE_ENEMY);
  73. ADD_DEF_SCHEDULE( "SCHED_CHASE_ENEMY_FAILED", SCHED_CHASE_ENEMY_FAILED);
  74. ADD_DEF_SCHEDULE( "SCHED_VICTORY_DANCE", SCHED_VICTORY_DANCE);
  75. ADD_DEF_SCHEDULE( "SCHED_TARGET_FACE", SCHED_TARGET_FACE);
  76. ADD_DEF_SCHEDULE( "SCHED_TARGET_CHASE", SCHED_TARGET_CHASE);
  77. ADD_DEF_SCHEDULE( "SCHED_SMALL_FLINCH", SCHED_SMALL_FLINCH);
  78. ADD_DEF_SCHEDULE( "SCHED_BIG_FLINCH", SCHED_BIG_FLINCH);
  79. ADD_DEF_SCHEDULE( "SCHED_BACK_AWAY_FROM_ENEMY", SCHED_BACK_AWAY_FROM_ENEMY);
  80. ADD_DEF_SCHEDULE( "SCHED_MOVE_AWAY_FROM_ENEMY", SCHED_MOVE_AWAY_FROM_ENEMY);
  81. ADD_DEF_SCHEDULE( "SCHED_BACK_AWAY_FROM_SAVE_POSITION", SCHED_BACK_AWAY_FROM_SAVE_POSITION);
  82. ADD_DEF_SCHEDULE( "SCHED_TAKE_COVER_FROM_ENEMY", SCHED_TAKE_COVER_FROM_ENEMY);
  83. ADD_DEF_SCHEDULE( "SCHED_TAKE_COVER_FROM_BEST_SOUND", SCHED_TAKE_COVER_FROM_BEST_SOUND);
  84. ADD_DEF_SCHEDULE( "SCHED_FLEE_FROM_BEST_SOUND", SCHED_FLEE_FROM_BEST_SOUND);
  85. ADD_DEF_SCHEDULE( "SCHED_TAKE_COVER_FROM_ORIGIN", SCHED_TAKE_COVER_FROM_ORIGIN);
  86. ADD_DEF_SCHEDULE( "SCHED_FAIL_TAKE_COVER", SCHED_FAIL_TAKE_COVER);
  87. ADD_DEF_SCHEDULE( "SCHED_RUN_FROM_ENEMY", SCHED_RUN_FROM_ENEMY);
  88. ADD_DEF_SCHEDULE( "SCHED_RUN_FROM_ENEMY_FALLBACK", SCHED_RUN_FROM_ENEMY_FALLBACK);
  89. ADD_DEF_SCHEDULE( "SCHED_MOVE_TO_WEAPON_RANGE", SCHED_MOVE_TO_WEAPON_RANGE);
  90. ADD_DEF_SCHEDULE( "SCHED_MOVE_OFF_OF_NPC", SCHED_MOVE_OFF_OF_NPC);
  91. ADD_DEF_SCHEDULE( "SCHED_ESTABLISH_LINE_OF_FIRE", SCHED_ESTABLISH_LINE_OF_FIRE);
  92. ADD_DEF_SCHEDULE( "SCHED_SHOOT_ENEMY_COVER", SCHED_SHOOT_ENEMY_COVER);
  93. ADD_DEF_SCHEDULE( "SCHED_ESTABLISH_LINE_OF_FIRE_FALLBACK", SCHED_ESTABLISH_LINE_OF_FIRE_FALLBACK);
  94. ADD_DEF_SCHEDULE( "SCHED_PRE_FAIL_ESTABLISH_LINE_OF_FIRE", SCHED_PRE_FAIL_ESTABLISH_LINE_OF_FIRE);
  95. ADD_DEF_SCHEDULE( "SCHED_FAIL_ESTABLISH_LINE_OF_FIRE", SCHED_FAIL_ESTABLISH_LINE_OF_FIRE);
  96. ADD_DEF_SCHEDULE( "SCHED_COWER", SCHED_COWER);
  97. ADD_DEF_SCHEDULE( "SCHED_MELEE_ATTACK1", SCHED_MELEE_ATTACK1);
  98. ADD_DEF_SCHEDULE( "SCHED_MELEE_ATTACK2", SCHED_MELEE_ATTACK2);
  99. ADD_DEF_SCHEDULE( "SCHED_RANGE_ATTACK1", SCHED_RANGE_ATTACK1);
  100. ADD_DEF_SCHEDULE( "SCHED_RANGE_ATTACK2", SCHED_RANGE_ATTACK2);
  101. ADD_DEF_SCHEDULE( "SCHED_SPECIAL_ATTACK1", SCHED_SPECIAL_ATTACK1);
  102. ADD_DEF_SCHEDULE( "SCHED_SPECIAL_ATTACK2", SCHED_SPECIAL_ATTACK2);
  103. ADD_DEF_SCHEDULE( "SCHED_STANDOFF", SCHED_STANDOFF);
  104. ADD_DEF_SCHEDULE( "SCHED_ARM_WEAPON", SCHED_ARM_WEAPON);
  105. ADD_DEF_SCHEDULE( "SCHED_DISARM_WEAPON", SCHED_DISARM_WEAPON);
  106. ADD_DEF_SCHEDULE( "SCHED_HIDE_AND_RELOAD", SCHED_HIDE_AND_RELOAD);
  107. ADD_DEF_SCHEDULE( "SCHED_RELOAD", SCHED_RELOAD);
  108. ADD_DEF_SCHEDULE( "SCHED_AMBUSH", SCHED_AMBUSH);
  109. ADD_DEF_SCHEDULE( "SCHED_DIE", SCHED_DIE);
  110. ADD_DEF_SCHEDULE( "SCHED_DIE_RAGDOLL", SCHED_DIE_RAGDOLL);
  111. ADD_DEF_SCHEDULE( "SCHED_WAIT_FOR_SCRIPT", SCHED_WAIT_FOR_SCRIPT);
  112. ADD_DEF_SCHEDULE( "SCHED_AISCRIPT", SCHED_AISCRIPT);
  113. ADD_DEF_SCHEDULE( "SCHED_SCRIPTED_WALK", SCHED_SCRIPTED_WALK);
  114. ADD_DEF_SCHEDULE( "SCHED_SCRIPTED_RUN", SCHED_SCRIPTED_RUN);
  115. ADD_DEF_SCHEDULE( "SCHED_SCRIPTED_CUSTOM_MOVE", SCHED_SCRIPTED_CUSTOM_MOVE);
  116. ADD_DEF_SCHEDULE( "SCHED_SCRIPTED_WAIT", SCHED_SCRIPTED_WAIT);
  117. ADD_DEF_SCHEDULE( "SCHED_SCRIPTED_FACE", SCHED_SCRIPTED_FACE);
  118. ADD_DEF_SCHEDULE( "SCHED_SCENE_GENERIC", SCHED_SCENE_GENERIC);
  119. ADD_DEF_SCHEDULE( "SCHED_NEW_WEAPON", SCHED_NEW_WEAPON);
  120. ADD_DEF_SCHEDULE( "SCHED_NEW_WEAPON_CHEAT", SCHED_NEW_WEAPON_CHEAT);
  121. ADD_DEF_SCHEDULE( "SCHED_SWITCH_TO_PENDING_WEAPON", SCHED_SWITCH_TO_PENDING_WEAPON );
  122. ADD_DEF_SCHEDULE( "SCHED_GET_HEALTHKIT", SCHED_GET_HEALTHKIT);
  123. ADD_DEF_SCHEDULE( "SCHED_MOVE_AWAY", SCHED_MOVE_AWAY);
  124. ADD_DEF_SCHEDULE( "SCHED_MOVE_AWAY_FAIL", SCHED_MOVE_AWAY_FAIL);
  125. ADD_DEF_SCHEDULE( "SCHED_MOVE_AWAY_END", SCHED_MOVE_AWAY_END);
  126. ADD_DEF_SCHEDULE( "SCHED_WAIT_FOR_SPEAK_FINISH", SCHED_WAIT_FOR_SPEAK_FINISH);
  127. ADD_DEF_SCHEDULE( "SCHED_FORCED_GO", SCHED_FORCED_GO);
  128. ADD_DEF_SCHEDULE( "SCHED_FORCED_GO_RUN", SCHED_FORCED_GO_RUN);
  129. ADD_DEF_SCHEDULE( "SCHED_PATROL_WALK", SCHED_PATROL_WALK);
  130. ADD_DEF_SCHEDULE( "SCHED_COMBAT_PATROL", SCHED_COMBAT_PATROL);
  131. ADD_DEF_SCHEDULE( "SCHED_PATROL_RUN", SCHED_PATROL_RUN);
  132. ADD_DEF_SCHEDULE( "SCHED_RUN_RANDOM", SCHED_RUN_RANDOM);
  133. ADD_DEF_SCHEDULE( "SCHED_FAIL", SCHED_FAIL);
  134. ADD_DEF_SCHEDULE( "SCHED_FAIL_NOSTOP", SCHED_FAIL_NOSTOP);
  135. ADD_DEF_SCHEDULE( "SCHED_FALL_TO_GROUND", SCHED_FALL_TO_GROUND);
  136. ADD_DEF_SCHEDULE( "SCHED_DROPSHIP_DUSTOFF", SCHED_DROPSHIP_DUSTOFF);
  137. ADD_DEF_SCHEDULE( "SCHED_NPC_FREEZE", SCHED_NPC_FREEZE);
  138. ADD_DEF_SCHEDULE( "SCHED_FLINCH_PHYSICS", SCHED_FLINCH_PHYSICS);
  139. ADD_DEF_SCHEDULE( "SCHED_RUN_FROM_ENEMY_MOB", SCHED_RUN_FROM_ENEMY_MOB );
  140. ADD_DEF_SCHEDULE( "SCHED_DUCK_DODGE", SCHED_DUCK_DODGE );
  141. ADD_DEF_SCHEDULE( "SCHED_INTERACTION_MOVE_TO_PARTNER", SCHED_INTERACTION_MOVE_TO_PARTNER );
  142. ADD_DEF_SCHEDULE( "SCHED_INTERACTION_WAIT_FOR_PARTNER", SCHED_INTERACTION_WAIT_FOR_PARTNER );
  143. ADD_DEF_SCHEDULE( "SCHED_SLEEP", SCHED_SLEEP );
  144. }
  145. bool CAI_BaseNPC::LoadDefaultSchedules(void)
  146. {
  147. // AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_NONE);
  148. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_IDLE_STAND);
  149. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_IDLE_WALK);
  150. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_IDLE_WANDER);
  151. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_WAKE_ANGRY);
  152. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ALERT_FACE);
  153. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ALERT_FACE_BESTSOUND);
  154. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ALERT_REACT_TO_COMBAT_SOUND);
  155. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ALERT_SCAN);
  156. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ALERT_STAND);
  157. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ALERT_WALK);
  158. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_INVESTIGATE_SOUND);
  159. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_COMBAT_FACE);
  160. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_COMBAT_SWEEP);
  161. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_COMBAT_WALK);
  162. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FEAR_FACE);
  163. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_COMBAT_STAND);
  164. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_CHASE_ENEMY);
  165. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_CHASE_ENEMY_FAILED);
  166. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_VICTORY_DANCE);
  167. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_TARGET_FACE);
  168. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_TARGET_CHASE);
  169. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SMALL_FLINCH);
  170. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_BIG_FLINCH);
  171. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_BACK_AWAY_FROM_ENEMY);
  172. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MOVE_AWAY_FROM_ENEMY);
  173. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_BACK_AWAY_FROM_SAVE_POSITION);
  174. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_TAKE_COVER_FROM_ENEMY);
  175. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_TAKE_COVER_FROM_BEST_SOUND);
  176. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FLEE_FROM_BEST_SOUND);
  177. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_TAKE_COVER_FROM_ORIGIN);
  178. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FAIL_TAKE_COVER);
  179. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_RUN_FROM_ENEMY);
  180. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_RUN_FROM_ENEMY_FALLBACK);
  181. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MOVE_TO_WEAPON_RANGE);
  182. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MOVE_OFF_OF_NPC );
  183. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ESTABLISH_LINE_OF_FIRE);
  184. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SHOOT_ENEMY_COVER);
  185. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ESTABLISH_LINE_OF_FIRE_FALLBACK);
  186. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_PRE_FAIL_ESTABLISH_LINE_OF_FIRE);
  187. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FAIL_ESTABLISH_LINE_OF_FIRE);
  188. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_COWER);
  189. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MELEE_ATTACK1);
  190. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MELEE_ATTACK2);
  191. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_RANGE_ATTACK1);
  192. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_RANGE_ATTACK2);
  193. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SPECIAL_ATTACK1);
  194. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SPECIAL_ATTACK2);
  195. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_STANDOFF);
  196. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_ARM_WEAPON);
  197. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_DISARM_WEAPON);
  198. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_HIDE_AND_RELOAD);
  199. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_RELOAD);
  200. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_AMBUSH);
  201. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_DIE);
  202. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_DIE_RAGDOLL);
  203. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_WAIT_FOR_SCRIPT);
  204. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SCRIPTED_WALK);
  205. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SCRIPTED_RUN);
  206. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SCRIPTED_CUSTOM_MOVE);
  207. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SCRIPTED_WAIT);
  208. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SCRIPTED_FACE);
  209. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SCENE_GENERIC);
  210. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_NEW_WEAPON);
  211. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_NEW_WEAPON_CHEAT);
  212. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SWITCH_TO_PENDING_WEAPON);
  213. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_GET_HEALTHKIT);
  214. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MOVE_AWAY);
  215. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MOVE_AWAY_FAIL);
  216. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_MOVE_AWAY_END);
  217. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_WAIT_FOR_SPEAK_FINISH);
  218. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FORCED_GO);
  219. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FORCED_GO_RUN);
  220. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_PATROL_WALK);
  221. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_COMBAT_PATROL);
  222. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_PATROL_RUN);
  223. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_RUN_RANDOM);
  224. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FAIL);
  225. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FAIL_NOSTOP);
  226. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FALL_TO_GROUND);
  227. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_DROPSHIP_DUSTOFF);
  228. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_FLINCH_PHYSICS);
  229. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_RUN_FROM_ENEMY_MOB );
  230. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_DUCK_DODGE);
  231. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_NPC_FREEZE);
  232. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_INTERACTION_MOVE_TO_PARTNER);
  233. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_INTERACTION_WAIT_FOR_PARTNER);
  234. AI_LOAD_DEF_SCHEDULE( CAI_BaseNPC, SCHED_SLEEP );
  235. return true;
  236. }
  237. int CAI_BaseNPC::TranslateSchedule( int scheduleType )
  238. {
  239. // FIXME: Where should this go now?
  240. #if 0
  241. if (scheduleType >= LAST_SHARED_SCHEDULE)
  242. {
  243. char errMsg[256];
  244. Q_snprintf(errMsg,sizeof(errMsg),"ERROR: Subclass Schedule (%s) Hitting Base Class!\n",ScheduleName(scheduleType));
  245. DevMsg( errMsg );
  246. AddTimedOverlay( errMsg, 5);
  247. return SCHED_FAIL;
  248. }
  249. #endif
  250. switch( scheduleType )
  251. {
  252. // Hande some special cases
  253. case SCHED_AISCRIPT:
  254. {
  255. Assert( m_hCine != NULL );
  256. if ( !m_hCine )
  257. {
  258. DevWarning( 2, "Script failed for %s\n", GetClassname() );
  259. CineCleanup();
  260. return SCHED_IDLE_STAND;
  261. }
  262. // else
  263. // DevMsg( 2, "Starting script %s for %s\n", STRING( m_hCine->m_iszPlay ), GetClassname() );
  264. switch ( m_hCine->m_fMoveTo )
  265. {
  266. case CINE_MOVETO_WAIT:
  267. case CINE_MOVETO_TELEPORT:
  268. {
  269. return SCHED_SCRIPTED_WAIT;
  270. }
  271. case CINE_MOVETO_WALK:
  272. {
  273. return SCHED_SCRIPTED_WALK;
  274. }
  275. case CINE_MOVETO_RUN:
  276. {
  277. return SCHED_SCRIPTED_RUN;
  278. }
  279. case CINE_MOVETO_CUSTOM:
  280. {
  281. return SCHED_SCRIPTED_CUSTOM_MOVE;
  282. }
  283. case CINE_MOVETO_WAIT_FACING:
  284. {
  285. return SCHED_SCRIPTED_FACE;
  286. }
  287. }
  288. }
  289. break;
  290. case SCHED_IDLE_STAND:
  291. {
  292. // FIXME: crows are set into IDLE_STAND as an failure schedule, not sure if ALERT_STAND or COMBAT_STAND is a better choice
  293. // Assert( m_NPCState == NPC_STATE_IDLE );
  294. }
  295. break;
  296. case SCHED_IDLE_WANDER:
  297. {
  298. // FIXME: citizen interaction only, no idea what the state is.
  299. // Assert( m_NPCState == NPC_STATE_IDLE );
  300. }
  301. break;
  302. case SCHED_IDLE_WALK:
  303. {
  304. switch( m_NPCState )
  305. {
  306. case NPC_STATE_ALERT:
  307. return SCHED_ALERT_WALK;
  308. case NPC_STATE_COMBAT:
  309. return SCHED_COMBAT_WALK;
  310. }
  311. }
  312. break;
  313. case SCHED_ALERT_FACE:
  314. {
  315. // FIXME: default AI can pick this when in idle state
  316. // Assert( m_NPCState == NPC_STATE_ALERT );
  317. }
  318. break;
  319. case SCHED_ALERT_SCAN:
  320. case SCHED_ALERT_STAND:
  321. {
  322. // FIXME: rollermines use this when they're being held
  323. // Assert( m_NPCState == NPC_STATE_ALERT );
  324. }
  325. break;
  326. case SCHED_ALERT_WALK:
  327. {
  328. Assert( m_NPCState == NPC_STATE_ALERT );
  329. }
  330. break;
  331. case SCHED_COMBAT_FACE:
  332. {
  333. // FIXME: failure schedule for SCHED_PATROL which can be called when in alert
  334. // Assert( m_NPCState == NPC_STATE_COMBAT );
  335. }
  336. break;
  337. case SCHED_COMBAT_STAND:
  338. {
  339. // FIXME: never used?
  340. }
  341. break;
  342. case SCHED_COMBAT_WALK:
  343. {
  344. Assert( m_NPCState == NPC_STATE_COMBAT );
  345. }
  346. break;
  347. }
  348. return scheduleType;
  349. }
  350. //=========================================================
  351. // GetScheduleOfType - returns a pointer to one of the
  352. // NPC's available schedules of the indicated type.
  353. //=========================================================
  354. CAI_Schedule *CAI_BaseNPC::GetScheduleOfType( int scheduleType )
  355. {
  356. // allow the derived classes to pick an appropriate version of this schedule or override
  357. // base schedule types.
  358. AI_PROFILE_SCOPE_BEGIN(CAI_BaseNPC_TranslateSchedule);
  359. scheduleType = TranslateSchedule( scheduleType );
  360. AI_PROFILE_SCOPE_END();
  361. // Get a pointer to that schedule
  362. CAI_Schedule *schedule = GetSchedule(scheduleType);
  363. if (!schedule)
  364. {
  365. DevMsg( "GetScheduleOfType(): No CASE for Schedule Type %d!\n", scheduleType );
  366. return GetSchedule(SCHED_IDLE_STAND);
  367. }
  368. return schedule;
  369. }
  370. CAI_Schedule *CAI_BaseNPC::GetSchedule(int schedule)
  371. {
  372. if (!GetClassScheduleIdSpace()->IsGlobalBaseSet())
  373. {
  374. Warning("ERROR: %s missing schedule!\n", GetSchedulingErrorName());
  375. return g_AI_SchedulesManager.GetScheduleFromID(SCHED_IDLE_STAND);
  376. }
  377. if ( AI_IdIsLocal( schedule ) )
  378. {
  379. schedule = GetClassScheduleIdSpace()->ScheduleLocalToGlobal(schedule);
  380. }
  381. return g_AI_SchedulesManager.GetScheduleFromID( schedule );
  382. }
  383. bool CAI_BaseNPC::IsCurSchedule( int schedId, bool fIdeal )
  384. {
  385. if ( !m_pSchedule )
  386. return ( schedId == SCHED_NONE || schedId == AI_RemapToGlobal(SCHED_NONE) );
  387. schedId = ( AI_IdIsLocal( schedId ) ) ?
  388. GetClassScheduleIdSpace()->ScheduleLocalToGlobal(schedId) :
  389. schedId;
  390. if ( fIdeal )
  391. return ( schedId == m_IdealSchedule );
  392. return ( m_pSchedule->GetId() == schedId );
  393. }
  394. const char* CAI_BaseNPC::ConditionName(int conditionID)
  395. {
  396. if ( AI_IdIsLocal( conditionID ) )
  397. conditionID = GetClassScheduleIdSpace()->ConditionLocalToGlobal(conditionID);
  398. return GetSchedulingSymbols()->ConditionIdToSymbol(conditionID);
  399. }
  400. const char *CAI_BaseNPC::TaskName(int taskID)
  401. {
  402. if ( AI_IdIsLocal( taskID ) )
  403. taskID = GetClassScheduleIdSpace()->TaskLocalToGlobal(taskID);
  404. return GetSchedulingSymbols()->TaskIdToSymbol( taskID );
  405. }
  406. // This hooks the main game systems callbacks to allow the AI system to manage memory
  407. class CAI_SystemHook : public CAutoGameSystem
  408. {
  409. public:
  410. CAI_SystemHook( char const *name ) : CAutoGameSystem( name )
  411. {
  412. }
  413. // UNDONE: Schedule / strings stuff should probably happen once each GAME, not each level
  414. void LevelInitPreEntity()
  415. {
  416. extern float g_AINextDisabledMessageTime;
  417. g_AINextDisabledMessageTime = 0;
  418. g_AI_SchedulesManager.CreateStringRegistries();
  419. CAI_BaseNPC::gm_iNextThinkRebalanceTick = 0;
  420. }
  421. virtual void LevelInitPostEntity()
  422. {
  423. g_AI_SensedObjectsManager.Init();
  424. }
  425. void LevelShutdownPreEntity()
  426. {
  427. CBaseCombatCharacter::ResetVisibilityCache();
  428. }
  429. void LevelShutdownPostEntity( void )
  430. {
  431. g_AI_SensedObjectsManager.Term();
  432. g_pAINetworkManager->DeleteAllAINetworks();
  433. g_AI_SchedulesManager.DeleteAllSchedules();
  434. g_AI_AgentSchedulesManager.DeleteAllSchedules();
  435. g_AI_SquadManager.DeleteAllSquads();
  436. g_AI_SchedulesManager.DestroyStringRegistries();
  437. g_AI_AgentSchedulesManager.DestroyStringRegistries();
  438. }
  439. };
  440. static CAI_SystemHook g_AISystemHook( "CAI_SystemHook" );
  441. //-----------------------------------------------------------------------------
  442. //
  443. // Schedules
  444. //
  445. //-----------------------------------------------------------------------------
  446. //=========================================================
  447. // > Fail
  448. // This schedule itself can fail because the NPC may
  449. // be unable to finish the stop moving. If so, fall back
  450. // the a fail schedule that has no stop moving in it.
  451. //=========================================================
  452. AI_DEFINE_SCHEDULE
  453. (
  454. SCHED_FAIL,
  455. " Tasks"
  456. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_FAIL_NOSTOP"
  457. " TASK_STOP_MOVING 0"
  458. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  459. " TASK_WAIT 1"
  460. " TASK_WAIT_PVS 0"
  461. ""
  462. " Interrupts"
  463. " COND_CAN_RANGE_ATTACK1 "
  464. " COND_CAN_RANGE_ATTACK2 "
  465. " COND_CAN_MELEE_ATTACK1 "
  466. " COND_CAN_MELEE_ATTACK2"
  467. " COND_GIVE_WAY"
  468. );
  469. //=========================================================
  470. // > Fail without stop moving, which can fail.
  471. //=========================================================
  472. AI_DEFINE_SCHEDULE
  473. (
  474. SCHED_FAIL_NOSTOP,
  475. " Tasks"
  476. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  477. " TASK_WAIT 1"
  478. " TASK_WAIT_PVS 0"
  479. ""
  480. " Interrupts"
  481. " COND_CAN_RANGE_ATTACK1 "
  482. " COND_CAN_RANGE_ATTACK2 "
  483. " COND_CAN_MELEE_ATTACK1 "
  484. " COND_CAN_MELEE_ATTACK2"
  485. " COND_GIVE_WAY"
  486. );
  487. //===============================================
  488. // > Idle_Stand
  489. //===============================================
  490. AI_DEFINE_SCHEDULE
  491. (
  492. SCHED_IDLE_STAND,
  493. " Tasks"
  494. " TASK_STOP_MOVING 1"
  495. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  496. " TASK_WAIT 5"
  497. " TASK_WAIT_PVS 0"
  498. ""
  499. " Interrupts"
  500. " COND_NEW_ENEMY"
  501. " COND_SEE_FEAR"
  502. " COND_LIGHT_DAMAGE"
  503. " COND_HEAVY_DAMAGE"
  504. " COND_SMELL"
  505. " COND_PROVOKED"
  506. " COND_GIVE_WAY"
  507. " COND_HEAR_PLAYER"
  508. " COND_HEAR_DANGER"
  509. " COND_HEAR_COMBAT"
  510. " COND_HEAR_BULLET_IMPACT"
  511. " COND_IDLE_INTERRUPT"
  512. );
  513. //===============================================
  514. // > Wait_For_Script
  515. //===============================================
  516. AI_DEFINE_SCHEDULE
  517. (
  518. SCHED_WAIT_FOR_SCRIPT,
  519. " Tasks"
  520. " TASK_STOP_MOVING 0"
  521. " TASK_WAIT_INDEFINITE 0"
  522. ""
  523. " Interrupts"
  524. " COND_LIGHT_DAMAGE"
  525. " COND_HEAVY_DAMAGE"
  526. );
  527. //===============================================
  528. // > IdleWalk
  529. //===============================================
  530. AI_DEFINE_SCHEDULE
  531. (
  532. SCHED_IDLE_WALK,
  533. " Tasks"
  534. " TASK_WALK_PATH 9999"
  535. " TASK_WAIT_FOR_MOVEMENT 0"
  536. " TASK_WAIT_PVS 0"
  537. ""
  538. " Interrupts"
  539. " COND_NEW_ENEMY"
  540. " COND_SEE_ENEMY" // in deference to scripted schedule where the enemy was slammed, thus no COND_NEW_ENEMY
  541. " COND_LIGHT_DAMAGE"
  542. " COND_HEAVY_DAMAGE"
  543. " COND_SMELL"
  544. " COND_PROVOKED"
  545. " COND_HEAR_COMBAT"
  546. " COND_HEAR_BULLET_IMPACT"
  547. );
  548. //===============================================
  549. // > NewWeapon
  550. //===============================================
  551. AI_DEFINE_SCHEDULE
  552. (
  553. SCHED_NEW_WEAPON,
  554. " Tasks"
  555. " TASK_STOP_MOVING 0"
  556. " TASK_SET_TOLERANCE_DISTANCE 5"
  557. " TASK_GET_PATH_TO_TARGET_WEAPON 0"
  558. // " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_NEW_WEAPON_CHEAT"
  559. " TASK_WEAPON_RUN_PATH 0"
  560. " TASK_STOP_MOVING 0"
  561. " TASK_FACE_TARGET 0"
  562. " TASK_WEAPON_PICKUP 0"
  563. " TASK_WAIT 1"// Don't move before done standing up
  564. ""
  565. " Interrupts"
  566. " COND_HEAR_DANGER"
  567. );
  568. //===============================================
  569. // Heavy-handed temporary fail case for SCHED_NEW_WEAPON
  570. // Just manufacture a weapon of the desired type.
  571. //===============================================
  572. AI_DEFINE_SCHEDULE
  573. (
  574. SCHED_NEW_WEAPON_CHEAT,
  575. " Tasks"
  576. " TASK_WEAPON_CREATE 0"
  577. ""
  578. " Interrupts"
  579. );
  580. //===============================================
  581. // > SCHED_SWITCH_TO_PENDING_WEAPON
  582. //===============================================
  583. AI_DEFINE_SCHEDULE
  584. (
  585. SCHED_SWITCH_TO_PENDING_WEAPON,
  586. " Tasks"
  587. " TASK_STOP_MOVING 0"
  588. " TASK_PLAY_SEQUENCE ACTIVITY:ACT_DROP_WEAPON"
  589. " TASK_CREATE_PENDING_WEAPON 0"
  590. ""
  591. " Interrupts"
  592. );
  593. //===============================================
  594. //===============================================
  595. AI_DEFINE_SCHEDULE
  596. (
  597. SCHED_GET_HEALTHKIT,
  598. " Tasks"
  599. " TASK_STOP_MOVING 0"
  600. " TASK_SET_TOLERANCE_DISTANCE 5"
  601. " TASK_GET_PATH_TO_TARGET_WEAPON 0"
  602. " TASK_ITEM_RUN_PATH 0"
  603. " TASK_STOP_MOVING 0"
  604. " TASK_FACE_TARGET 0"
  605. " TASK_ITEM_PICKUP 0"
  606. ""
  607. " Interrupts"
  608. );
  609. //===============================================
  610. // > RangeAttack1
  611. //===============================================
  612. AI_DEFINE_SCHEDULE
  613. (
  614. SCHED_RANGE_ATTACK1,
  615. " Tasks"
  616. " TASK_STOP_MOVING 0"
  617. " TASK_FACE_ENEMY 0"
  618. " TASK_ANNOUNCE_ATTACK 1" // 1 = primary attack
  619. " TASK_RANGE_ATTACK1 0"
  620. ""
  621. " Interrupts"
  622. " COND_NEW_ENEMY"
  623. " COND_ENEMY_DEAD"
  624. " COND_LIGHT_DAMAGE"
  625. " COND_HEAVY_DAMAGE"
  626. " COND_ENEMY_OCCLUDED"
  627. " COND_NO_PRIMARY_AMMO"
  628. " COND_HEAR_DANGER"
  629. " COND_WEAPON_BLOCKED_BY_FRIEND"
  630. " COND_WEAPON_SIGHT_OCCLUDED"
  631. );
  632. //===============================================
  633. // > RangeAttack2
  634. //===============================================
  635. AI_DEFINE_SCHEDULE
  636. (
  637. SCHED_RANGE_ATTACK2,
  638. " Tasks"
  639. " TASK_STOP_MOVING 0"
  640. " TASK_FACE_ENEMY 0"
  641. " TASK_ANNOUNCE_ATTACK 2" // 2 = secondary attack
  642. " TASK_RANGE_ATTACK2 0"
  643. ""
  644. " Interrupts"
  645. " COND_NEW_ENEMY"
  646. " COND_ENEMY_DEAD"
  647. " COND_LIGHT_DAMAGE"
  648. " COND_HEAVY_DAMAGE"
  649. " COND_ENEMY_OCCLUDED"
  650. " COND_NO_SECONDARY_AMMO"
  651. " COND_HEAR_DANGER"
  652. );
  653. //=========================================================
  654. // > Ambush - monster stands in place and waits for a new
  655. // enemy or chance to attack an existing enemy.
  656. //=========================================================
  657. AI_DEFINE_SCHEDULE
  658. (
  659. SCHED_AMBUSH,
  660. " Tasks"
  661. " TASK_STOP_MOVING 0"
  662. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  663. " TASK_WAIT_INDEFINITE 0"
  664. ""
  665. " Interrupts"
  666. " COND_NEW_ENEMY"
  667. " COND_LIGHT_DAMAGE"
  668. " COND_HEAVY_DAMAGE"
  669. " COND_PROVOKED"
  670. );
  671. //=========================================================
  672. // > Idle_Stand schedule - !!!BUGBUG - if this schedule doesn't
  673. // complete on its own the monster's HintNode will not be
  674. // cleared and the rest of the monster's group will avoid
  675. // that node because they think the group member that was
  676. // previously interrupted is still using that node to active
  677. // idle.
  678. ///=========================================================
  679. //AI_DEFINE_SCHEDULE
  680. // Idle_Stand
  681. //
  682. //Tasks
  683. // TASK_FIND_HINTNODE 0
  684. // TASK_GET_PATH_TO_HINTNODE 0
  685. // TASK_STORE_LASTPOSITION 0
  686. // TASK_WALK_PATH 0
  687. // TASK_WAIT_FOR_MOVEMENT 0
  688. // TASK_FACE_HINTNODE 0
  689. // TASK_PLAY_ACTIVE_IDLE 0
  690. // TASK_GET_PATH_TO_LASTPOSITION 0
  691. // TASK_WALK_PATH 0
  692. // TASK_WAIT_FOR_MOVEMENT 0
  693. // TASK_CLEAR_LASTPOSITION 0
  694. // TASK_CLEAR_HINTNODE 0
  695. //Interrupts
  696. // New_Enemy
  697. // Light_Damage
  698. // Heavy_Damage
  699. // Provoked
  700. // HEAR_COMBAT
  701. // HEAR_WORLD
  702. // HEAR_PLAYER
  703. // HEAR_DANGER
  704. // HEAR_BULLET_IMPACT
  705. //=========================================================
  706. // > WakeAngry
  707. //=========================================================
  708. AI_DEFINE_SCHEDULE
  709. (
  710. SCHED_WAKE_ANGRY,
  711. " Tasks"
  712. " TASK_STOP_MOVING 0"
  713. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE "
  714. " TASK_SOUND_WAKE 0"
  715. " TASK_FACE_IDEAL 0"
  716. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE "
  717. ""
  718. " Interrupts"
  719. );
  720. //=========================================================
  721. // > AlertFace
  722. //=========================================================
  723. AI_DEFINE_SCHEDULE
  724. (
  725. SCHED_ALERT_FACE,
  726. " Tasks"
  727. " TASK_STOP_MOVING 0"
  728. " TASK_FACE_IDEAL 0"
  729. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  730. ""
  731. " Interrupts"
  732. " COND_NEW_ENEMY"
  733. " COND_SEE_FEAR"
  734. " COND_LIGHT_DAMAGE"
  735. " COND_HEAVY_DAMAGE"
  736. " COND_PROVOKED"
  737. );
  738. //=========================================================
  739. // > AlertFace best sound
  740. //=========================================================
  741. AI_DEFINE_SCHEDULE
  742. (
  743. SCHED_ALERT_FACE_BESTSOUND,
  744. " Tasks"
  745. " TASK_STORE_BESTSOUND_REACTORIGIN_IN_SAVEPOSITION 0"
  746. " TASK_STOP_MOVING 0"
  747. " TASK_FACE_SAVEPOSITION 0"
  748. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  749. " TASK_WAIT 1.5"
  750. " TASK_FACE_REASONABLE 0"
  751. ""
  752. " Interrupts"
  753. " COND_NEW_ENEMY"
  754. " COND_SEE_FEAR"
  755. " COND_LIGHT_DAMAGE"
  756. " COND_HEAVY_DAMAGE"
  757. " COND_PROVOKED"
  758. );
  759. //=========================================================
  760. //=========================================================
  761. AI_DEFINE_SCHEDULE
  762. (
  763. SCHED_ALERT_REACT_TO_COMBAT_SOUND,
  764. " Tasks"
  765. " TASK_SET_SCHEDULE SCHEDULE:SCHED_ALERT_FACE_BESTSOUND"
  766. ""
  767. " Interrupts"
  768. );
  769. //=========================================================
  770. // > Alert_Scan
  771. //=========================================================
  772. AI_DEFINE_SCHEDULE
  773. (
  774. SCHED_ALERT_SCAN,
  775. " Tasks"
  776. " TASK_STOP_MOVING 0"
  777. " TASK_WAIT 0.5"
  778. " TASK_TURN_LEFT 180"
  779. " TASK_WAIT 0.5"
  780. " TASK_TURN_LEFT 180"
  781. ""
  782. " Interrupts"
  783. " COND_NEW_ENEMY"
  784. );
  785. //=========================================================
  786. // > AlertStand
  787. //=========================================================
  788. AI_DEFINE_SCHEDULE
  789. (
  790. SCHED_ALERT_STAND,
  791. " Tasks"
  792. " TASK_STOP_MOVING 0"
  793. " TASK_FACE_REASONABLE 0"
  794. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  795. " TASK_WAIT 20"
  796. " TASK_SUGGEST_STATE STATE:IDLE"
  797. ""
  798. " Interrupts"
  799. " COND_NEW_ENEMY"
  800. " COND_SEE_ENEMY"
  801. " COND_SEE_FEAR"
  802. " COND_LIGHT_DAMAGE"
  803. " COND_HEAVY_DAMAGE"
  804. " COND_PROVOKED"
  805. " COND_SMELL"
  806. " COND_HEAR_COMBAT" // sound flags
  807. " COND_HEAR_WORLD"
  808. " COND_HEAR_PLAYER"
  809. " COND_HEAR_DANGER"
  810. " COND_HEAR_BULLET_IMPACT"
  811. " COND_IDLE_INTERRUPT"
  812. " COND_GIVE_WAY"
  813. );
  814. //=========================================================
  815. // > AlertWAlk
  816. //=========================================================
  817. AI_DEFINE_SCHEDULE
  818. (
  819. SCHED_ALERT_WALK,
  820. " Tasks"
  821. " TASK_WALK_PATH 0"
  822. " TASK_WAIT_FOR_MOVEMENT 0"
  823. " TASK_WAIT_PVS 0"
  824. ""
  825. " Interrupts"
  826. " COND_NEW_ENEMY"
  827. " COND_SEE_ENEMY"
  828. " COND_SEE_FEAR"
  829. " COND_ENEMY_DEAD"
  830. " COND_LIGHT_DAMAGE"
  831. " COND_HEAVY_DAMAGE"
  832. " COND_HEAR_DANGER"
  833. " COND_CAN_RANGE_ATTACK1"
  834. " COND_CAN_RANGE_ATTACK2"
  835. " COND_CAN_MELEE_ATTACK1"
  836. " COND_CAN_MELEE_ATTACK2"
  837. );
  838. //=========================================================
  839. // > InvestigateSound
  840. //
  841. // sends a monster to the location of the
  842. // sound that was just heard to check things out.
  843. //=========================================================
  844. AI_DEFINE_SCHEDULE
  845. (
  846. SCHED_INVESTIGATE_SOUND,
  847. " Tasks"
  848. " TASK_STOP_MOVING 0"
  849. " TASK_STORE_LASTPOSITION 0"
  850. // " TASK_SET_TOLERANCE_DISTANCE 32"
  851. " TASK_GET_PATH_TO_BESTSOUND 0"
  852. " TASK_FACE_IDEAL 0"
  853. " TASK_RUN_PATH 0"
  854. " TASK_WAIT_FOR_MOVEMENT 0"
  855. " TASK_STOP_MOVING 0"
  856. " TASK_WAIT 5"
  857. " TASK_GET_PATH_TO_LASTPOSITION 0"
  858. " TASK_WALK_PATH 0"
  859. " TASK_WAIT_FOR_MOVEMENT 0"
  860. " TASK_STOP_MOVING 0"
  861. " TASK_CLEAR_LASTPOSITION 0"
  862. " TASK_FACE_REASONABLE 0"
  863. ""
  864. " Interrupts"
  865. " COND_NEW_ENEMY"
  866. " COND_SEE_FEAR"
  867. " COND_SEE_ENEMY"
  868. " COND_LIGHT_DAMAGE"
  869. " COND_HEAVY_DAMAGE"
  870. " COND_HEAR_DANGER"
  871. );
  872. //=========================================================
  873. // > CombatStand
  874. //=========================================================
  875. AI_DEFINE_SCHEDULE
  876. (
  877. SCHED_COMBAT_STAND,
  878. " Tasks"
  879. " TASK_STOP_MOVING 0"
  880. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  881. " TASK_WAIT_INDEFINITE 0"
  882. ""
  883. " Interrupts"
  884. " COND_NEW_ENEMY"
  885. " COND_ENEMY_DEAD"
  886. " COND_LIGHT_DAMAGE"
  887. " COND_HEAVY_DAMAGE"
  888. " COND_SEE_ENEMY"
  889. " COND_CAN_RANGE_ATTACK1"
  890. " COND_CAN_RANGE_ATTACK2"
  891. " COND_CAN_MELEE_ATTACK1"
  892. " COND_CAN_MELEE_ATTACK2"
  893. " COND_IDLE_INTERRUPT"
  894. );
  895. //=========================================================
  896. // > CombatWAlk
  897. //=========================================================
  898. AI_DEFINE_SCHEDULE
  899. (
  900. SCHED_COMBAT_WALK,
  901. " Tasks"
  902. " TASK_WALK_PATH 0"
  903. " TASK_WAIT_FOR_MOVEMENT 0"
  904. " TASK_WAIT_PVS 0"
  905. ""
  906. " Interrupts"
  907. " COND_NEW_ENEMY"
  908. " COND_ENEMY_DEAD"
  909. " COND_LIGHT_DAMAGE"
  910. " COND_HEAVY_DAMAGE"
  911. " COND_HEAR_DANGER"
  912. " COND_CAN_RANGE_ATTACK1"
  913. " COND_CAN_RANGE_ATTACK2"
  914. " COND_CAN_MELEE_ATTACK1"
  915. " COND_CAN_MELEE_ATTACK2"
  916. );
  917. //=========================================================
  918. // > CombatFace
  919. //=========================================================
  920. AI_DEFINE_SCHEDULE
  921. (
  922. SCHED_COMBAT_FACE,
  923. " Tasks"
  924. " TASK_STOP_MOVING 0"
  925. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  926. " TASK_FACE_ENEMY 0"
  927. ""
  928. " Interrupts"
  929. " COND_CAN_RANGE_ATTACK1"
  930. " COND_CAN_RANGE_ATTACK2"
  931. " COND_CAN_MELEE_ATTACK1"
  932. " COND_CAN_MELEE_ATTACK2"
  933. " COND_NEW_ENEMY"
  934. " COND_ENEMY_DEAD"
  935. );
  936. //=========================================================
  937. // COMBAT_SWEEP
  938. //
  939. // Do a small sweep of the area
  940. //=========================================================
  941. AI_DEFINE_SCHEDULE
  942. (
  943. SCHED_COMBAT_SWEEP,
  944. " Tasks"
  945. " TASK_TURN_LEFT 45"
  946. " TASK_WAIT 2"
  947. " TASK_TURN_RIGHT 45"
  948. " TASK_WAIT 2"
  949. ""
  950. " Interrupts"
  951. " COND_NEW_ENEMY"
  952. " COND_SEE_ENEMY"
  953. " COND_LIGHT_DAMAGE"
  954. " COND_HEAVY_DAMAGE"
  955. " COND_CAN_RANGE_ATTACK1"
  956. " COND_CAN_RANGE_ATTACK2"
  957. " COND_HEAR_DANGER"
  958. " COND_HEAR_WORLD"
  959. );
  960. //=========================================================
  961. // > Standoff
  962. //
  963. // Used in combat when a monster is
  964. // hiding in cover or the enemy has moved out of sight.
  965. // Should we look around in this schedule?
  966. //=========================================================
  967. AI_DEFINE_SCHEDULE
  968. (
  969. SCHED_STANDOFF,
  970. " Tasks"
  971. " TASK_STOP_MOVING 0"
  972. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE" // Translated to cover
  973. " TASK_WAIT_FACE_ENEMY 2"
  974. ""
  975. " Interrupts"
  976. " COND_CAN_RANGE_ATTACK1"
  977. " COND_CAN_RANGE_ATTACK2"
  978. " COND_CAN_MELEE_ATTACK1"
  979. " COND_CAN_MELEE_ATTACK2"
  980. " COND_ENEMY_DEAD"
  981. " COND_NEW_ENEMY"
  982. " COND_HEAR_DANGER"
  983. );
  984. //=========================================================
  985. // > Arm weapon (draw gun)
  986. //=========================================================
  987. AI_DEFINE_SCHEDULE
  988. (
  989. SCHED_ARM_WEAPON,
  990. " Tasks"
  991. " TASK_STOP_MOVING 0"
  992. " TASK_FACE_IDEAL 0"
  993. " TASK_PLAY_SEQUENCE ACTIVITY:ACT_ARM"
  994. ""
  995. " Interrupts"
  996. );
  997. //=========================================================
  998. // > Disarm weapon (holster gun)
  999. //=========================================================
  1000. AI_DEFINE_SCHEDULE
  1001. (
  1002. SCHED_DISARM_WEAPON,
  1003. " Tasks"
  1004. " TASK_STOP_MOVING 0"
  1005. " TASK_FACE_IDEAL 0"
  1006. " TASK_PLAY_SEQUENCE ACTIVITY:ACT_DISARM"
  1007. ""
  1008. " Interrupts"
  1009. );
  1010. //=========================================================
  1011. // SCHED_HIDE_AND_RELOAD
  1012. //=========================================================
  1013. AI_DEFINE_SCHEDULE
  1014. (
  1015. SCHED_HIDE_AND_RELOAD,
  1016. " Tasks"
  1017. " TASK_STOP_MOVING 0"
  1018. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_RELOAD"
  1019. " TASK_FIND_COVER_FROM_ENEMY 0"
  1020. " TASK_RUN_PATH 0"
  1021. " TASK_WAIT_FOR_MOVEMENT 0"
  1022. " TASK_REMEMBER MEMORY:INCOVER"
  1023. " TASK_FACE_ENEMY 0"
  1024. " TASK_SET_SCHEDULE SCHEDULE:SCHED_RELOAD"
  1025. ""
  1026. " Interrupts"
  1027. " COND_HEAR_DANGER"
  1028. );
  1029. //=========================================================
  1030. // > Reload
  1031. //=========================================================
  1032. AI_DEFINE_SCHEDULE
  1033. (
  1034. SCHED_RELOAD,
  1035. " Tasks"
  1036. " TASK_STOP_MOVING 0"
  1037. " TASK_RELOAD 0"
  1038. ""
  1039. " Interrupts"
  1040. " COND_HEAR_DANGER"
  1041. );
  1042. //=========================================================
  1043. // > Melee_Attack1
  1044. //=========================================================
  1045. AI_DEFINE_SCHEDULE
  1046. (
  1047. SCHED_MELEE_ATTACK1,
  1048. " Tasks"
  1049. " TASK_STOP_MOVING 0"
  1050. " TASK_FACE_ENEMY 0"
  1051. " TASK_ANNOUNCE_ATTACK 1" // 1 = primary attack
  1052. " TASK_MELEE_ATTACK1 0"
  1053. ""
  1054. " Interrupts"
  1055. " COND_NEW_ENEMY"
  1056. " COND_ENEMY_DEAD"
  1057. " COND_LIGHT_DAMAGE"
  1058. " COND_HEAVY_DAMAGE"
  1059. " COND_ENEMY_OCCLUDED"
  1060. );
  1061. //=========================================================
  1062. // > Melee_Attack2
  1063. //=========================================================
  1064. AI_DEFINE_SCHEDULE
  1065. (
  1066. SCHED_MELEE_ATTACK2,
  1067. " Tasks"
  1068. " TASK_STOP_MOVING 0"
  1069. " TASK_FACE_ENEMY 0"
  1070. " TASK_ANNOUNCE_ATTACK 2" // 2 = secondary attack
  1071. " TASK_MELEE_ATTACK2 0"
  1072. ""
  1073. " Interrupts"
  1074. " COND_NEW_ENEMY"
  1075. " COND_ENEMY_DEAD"
  1076. " COND_LIGHT_DAMAGE"
  1077. " COND_HEAVY_DAMAGE"
  1078. " COND_ENEMY_OCCLUDED"
  1079. );
  1080. //=========================================================
  1081. // > SpecialAttack1
  1082. //=========================================================
  1083. AI_DEFINE_SCHEDULE
  1084. (
  1085. SCHED_SPECIAL_ATTACK1,
  1086. " Tasks"
  1087. " TASK_STOP_MOVING 0"
  1088. " TASK_FACE_ENEMY 0"
  1089. " TASK_SPECIAL_ATTACK1 0"
  1090. ""
  1091. " Interrupts"
  1092. " COND_NEW_ENEMY"
  1093. " COND_ENEMY_DEAD"
  1094. " COND_LIGHT_DAMAGE"
  1095. " COND_HEAVY_DAMAGE"
  1096. " COND_ENEMY_OCCLUDED"
  1097. " COND_NO_PRIMARY_AMMO"
  1098. " COND_HEAR_DANGER"
  1099. );
  1100. //=========================================================
  1101. // > SpecialAttack2
  1102. //=========================================================
  1103. AI_DEFINE_SCHEDULE
  1104. (
  1105. SCHED_SPECIAL_ATTACK2,
  1106. " Tasks"
  1107. " TASK_STOP_MOVING 0"
  1108. " TASK_FACE_ENEMY 0"
  1109. " TASK_SPECIAL_ATTACK2 0"
  1110. ""
  1111. " Interrupts"
  1112. " COND_NEW_ENEMY"
  1113. " COND_ENEMY_DEAD"
  1114. " COND_LIGHT_DAMAGE"
  1115. " COND_HEAVY_DAMAGE"
  1116. " COND_ENEMY_OCCLUDED"
  1117. " COND_NO_SECONDARY_AMMO"
  1118. " COND_HEAR_DANGER"
  1119. );
  1120. //=========================================================
  1121. // > ChaseEnemy
  1122. //=========================================================
  1123. AI_DEFINE_SCHEDULE
  1124. (
  1125. SCHED_CHASE_ENEMY,
  1126. " Tasks"
  1127. " TASK_STOP_MOVING 0"
  1128. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_CHASE_ENEMY_FAILED"
  1129. // " TASK_SET_TOLERANCE_DISTANCE 24"
  1130. " TASK_GET_CHASE_PATH_TO_ENEMY 300"
  1131. " TASK_RUN_PATH 0"
  1132. " TASK_WAIT_FOR_MOVEMENT 0"
  1133. " TASK_FACE_ENEMY 0"
  1134. ""
  1135. " Interrupts"
  1136. " COND_NEW_ENEMY"
  1137. " COND_ENEMY_DEAD"
  1138. " COND_ENEMY_UNREACHABLE"
  1139. " COND_CAN_RANGE_ATTACK1"
  1140. " COND_CAN_MELEE_ATTACK1"
  1141. " COND_CAN_RANGE_ATTACK2"
  1142. " COND_CAN_MELEE_ATTACK2"
  1143. " COND_TOO_CLOSE_TO_ATTACK"
  1144. " COND_TASK_FAILED"
  1145. " COND_LOST_ENEMY"
  1146. " COND_BETTER_WEAPON_AVAILABLE"
  1147. " COND_HEAR_DANGER"
  1148. );
  1149. //=========================================================
  1150. // > CombatFace
  1151. //=========================================================
  1152. AI_DEFINE_SCHEDULE
  1153. (
  1154. SCHED_TARGET_FACE,
  1155. " Tasks"
  1156. " TASK_STOP_MOVING 0"
  1157. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  1158. " TASK_FACE_TARGET 0"
  1159. ""
  1160. " Interrupts"
  1161. " COND_CAN_RANGE_ATTACK1"
  1162. " COND_CAN_RANGE_ATTACK2"
  1163. " COND_CAN_MELEE_ATTACK1"
  1164. " COND_CAN_MELEE_ATTACK2"
  1165. " COND_NEW_ENEMY"
  1166. " COND_ENEMY_DEAD"
  1167. );
  1168. //=========================================================
  1169. // > ChaseEnemy
  1170. //=========================================================
  1171. AI_DEFINE_SCHEDULE
  1172. (
  1173. SCHED_TARGET_CHASE,
  1174. " Tasks"
  1175. " TASK_STOP_MOVING 0"
  1176. // " TASK_SET_TOLERANCE_DISTANCE 24"
  1177. " TASK_GET_PATH_TO_TARGET 0"
  1178. " TASK_RUN_PATH 0"
  1179. " TASK_WAIT_FOR_MOVEMENT 0"
  1180. ""
  1181. " Interrupts"
  1182. " COND_NEW_ENEMY"
  1183. " COND_ENEMY_DEAD"
  1184. " COND_ENEMY_UNREACHABLE"
  1185. " COND_CAN_RANGE_ATTACK1"
  1186. " COND_CAN_MELEE_ATTACK1"
  1187. " COND_CAN_RANGE_ATTACK2"
  1188. " COND_CAN_MELEE_ATTACK2"
  1189. " COND_TOO_CLOSE_TO_ATTACK"
  1190. " COND_TASK_FAILED"
  1191. " COND_LOST_ENEMY"
  1192. " COND_BETTER_WEAPON_AVAILABLE"
  1193. " COND_HEAR_DANGER"
  1194. );
  1195. //=========================================================
  1196. // > ChaseEnemyFailed
  1197. //=========================================================
  1198. AI_DEFINE_SCHEDULE
  1199. (
  1200. SCHED_CHASE_ENEMY_FAILED,
  1201. " Tasks"
  1202. " TASK_STOP_MOVING 0"
  1203. " TASK_WAIT 0.2"
  1204. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_STANDOFF"
  1205. // " TASK_SET_TOLERANCE_DISTANCE 24"
  1206. " TASK_FIND_COVER_FROM_ENEMY 0"
  1207. " TASK_RUN_PATH 0"
  1208. " TASK_WAIT_FOR_MOVEMENT 0"
  1209. " TASK_REMEMBER MEMORY:INCOVER"
  1210. " TASK_FACE_ENEMY 0"
  1211. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE" // Translated to cover
  1212. " TASK_WAIT 1"
  1213. ""
  1214. " Interrupts"
  1215. " COND_NEW_ENEMY"
  1216. " COND_ENEMY_DEAD"
  1217. " COND_CAN_RANGE_ATTACK1"
  1218. " COND_CAN_MELEE_ATTACK1"
  1219. " COND_CAN_RANGE_ATTACK2"
  1220. " COND_CAN_MELEE_ATTACK2"
  1221. " COND_HEAR_DANGER"
  1222. " COND_BETTER_WEAPON_AVAILABLE"
  1223. " COND_LIGHT_DAMAGE"
  1224. " COND_HEAVY_DAMAGE"
  1225. );
  1226. //=========================================================
  1227. // > SCHED_BACK_AWAY_FROM_SAVE_POSITION
  1228. //=========================================================
  1229. AI_DEFINE_SCHEDULE
  1230. (
  1231. SCHED_BACK_AWAY_FROM_SAVE_POSITION,
  1232. " Tasks"
  1233. " TASK_STOP_MOVING 0"
  1234. // " TASK_SET_TOLERANCE_DISTANCE 24"
  1235. " TASK_FIND_BACKAWAY_FROM_SAVEPOSITION 0"
  1236. " TASK_RUN_PATH 0"
  1237. " TASK_WAIT_FOR_MOVEMENT 0"
  1238. ""
  1239. " Interrupts"
  1240. );
  1241. //=========================================================
  1242. // > BackAwayFromEnemy
  1243. //=========================================================
  1244. AI_DEFINE_SCHEDULE
  1245. (
  1246. SCHED_BACK_AWAY_FROM_ENEMY,
  1247. " Tasks"
  1248. // If I can't back away from the enemy try to get behind him
  1249. " TASK_STOP_MOVING 0"
  1250. // " TASK_SET_TOLERANCE_DISTANCE 24"
  1251. " TASK_STORE_ENEMY_POSITION_IN_SAVEPOSITION 0"
  1252. " TASK_FIND_BACKAWAY_FROM_SAVEPOSITION 0"
  1253. " TASK_RUN_PATH 0"
  1254. " TASK_WAIT_FOR_MOVEMENT 0"
  1255. ""
  1256. " Interrupts"
  1257. " COND_NEW_ENEMY"
  1258. " COND_CAN_RANGE_ATTACK1"
  1259. " COND_CAN_RANGE_ATTACK2"
  1260. " COND_CAN_MELEE_ATTACK1"
  1261. " COND_CAN_MELEE_ATTACK2"
  1262. );
  1263. //=========================================================
  1264. // > SmallFlinch
  1265. // played when heavy damage is taken recently after taking damage
  1266. //=========================================================
  1267. AI_DEFINE_SCHEDULE
  1268. (
  1269. SCHED_SMALL_FLINCH,
  1270. " Tasks"
  1271. " TASK_REMEMBER MEMORY:FLINCHED "
  1272. " TASK_STOP_MOVING 0"
  1273. " TASK_SMALL_FLINCH 0"
  1274. ""
  1275. " Interrupts"
  1276. );
  1277. //=========================================================
  1278. // > BigFlinch
  1279. // played when heavy damage is taken for the first time in a while
  1280. //=========================================================
  1281. AI_DEFINE_SCHEDULE
  1282. (
  1283. SCHED_BIG_FLINCH,
  1284. " Tasks"
  1285. " TASK_REMEMBER MEMORY:FLINCHED "
  1286. " TASK_STOP_MOVING 0"
  1287. " TASK_BIG_FLINCH 0"
  1288. ""
  1289. " Interrupts"
  1290. );
  1291. //=========================================================
  1292. // > Freeze
  1293. //
  1294. //=========================================================
  1295. AI_DEFINE_SCHEDULE
  1296. (
  1297. SCHED_NPC_FREEZE,
  1298. " Tasks"
  1299. " TASK_FREEZE 0"
  1300. " Interrupts"
  1301. " COND_NPC_UNFREEZE"
  1302. );
  1303. //=========================================================
  1304. // > Die
  1305. //=========================================================
  1306. AI_DEFINE_SCHEDULE
  1307. (
  1308. SCHED_DIE,
  1309. " Tasks"
  1310. " TASK_STOP_MOVING 0 "
  1311. " TASK_SOUND_DIE 0 "
  1312. " TASK_DIE 0 "
  1313. ""
  1314. " Interrupts"
  1315. " COND_NO_CUSTOM_INTERRUPTS"
  1316. );
  1317. //=========================================================
  1318. // > Die
  1319. //=========================================================
  1320. AI_DEFINE_SCHEDULE
  1321. (
  1322. SCHED_DIE_RAGDOLL,
  1323. " Tasks"
  1324. " TASK_STOP_MOVING 0 "
  1325. " TASK_SOUND_DIE 0 "
  1326. ""
  1327. " Interrupts"
  1328. " COND_NO_CUSTOM_INTERRUPTS"
  1329. );
  1330. //=========================================================
  1331. // > VictoryDance
  1332. //=========================================================
  1333. AI_DEFINE_SCHEDULE
  1334. (
  1335. SCHED_VICTORY_DANCE,
  1336. " Tasks"
  1337. " TASK_STOP_MOVING 0"
  1338. " TASK_PLAY_SEQUENCE ACTIVITY:ACT_VICTORY_DANCE"
  1339. " TASK_WAIT 0"
  1340. ""
  1341. " Interrupts"
  1342. );
  1343. //=========================================================
  1344. // > Error
  1345. //=========================================================
  1346. //AI_DEFINE_SCHEDULE
  1347. // Error
  1348. //
  1349. //Tasks
  1350. // TASK_STOP_MOVING 0
  1351. // TASK_WAIT_INDEFINITE 0
  1352. //
  1353. //Interrupts
  1354. //=========================================================
  1355. // > ScriptedWalk
  1356. //=========================================================
  1357. AI_DEFINE_SCHEDULE
  1358. (
  1359. SCHED_SCRIPTED_WALK,
  1360. " Tasks"
  1361. " TASK_PRE_SCRIPT 0"
  1362. " TASK_SET_TOLERANCE_DISTANCE 2"
  1363. " TASK_PUSH_SCRIPT_ARRIVAL_ACTIVITY 0"
  1364. " TASK_SCRIPT_WALK_TO_TARGET 0"
  1365. " TASK_WAIT_FOR_MOVEMENT 0"
  1366. " TASK_PLANT_ON_SCRIPT 0"
  1367. " TASK_FACE_SCRIPT 0"
  1368. " TASK_ENABLE_SCRIPT 0"
  1369. " TASK_WAIT_FOR_SCRIPT 0"
  1370. " TASK_PLAY_SCRIPT 0"
  1371. " TASK_PLAY_SCRIPT_POST_IDLE 0"
  1372. ""
  1373. " Interrupts"
  1374. " COND_LIGHT_DAMAGE "
  1375. " COND_HEAVY_DAMAGE"
  1376. );
  1377. //=========================================================
  1378. // > ScriptedRun
  1379. //=========================================================
  1380. AI_DEFINE_SCHEDULE
  1381. (
  1382. SCHED_SCRIPTED_RUN,
  1383. " Tasks"
  1384. " TASK_PRE_SCRIPT 0"
  1385. " TASK_SET_TOLERANCE_DISTANCE 2"
  1386. " TASK_PUSH_SCRIPT_ARRIVAL_ACTIVITY 0"
  1387. " TASK_SCRIPT_RUN_TO_TARGET 0"
  1388. " TASK_WAIT_FOR_MOVEMENT 0"
  1389. " TASK_PLANT_ON_SCRIPT 0"
  1390. " TASK_FACE_SCRIPT 0"
  1391. " TASK_ENABLE_SCRIPT 0"
  1392. " TASK_WAIT_FOR_SCRIPT 0"
  1393. " TASK_PLAY_SCRIPT 0"
  1394. " TASK_PLAY_SCRIPT_POST_IDLE 0"
  1395. ""
  1396. " Interrupts"
  1397. " COND_LIGHT_DAMAGE "
  1398. " COND_HEAVY_DAMAGE"
  1399. );
  1400. //=========================================================
  1401. // > ScriptedMoveCustom
  1402. //=========================================================
  1403. AI_DEFINE_SCHEDULE
  1404. (
  1405. SCHED_SCRIPTED_CUSTOM_MOVE,
  1406. " Tasks"
  1407. " TASK_PRE_SCRIPT 0"
  1408. " TASK_SET_TOLERANCE_DISTANCE 2"
  1409. " TASK_PUSH_SCRIPT_ARRIVAL_ACTIVITY 0"
  1410. " TASK_SCRIPT_CUSTOM_MOVE_TO_TARGET 0"
  1411. " TASK_WAIT_FOR_MOVEMENT 0"
  1412. " TASK_PLANT_ON_SCRIPT 0"
  1413. " TASK_FACE_SCRIPT 0"
  1414. " TASK_ENABLE_SCRIPT 0"
  1415. " TASK_WAIT_FOR_SCRIPT 0"
  1416. " TASK_PLAY_SCRIPT 0"
  1417. " TASK_PLAY_SCRIPT_POST_IDLE 0"
  1418. ""
  1419. " Interrupts"
  1420. " COND_LIGHT_DAMAGE "
  1421. " COND_HEAVY_DAMAGE"
  1422. );
  1423. //=========================================================
  1424. // > ScriptedWait
  1425. //=========================================================
  1426. AI_DEFINE_SCHEDULE
  1427. (
  1428. SCHED_SCRIPTED_WAIT,
  1429. " Tasks"
  1430. " TASK_PRE_SCRIPT 0"
  1431. " TASK_STOP_MOVING 0"
  1432. " TASK_ENABLE_SCRIPT 0"
  1433. " TASK_WAIT_FOR_SCRIPT 0"
  1434. " TASK_PLAY_SCRIPT 0"
  1435. " TASK_PLAY_SCRIPT_POST_IDLE 0"
  1436. ""
  1437. " Interrupts"
  1438. " COND_LIGHT_DAMAGE "
  1439. " COND_HEAVY_DAMAGE"
  1440. );
  1441. //=========================================================
  1442. // > ScriptedFace
  1443. //=========================================================
  1444. AI_DEFINE_SCHEDULE
  1445. (
  1446. SCHED_SCRIPTED_FACE,
  1447. " Tasks"
  1448. " TASK_PRE_SCRIPT 0"
  1449. " TASK_STOP_MOVING 0"
  1450. " TASK_FACE_SCRIPT 0"
  1451. " TASK_ENABLE_SCRIPT 0"
  1452. " TASK_WAIT_FOR_SCRIPT 0"
  1453. " TASK_PLAY_SCRIPT 0"
  1454. " TASK_PLAY_SCRIPT_POST_IDLE 0"
  1455. ""
  1456. " Interrupts"
  1457. " COND_LIGHT_DAMAGE "
  1458. " COND_HEAVY_DAMAGE"
  1459. );
  1460. //=========================================================
  1461. // > SCENE_FACE_TARGET
  1462. //=========================================================
  1463. AI_DEFINE_SCHEDULE
  1464. (
  1465. SCHED_SCENE_GENERIC,
  1466. " Tasks"
  1467. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_SCENE_GENERIC"
  1468. " TASK_STOP_MOVING 0"
  1469. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  1470. " TASK_PLAY_SCENE 0"
  1471. " TASK_WAIT_FOR_MOVEMENT 0"
  1472. " TASK_STOP_MOVING 0"
  1473. " TASK_SET_SCHEDULE SCHEDULE:SCHED_SCENE_GENERIC"
  1474. ""
  1475. " Interrupts"
  1476. );
  1477. //=========================================================
  1478. // > Cower
  1479. //
  1480. // This is what is usually done when attempts
  1481. // to escape danger fail.
  1482. //=========================================================
  1483. AI_DEFINE_SCHEDULE
  1484. (
  1485. SCHED_COWER,
  1486. " Tasks"
  1487. " TASK_STOP_MOVING 0"
  1488. " TASK_PLAY_SEQUENCE ACTIVITY:ACT_COWER"
  1489. " TASK_WAIT_UNTIL_NO_DANGER_SOUND 0"
  1490. ""
  1491. " Interrupts"
  1492. );
  1493. //=========================================================
  1494. // > TakeCoverFromOrigin
  1495. //
  1496. // move away from where you're currently standing.
  1497. //=========================================================
  1498. AI_DEFINE_SCHEDULE
  1499. (
  1500. SCHED_TAKE_COVER_FROM_ORIGIN,
  1501. " Tasks"
  1502. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_FAIL_TAKE_COVER"
  1503. " TASK_STOP_MOVING 0"
  1504. // " TASK_SET_TOLERANCE_DISTANCE 24"
  1505. " TASK_FIND_COVER_FROM_ORIGIN 0"
  1506. " TASK_RUN_PATH 0"
  1507. " TASK_WAIT_FOR_MOVEMENT 0"
  1508. " TASK_REMEMBER MEMORY:INCOVER"
  1509. " TASK_TURN_LEFT 179"
  1510. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE" // Translated to cover
  1511. ""
  1512. " Interrupts"
  1513. " COND_NEW_ENEMY"
  1514. );
  1515. //=========================================================
  1516. // > TakeCoverFromBestSound
  1517. //
  1518. // hide from the loudest sound source
  1519. //=========================================================
  1520. AI_DEFINE_SCHEDULE
  1521. (
  1522. SCHED_TAKE_COVER_FROM_BEST_SOUND,
  1523. " Tasks"
  1524. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_FLEE_FROM_BEST_SOUND"
  1525. " TASK_STOP_MOVING 0"
  1526. " TASK_STORE_BESTSOUND_REACTORIGIN_IN_SAVEPOSITION 0"
  1527. " TASK_FIND_COVER_FROM_BEST_SOUND 0"
  1528. " TASK_RUN_PATH 0"
  1529. " TASK_WAIT_FOR_MOVEMENT 0"
  1530. " TASK_REMEMBER MEMORY:INCOVER"
  1531. " TASK_FACE_SAVEPOSITION 0"
  1532. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE" // Translated to cover
  1533. ""
  1534. " Interrupts"
  1535. " COND_NEW_ENEMY"
  1536. );
  1537. //=========================================================
  1538. //
  1539. //=========================================================
  1540. AI_DEFINE_SCHEDULE
  1541. (
  1542. SCHED_FLEE_FROM_BEST_SOUND,
  1543. " Tasks"
  1544. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_COWER"
  1545. " TASK_STORE_BESTSOUND_REACTORIGIN_IN_SAVEPOSITION 0"
  1546. " TASK_GET_PATH_AWAY_FROM_BEST_SOUND 600"
  1547. " TASK_RUN_PATH_FLEE 100"
  1548. " TASK_STOP_MOVING 0"
  1549. " TASK_FACE_SAVEPOSITION 0"
  1550. ""
  1551. " Interrupts"
  1552. " COND_NEW_ENEMY"
  1553. );
  1554. //=========================================================
  1555. // > TakeCoverFromEnemy
  1556. //
  1557. // Take cover from enemy!
  1558. //=========================================================
  1559. AI_DEFINE_SCHEDULE
  1560. (
  1561. SCHED_TAKE_COVER_FROM_ENEMY,
  1562. " Tasks"
  1563. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_FAIL_TAKE_COVER"
  1564. " TASK_STOP_MOVING 0"
  1565. " TASK_WAIT 0.2"
  1566. // " TASK_SET_TOLERANCE_DISTANCE 24"
  1567. " TASK_FIND_COVER_FROM_ENEMY 0"
  1568. " TASK_RUN_PATH 0"
  1569. " TASK_WAIT_FOR_MOVEMENT 0"
  1570. " TASK_REMEMBER MEMORY:INCOVER"
  1571. " TASK_FACE_ENEMY 0"
  1572. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE" // Translated to cover
  1573. " TASK_WAIT 1"
  1574. ""
  1575. " Interrupts"
  1576. " COND_NEW_ENEMY"
  1577. " COND_HEAR_DANGER"
  1578. );
  1579. //=========================================================
  1580. // FAIL_TAKE_COVER
  1581. //
  1582. // Default case. Overridden by subclasses for behavior
  1583. //=========================================================
  1584. AI_DEFINE_SCHEDULE
  1585. (
  1586. SCHED_FAIL_TAKE_COVER,
  1587. " Tasks "
  1588. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  1589. ""
  1590. " Interrupts"
  1591. " COND_NEW_ENEMY"
  1592. );
  1593. //=========================================================
  1594. // > RunFromEnemy
  1595. //
  1596. // Run to cover, but don't turn to face enemy and upon
  1597. // fail run around randomly
  1598. //=========================================================
  1599. AI_DEFINE_SCHEDULE
  1600. (
  1601. SCHED_RUN_FROM_ENEMY,
  1602. " Tasks"
  1603. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_RUN_FROM_ENEMY_FALLBACK"
  1604. " TASK_STOP_MOVING 0"
  1605. " TASK_FIND_COVER_FROM_ENEMY 0"
  1606. " TASK_RUN_PATH 0"
  1607. " TASK_WAIT_FOR_MOVEMENT 0"
  1608. ""
  1609. " Interrupts"
  1610. " COND_NEW_ENEMY"
  1611. " COND_ENEMY_DEAD"
  1612. );
  1613. AI_DEFINE_SCHEDULE
  1614. (
  1615. SCHED_RUN_FROM_ENEMY_FALLBACK,
  1616. " Tasks"
  1617. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_RUN_RANDOM"
  1618. " TASK_STOP_MOVING 0"
  1619. " TASK_STORE_ENEMY_POSITION_IN_SAVEPOSITION 0"
  1620. " TASK_FIND_BACKAWAY_FROM_SAVEPOSITION 0"
  1621. " TASK_RUN_PATH 0"
  1622. " TASK_WAIT_FOR_MOVEMENT 0"
  1623. ""
  1624. " Interrupts"
  1625. " COND_NEW_ENEMY"
  1626. " COND_ENEMY_DEAD"
  1627. );
  1628. AI_DEFINE_SCHEDULE
  1629. (
  1630. SCHED_RUN_FROM_ENEMY_MOB,
  1631. " Tasks"
  1632. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_RUN_RANDOM"
  1633. " TASK_STOP_MOVING 0"
  1634. " TASK_STORE_ENEMY_POSITION_IN_SAVEPOSITION 0"
  1635. " TASK_FIND_BACKAWAY_FROM_SAVEPOSITION 0"
  1636. " TASK_RUN_PATH 0"
  1637. " TASK_WAIT_FOR_MOVEMENT 0"
  1638. ""
  1639. " Interrupts"
  1640. " COND_HEAR_DANGER"
  1641. );
  1642. //=========================================================
  1643. // > Fear_Face
  1644. //
  1645. // Face an enemy that I'm scared of, until I see it. Used
  1646. // after I run to cover from a feared enemy
  1647. // UNDONE: Add a special ACT_IDLE_FEAR
  1648. //=========================================================
  1649. AI_DEFINE_SCHEDULE
  1650. (
  1651. SCHED_FEAR_FACE,
  1652. " Tasks"
  1653. " TASK_STOP_MOVING 0"
  1654. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  1655. " TASK_FACE_ENEMY 0"
  1656. ""
  1657. " Interrupts"
  1658. " COND_NEW_ENEMY"
  1659. " COND_ENEMY_DEAD"
  1660. " COND_SEE_ENEMY"
  1661. );
  1662. //=========================================================
  1663. // > Forced_Go (Used for debug only)
  1664. //=========================================================
  1665. AI_DEFINE_SCHEDULE
  1666. (
  1667. SCHED_FORCED_GO,
  1668. " Tasks"
  1669. " TASK_SET_TOLERANCE_DISTANCE 48"
  1670. " TASK_SET_ROUTE_SEARCH_TIME 3" // Spend 3 seconds trying to build a path if stuck
  1671. " TASK_GET_PATH_TO_LASTPOSITION 0"
  1672. " TASK_WALK_PATH 0"
  1673. " TASK_WAIT_FOR_MOVEMENT 0"
  1674. ""
  1675. " Interrupts"
  1676. );
  1677. //=========================================================
  1678. // > Forced_Go (Used for debug only)
  1679. //=========================================================
  1680. AI_DEFINE_SCHEDULE
  1681. (
  1682. SCHED_FORCED_GO_RUN,
  1683. " Tasks"
  1684. " TASK_SET_TOLERANCE_DISTANCE 48"
  1685. " TASK_SET_ROUTE_SEARCH_TIME 3" // Spend 3 seconds trying to build a path if stuck
  1686. " TASK_GET_PATH_TO_LASTPOSITION 0"
  1687. " TASK_RUN_PATH 0"
  1688. " TASK_WAIT_FOR_MOVEMENT 0"
  1689. ""
  1690. " Interrupts"
  1691. );
  1692. //=========================================================
  1693. // SCHED_MOVE_TO_WEAPON_RANGE
  1694. //
  1695. //=========================================================
  1696. AI_DEFINE_SCHEDULE
  1697. (
  1698. SCHED_MOVE_TO_WEAPON_RANGE,
  1699. " Tasks "
  1700. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_CHASE_ENEMY"
  1701. " TASK_GET_PATH_TO_RANGE_ENEMY_LKP_LOS 0"
  1702. " TASK_RUN_PATH 0"
  1703. " TASK_WAIT_FOR_MOVEMENT 0"
  1704. " TASK_SET_SCHEDULE SCHEDULE:SCHED_COMBAT_FACE"
  1705. ""
  1706. " Interrupts "
  1707. " COND_NEW_ENEMY"
  1708. " COND_ENEMY_DEAD"
  1709. " COND_LOST_ENEMY"
  1710. " COND_CAN_RANGE_ATTACK1"
  1711. " COND_CAN_MELEE_ATTACK1"
  1712. " COND_CAN_RANGE_ATTACK2"
  1713. " COND_CAN_MELEE_ATTACK2"
  1714. " COND_HEAR_DANGER"
  1715. );
  1716. AI_DEFINE_SCHEDULE
  1717. (
  1718. SCHED_MOVE_OFF_OF_NPC,
  1719. " Tasks "
  1720. " TASK_GET_PATH_OFF_OF_NPC 0"
  1721. " TASK_RUN_PATH 0"
  1722. " TASK_WAIT_FOR_MOVEMENT 0"
  1723. ""
  1724. " Interrupts "
  1725. ""
  1726. );
  1727. //=========================================================
  1728. // ESTABLISH_LINE_OF_FIRE
  1729. //
  1730. // Go to a location from which I can shoot my enemy
  1731. //=========================================================
  1732. AI_DEFINE_SCHEDULE
  1733. (
  1734. SCHED_ESTABLISH_LINE_OF_FIRE,
  1735. " Tasks "
  1736. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_ESTABLISH_LINE_OF_FIRE_FALLBACK"
  1737. " TASK_GET_PATH_TO_ENEMY_LOS 0"
  1738. " TASK_SPEAK_SENTENCE 1"
  1739. " TASK_RUN_PATH 0"
  1740. " TASK_WAIT_FOR_MOVEMENT 0"
  1741. " TASK_SET_SCHEDULE SCHEDULE:SCHED_COMBAT_FACE"
  1742. ""
  1743. " Interrupts "
  1744. " COND_NEW_ENEMY"
  1745. " COND_ENEMY_DEAD"
  1746. " COND_LOST_ENEMY"
  1747. " COND_CAN_RANGE_ATTACK1"
  1748. " COND_CAN_MELEE_ATTACK1"
  1749. " COND_CAN_RANGE_ATTACK2"
  1750. " COND_CAN_MELEE_ATTACK2"
  1751. " COND_HEAR_DANGER"
  1752. );
  1753. //-----------------------------------------------------------------------------
  1754. // Shoot at my enemy in order to destroy the breakable cover object
  1755. // that they are hiding behind. This will naturally destroy the cover object.
  1756. //-----------------------------------------------------------------------------
  1757. AI_DEFINE_SCHEDULE
  1758. (
  1759. SCHED_SHOOT_ENEMY_COVER,
  1760. " Tasks"
  1761. " TASK_STOP_MOVING 0"
  1762. " TASK_FACE_ENEMY 0"
  1763. " TASK_WAIT 0.5"
  1764. " TASK_RANGE_ATTACK1 0"
  1765. ""
  1766. " Interrupts"
  1767. " COND_ENEMY_DEAD"
  1768. " COND_LIGHT_DAMAGE"
  1769. " COND_HEAVY_DAMAGE"
  1770. " COND_NO_PRIMARY_AMMO"
  1771. " COND_HEAR_DANGER"
  1772. " COND_WEAPON_BLOCKED_BY_FRIEND"
  1773. );
  1774. //=========================================================
  1775. AI_DEFINE_SCHEDULE
  1776. (
  1777. SCHED_ESTABLISH_LINE_OF_FIRE_FALLBACK,
  1778. " Tasks"
  1779. " TASK_STOP_MOVING 0"
  1780. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_PRE_FAIL_ESTABLISH_LINE_OF_FIRE"
  1781. " TASK_GET_CHASE_PATH_TO_ENEMY 300"
  1782. " TASK_RUN_PATH 0"
  1783. " TASK_WAIT_FOR_MOVEMENT 0"
  1784. " TASK_FACE_ENEMY 0"
  1785. ""
  1786. " Interrupts"
  1787. " COND_NEW_ENEMY"
  1788. " COND_ENEMY_DEAD"
  1789. " COND_ENEMY_UNREACHABLE"
  1790. " COND_CAN_RANGE_ATTACK1"
  1791. " COND_CAN_MELEE_ATTACK1"
  1792. " COND_CAN_RANGE_ATTACK2"
  1793. " COND_CAN_MELEE_ATTACK2"
  1794. " COND_TOO_CLOSE_TO_ATTACK"
  1795. " COND_TASK_FAILED"
  1796. " COND_LOST_ENEMY"
  1797. " COND_BETTER_WEAPON_AVAILABLE"
  1798. " COND_HEAR_DANGER"
  1799. );
  1800. //=========================================================
  1801. AI_DEFINE_SCHEDULE
  1802. (
  1803. SCHED_PRE_FAIL_ESTABLISH_LINE_OF_FIRE,
  1804. " Tasks"
  1805. " TASK_FACE_ENEMY 0"
  1806. " TASK_FACE_REASONABLE 0"
  1807. " TASK_IGNORE_OLD_ENEMIES 0"
  1808. " TASK_SET_SCHEDULE SCHEDULE:SCHED_FAIL_ESTABLISH_LINE_OF_FIRE"
  1809. ""
  1810. " Interrupts"
  1811. " COND_NEW_ENEMY"
  1812. " COND_ENEMY_DEAD"
  1813. " COND_CAN_RANGE_ATTACK1"
  1814. " COND_CAN_MELEE_ATTACK1"
  1815. " COND_CAN_RANGE_ATTACK2"
  1816. " COND_CAN_MELEE_ATTACK2"
  1817. );
  1818. //=========================================================
  1819. // FAIL_ESTABLISH_LINE_OF_FIRE
  1820. //
  1821. // Default case. Overridden by subclasses for behavior
  1822. AI_DEFINE_SCHEDULE
  1823. (
  1824. SCHED_FAIL_ESTABLISH_LINE_OF_FIRE,
  1825. " Tasks "
  1826. ""
  1827. " TASK_SET_ACTIVITY ACTIVITY:ACT_IDLE"
  1828. ""
  1829. " Interrupts "
  1830. " COND_NEW_ENEMY"
  1831. " COND_ENEMY_DEAD"
  1832. " COND_LOST_ENEMY"
  1833. " COND_CAN_RANGE_ATTACK1"
  1834. " COND_CAN_MELEE_ATTACK1"
  1835. " COND_CAN_RANGE_ATTACK2"
  1836. " COND_CAN_MELEE_ATTACK2"
  1837. " COND_HEAR_DANGER"
  1838. );
  1839. //=========================================================
  1840. // > PATROL_RUN
  1841. //
  1842. // Run around randomly until we detect an enemy
  1843. //=========================================================
  1844. AI_DEFINE_SCHEDULE
  1845. (
  1846. SCHED_PATROL_RUN,
  1847. " Tasks"
  1848. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_COMBAT_FACE"
  1849. // " TASK_SET_TOLERANCE_DISTANCE 48"
  1850. " TASK_SET_ROUTE_SEARCH_TIME 5" // Spend 5 seconds trying to build a path if stuck
  1851. " TASK_GET_PATH_TO_RANDOM_NODE 200"
  1852. " TASK_RUN_PATH 0"
  1853. " TASK_WAIT_FOR_MOVEMENT 0"
  1854. ""
  1855. " Interrupts"
  1856. " COND_CAN_RANGE_ATTACK1 "
  1857. " COND_CAN_RANGE_ATTACK2 "
  1858. " COND_CAN_MELEE_ATTACK1 "
  1859. " COND_CAN_MELEE_ATTACK2"
  1860. " COND_GIVE_WAY"
  1861. " COND_NEW_ENEMY"
  1862. " COND_SEE_ENEMY"
  1863. " COND_SEE_FEAR"
  1864. " COND_HEAR_COMBAT"
  1865. " COND_HEAR_DANGER"
  1866. " COND_HEAR_PLAYER"
  1867. " COND_LIGHT_DAMAGE"
  1868. " COND_HEAVY_DAMAGE"
  1869. " COND_SMELL"
  1870. " COND_PROVOKED"
  1871. );
  1872. //=========================================================
  1873. // > IDLE_WANDER
  1874. //
  1875. // Walk around randomly
  1876. //=========================================================
  1877. AI_DEFINE_SCHEDULE
  1878. (
  1879. SCHED_IDLE_WANDER,
  1880. " Tasks"
  1881. // " TASK_SET_TOLERANCE_DISTANCE 48"
  1882. " TASK_SET_ROUTE_SEARCH_TIME 5" // Spend 5 seconds trying to build a path if stuck
  1883. " TASK_GET_PATH_TO_RANDOM_NODE 200"
  1884. " TASK_WALK_PATH 0"
  1885. " TASK_WAIT_FOR_MOVEMENT 0"
  1886. " TASK_WAIT_PVS 0"
  1887. ""
  1888. " Interrupts"
  1889. " COND_GIVE_WAY"
  1890. " COND_HEAR_COMBAT"
  1891. " COND_HEAR_DANGER"
  1892. " COND_NEW_ENEMY"
  1893. " COND_SEE_ENEMY"
  1894. " COND_SEE_FEAR"
  1895. " COND_LIGHT_DAMAGE"
  1896. " COND_HEAVY_DAMAGE"
  1897. " COND_IDLE_INTERRUPT"
  1898. );
  1899. //=========================================================
  1900. // > PATROL_WALK
  1901. //
  1902. // Walk around randomly until we detect an enemy
  1903. //=========================================================
  1904. AI_DEFINE_SCHEDULE
  1905. (
  1906. SCHED_PATROL_WALK,
  1907. " Tasks"
  1908. // " TASK_SET_TOLERANCE_DISTANCE 48"
  1909. " TASK_SET_ROUTE_SEARCH_TIME 5" // Spend 5 seconds trying to build a path if stuck
  1910. " TASK_GET_PATH_TO_RANDOM_NODE 200"
  1911. " TASK_WALK_PATH 0"
  1912. " TASK_WAIT_FOR_MOVEMENT 0"
  1913. ""
  1914. " Interrupts"
  1915. " COND_CAN_RANGE_ATTACK1 "
  1916. " COND_CAN_RANGE_ATTACK2 "
  1917. " COND_CAN_MELEE_ATTACK1 "
  1918. " COND_CAN_MELEE_ATTACK2"
  1919. " COND_GIVE_WAY"
  1920. " COND_HEAR_COMBAT"
  1921. " COND_HEAR_DANGER"
  1922. " COND_HEAR_PLAYER"
  1923. " COND_NEW_ENEMY"
  1924. " COND_SEE_ENEMY"
  1925. " COND_SEE_FEAR"
  1926. " COND_LIGHT_DAMAGE"
  1927. " COND_HEAVY_DAMAGE"
  1928. " COND_SMELL"
  1929. " COND_PROVOKED"
  1930. );
  1931. //=========================================================
  1932. // > COMBAT_PATROL
  1933. //=========================================================
  1934. AI_DEFINE_SCHEDULE
  1935. (
  1936. SCHED_COMBAT_PATROL,
  1937. " Tasks"
  1938. " TASK_SET_ROUTE_SEARCH_TIME 5" // Spend 5 seconds trying to build a path if stuck
  1939. " TASK_GET_PATH_TO_RANDOM_NODE 200"
  1940. " TASK_WALK_PATH 0"
  1941. " TASK_WAIT_FOR_MOVEMENT 0"
  1942. ""
  1943. " Interrupts"
  1944. " COND_CAN_RANGE_ATTACK1 "
  1945. " COND_CAN_RANGE_ATTACK2 "
  1946. " COND_CAN_MELEE_ATTACK1 "
  1947. " COND_CAN_MELEE_ATTACK2"
  1948. " COND_GIVE_WAY"
  1949. " COND_HEAR_DANGER"
  1950. " COND_NEW_ENEMY"
  1951. );
  1952. //=========================================================
  1953. // > RUN_RANDOM
  1954. //=========================================================
  1955. AI_DEFINE_SCHEDULE
  1956. (
  1957. SCHED_RUN_RANDOM,
  1958. " Tasks"
  1959. // " TASK_SET_TOLERANCE_DISTANCE 48"
  1960. " TASK_SET_ROUTE_SEARCH_TIME 1" // Spend 1 seconds trying to build a path if stuck
  1961. " TASK_GET_PATH_TO_RANDOM_NODE 500"
  1962. " TASK_RUN_PATH 0"
  1963. " TASK_WAIT_FOR_MOVEMENT 0"
  1964. ""
  1965. " Interrupts"
  1966. );
  1967. //=========================================================
  1968. // > FALL_TO_GROUND
  1969. //=========================================================
  1970. AI_DEFINE_SCHEDULE
  1971. (
  1972. SCHED_FALL_TO_GROUND,
  1973. " Tasks"
  1974. " TASK_FALL_TO_GROUND 0"
  1975. ""
  1976. " Interrupts"
  1977. );
  1978. //=========================================================
  1979. // > SCHED_DROPSHIP_DUSTOFF
  1980. // After leaving the dropship, dustoff to your specified point
  1981. //=========================================================
  1982. AI_DEFINE_SCHEDULE
  1983. (
  1984. SCHED_DROPSHIP_DUSTOFF,
  1985. " Tasks"
  1986. " TASK_WALK_PATH 0"
  1987. " TASK_WAIT_FOR_MOVEMENT 0"
  1988. " TASK_WAIT_PVS 0"
  1989. ""
  1990. " Interrupts"
  1991. );
  1992. //=========================================================
  1993. // Flinch to protect self from incoming physics object
  1994. //=========================================================
  1995. AI_DEFINE_SCHEDULE
  1996. (
  1997. SCHED_FLINCH_PHYSICS,
  1998. " Tasks"
  1999. " TASK_STOP_MOVING 0"
  2000. " TASK_PLAY_SEQUENCE ACTIVITY:ACT_FLINCH_PHYSICS"
  2001. ""
  2002. " Interrupts"
  2003. );
  2004. //=========================================================
  2005. // > SCHED_MOVE_AWAY
  2006. //=========================================================
  2007. AI_DEFINE_SCHEDULE
  2008. (
  2009. SCHED_MOVE_AWAY_FROM_ENEMY,
  2010. " Tasks"
  2011. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_MOVE_AWAY_FAIL"
  2012. " TASK_FACE_ENEMY 0"
  2013. " TASK_MOVE_AWAY_PATH 120"
  2014. " TASK_RUN_PATH 0"
  2015. " TASK_WAIT_FOR_MOVEMENT 0"
  2016. " TASK_SET_SCHEDULE SCHEDULE:SCHED_MOVE_AWAY_END"
  2017. ""
  2018. " Interrupts"
  2019. " COND_NEW_ENEMY"
  2020. " COND_CAN_RANGE_ATTACK1"
  2021. " COND_CAN_RANGE_ATTACK2"
  2022. " COND_CAN_MELEE_ATTACK1"
  2023. " COND_CAN_MELEE_ATTACK2"
  2024. );
  2025. //=========================================================
  2026. // > SCHED_MOVE_AWAY
  2027. //=========================================================
  2028. AI_DEFINE_SCHEDULE
  2029. (
  2030. SCHED_MOVE_AWAY,
  2031. " Tasks"
  2032. " TASK_SET_FAIL_SCHEDULE SCHEDULE:SCHED_MOVE_AWAY_FAIL"
  2033. " TASK_MOVE_AWAY_PATH 120"
  2034. " TASK_RUN_PATH 0"
  2035. " TASK_WAIT_FOR_MOVEMENT 0"
  2036. " TASK_SET_SCHEDULE SCHEDULE:SCHED_MOVE_AWAY_END"
  2037. ""
  2038. " Interrupts"
  2039. );
  2040. //=========================================================
  2041. // > SCHED_MOVE_AWAY_FAIL
  2042. //=========================================================
  2043. AI_DEFINE_SCHEDULE
  2044. (
  2045. SCHED_MOVE_AWAY_FAIL,
  2046. " Tasks"
  2047. " TASK_STOP_MOVING 0"
  2048. ""
  2049. " Interrupts"
  2050. );
  2051. //=========================================================
  2052. // > SCHED_MOVE_AWAY_END (allows derived class to translate to appropriate behavior)
  2053. //=========================================================
  2054. AI_DEFINE_SCHEDULE
  2055. (
  2056. SCHED_MOVE_AWAY_END,
  2057. " Tasks"
  2058. " TASK_STOP_MOVING 0"
  2059. " TASK_FACE_REASONABLE 0"
  2060. ""
  2061. " Interrupts"
  2062. " COND_NEW_ENEMY"
  2063. " COND_SEE_ENEMY"
  2064. " COND_SEE_FEAR"
  2065. " COND_LIGHT_DAMAGE"
  2066. " COND_HEAVY_DAMAGE"
  2067. " COND_PROVOKED"
  2068. " COND_SMELL"
  2069. " COND_HEAR_COMBAT" // sound flags
  2070. " COND_HEAR_WORLD"
  2071. " COND_HEAR_PLAYER"
  2072. " COND_HEAR_DANGER"
  2073. " COND_HEAR_BULLET_IMPACT"
  2074. " COND_IDLE_INTERRUPT"
  2075. );
  2076. //=========================================================
  2077. // > SCHED_WAIT_FOR_SPEAK_FINISH
  2078. //=========================================================
  2079. AI_DEFINE_SCHEDULE
  2080. (
  2081. SCHED_WAIT_FOR_SPEAK_FINISH,
  2082. " Tasks"
  2083. " TASK_WAIT_FOR_SPEAK_FINISH 0"
  2084. ""
  2085. " Interrupts"
  2086. " COND_NEW_ENEMY"
  2087. " COND_SEE_FEAR"
  2088. " COND_LIGHT_DAMAGE"
  2089. " COND_HEAVY_DAMAGE"
  2090. " COND_SMELL"
  2091. " COND_PROVOKED"
  2092. " COND_GIVE_WAY"
  2093. " COND_HEAR_DANGER"
  2094. " COND_HEAR_COMBAT"
  2095. " COND_HEAR_BULLET_IMPACT"
  2096. );
  2097. //=========================================================
  2098. // > SCHED_DUCK_DODGE
  2099. //=========================================================
  2100. AI_DEFINE_SCHEDULE
  2101. (
  2102. SCHED_DUCK_DODGE,
  2103. " Tasks"
  2104. " TASK_STOP_MOVING 0"
  2105. " TASK_PLAY_SEQUENCE ACTIVITY:ACT_DUCK_DODGE"
  2106. " TASK_DEFER_DODGE 30"
  2107. ""
  2108. " Interrupts"
  2109. ""
  2110. );
  2111. //=========================================================
  2112. // > SCHED_INTERACTION_MOVE_TO_PARTNER
  2113. //=========================================================
  2114. AI_DEFINE_SCHEDULE
  2115. (
  2116. SCHED_INTERACTION_MOVE_TO_PARTNER,
  2117. " Tasks"
  2118. " TASK_GET_PATH_TO_INTERACTION_PARTNER 0"
  2119. " TASK_FACE_TARGET 0"
  2120. " TASK_WAIT 1"
  2121. ""
  2122. " Interrupts"
  2123. " COND_NO_CUSTOM_INTERRUPTS"
  2124. );
  2125. //=========================================================
  2126. // > SCHED_INTERACTION_WAIT_FOR_PARTNER
  2127. //=========================================================
  2128. AI_DEFINE_SCHEDULE
  2129. (
  2130. SCHED_INTERACTION_WAIT_FOR_PARTNER,
  2131. " Tasks"
  2132. " TASK_FACE_TARGET 0"
  2133. " TASK_WAIT 1"
  2134. ""
  2135. " Interrupts"
  2136. " COND_NO_CUSTOM_INTERRUPTS"
  2137. );
  2138. //=========================================================
  2139. // > SCHED_SLEEP
  2140. //=========================================================
  2141. AI_DEFINE_SCHEDULE
  2142. (
  2143. SCHED_SLEEP,
  2144. " Tasks"
  2145. " TASK_STOP_MOVING 0"
  2146. " TASK_WAIT 0.2"
  2147. ""
  2148. " Interrupts"
  2149. ""
  2150. );