hknight.qc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. /* Copyright (C) 1996-1997 Id Software, Inc.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. /*
  16. ==============================================================================
  17. KNIGHT
  18. ==============================================================================
  19. */
  20. $cd /raid/quake/id1/models/knight2
  21. $origin 0 0 24
  22. $base base
  23. $skin skin
  24. $frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
  25. $frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9
  26. $frame walk10 walk11 walk12 walk13 walk14 walk15 walk16 walk17
  27. $frame walk18 walk19 walk20
  28. $frame run1 run2 run3 run4 run5 run6 run7 run8
  29. $frame pain1 pain2 pain3 pain4 pain5
  30. $frame death1 death2 death3 death4 death5 death6 death7 death8
  31. $frame death9 death10 death11 death12
  32. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  33. $frame deathb9
  34. $frame char_a1 char_a2 char_a3 char_a4 char_a5 char_a6 char_a7 char_a8
  35. $frame char_a9 char_a10 char_a11 char_a12 char_a13 char_a14 char_a15 char_a16
  36. $frame magica1 magica2 magica3 magica4 magica5 magica6 magica7 magica8
  37. $frame magica9 magica10 magica11 magica12 magica13 magica14
  38. $frame magicb1 magicb2 magicb3 magicb4 magicb5 magicb6 magicb7 magicb8
  39. $frame magicb9 magicb10 magicb11 magicb12 magicb13
  40. $frame char_b1 char_b2 char_b3 char_b4 char_b5 char_b6
  41. $frame slice1 slice2 slice3 slice4 slice5 slice6 slice7 slice8 slice9 slice10
  42. $frame smash1 smash2 smash3 smash4 smash5 smash6 smash7 smash8 smash9 smash10
  43. $frame smash11
  44. $frame w_attack1 w_attack2 w_attack3 w_attack4 w_attack5 w_attack6 w_attack7
  45. $frame w_attack8 w_attack9 w_attack10 w_attack11 w_attack12 w_attack13 w_attack14
  46. $frame w_attack15 w_attack16 w_attack17 w_attack18 w_attack19 w_attack20
  47. $frame w_attack21 w_attack22
  48. $frame magicc1 magicc2 magicc3 magicc4 magicc5 magicc6 magicc7 magicc8
  49. $frame magicc9 magicc10 magicc11
  50. void() hknight_char_a1;
  51. void() hknight_run1;
  52. void() hk_idle_sound;
  53. void(float offset) hknight_shot =
  54. {
  55. local vector offang;
  56. local vector org, vec;
  57. offang = vectoangles (self.enemy.origin - self.origin);
  58. offang_y = offang_y + offset * 6;
  59. makevectors (offang);
  60. org = self.origin + self.mins + self.size*0.5 + v_forward * 20;
  61. // set missile speed
  62. vec = normalize (v_forward);
  63. vec_z = 0 - vec_z + (random() - 0.5)*0.1;
  64. launch_spike (org, vec);
  65. newmis.classname = "knightspike";
  66. setmodel (newmis, "progs/k_spike.mdl");
  67. setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
  68. newmis.velocity = vec*300;
  69. sound (self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
  70. };
  71. void() CheckForCharge =
  72. {
  73. // check for mad charge
  74. if (!enemy_vis)
  75. return;
  76. if (time < self.attack_finished)
  77. return;
  78. if ( fabs(self.origin_z - self.enemy.origin_z) > 20)
  79. return; // too much height change
  80. if ( vlen (self.origin - self.enemy.origin) < 80)
  81. return; // use regular attack
  82. // charge
  83. SUB_AttackFinished (2);
  84. hknight_char_a1 ();
  85. };
  86. void() CheckContinueCharge =
  87. {
  88. if (time > self.attack_finished)
  89. {
  90. SUB_AttackFinished (3);
  91. hknight_run1 ();
  92. return; // done charging
  93. }
  94. if (random() > 0.5)
  95. sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
  96. else
  97. sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
  98. };
  99. //===========================================================================
  100. void() hknight_stand1 =[ $stand1, hknight_stand2 ] {ai_stand();};
  101. void() hknight_stand2 =[ $stand2, hknight_stand3 ] {ai_stand();};
  102. void() hknight_stand3 =[ $stand3, hknight_stand4 ] {ai_stand();};
  103. void() hknight_stand4 =[ $stand4, hknight_stand5 ] {ai_stand();};
  104. void() hknight_stand5 =[ $stand5, hknight_stand6 ] {ai_stand();};
  105. void() hknight_stand6 =[ $stand6, hknight_stand7 ] {ai_stand();};
  106. void() hknight_stand7 =[ $stand7, hknight_stand8 ] {ai_stand();};
  107. void() hknight_stand8 =[ $stand8, hknight_stand9 ] {ai_stand();};
  108. void() hknight_stand9 =[ $stand9, hknight_stand1 ] {ai_stand();};
  109. //===========================================================================
  110. void() hknight_walk1 =[ $walk1, hknight_walk2 ] {
  111. hk_idle_sound();
  112. ai_walk(2);};
  113. void() hknight_walk2 =[ $walk2, hknight_walk3 ] {ai_walk(5);};
  114. void() hknight_walk3 =[ $walk3, hknight_walk4 ] {ai_walk(5);};
  115. void() hknight_walk4 =[ $walk4, hknight_walk5 ] {ai_walk(4);};
  116. void() hknight_walk5 =[ $walk5, hknight_walk6 ] {ai_walk(4);};
  117. void() hknight_walk6 =[ $walk6, hknight_walk7 ] {ai_walk(2);};
  118. void() hknight_walk7 =[ $walk7, hknight_walk8 ] {ai_walk(2);};
  119. void() hknight_walk8 =[ $walk8, hknight_walk9 ] {ai_walk(3);};
  120. void() hknight_walk9 =[ $walk9, hknight_walk10 ] {ai_walk(3);};
  121. void() hknight_walk10 =[ $walk10, hknight_walk11 ] {ai_walk(4);};
  122. void() hknight_walk11 =[ $walk11, hknight_walk12 ] {ai_walk(3);};
  123. void() hknight_walk12 =[ $walk12, hknight_walk13 ] {ai_walk(4);};
  124. void() hknight_walk13 =[ $walk13, hknight_walk14 ] {ai_walk(6);};
  125. void() hknight_walk14 =[ $walk14, hknight_walk15 ] {ai_walk(2);};
  126. void() hknight_walk15 =[ $walk15, hknight_walk16 ] {ai_walk(2);};
  127. void() hknight_walk16 =[ $walk16, hknight_walk17 ] {ai_walk(4);};
  128. void() hknight_walk17 =[ $walk17, hknight_walk18 ] {ai_walk(3);};
  129. void() hknight_walk18 =[ $walk18, hknight_walk19 ] {ai_walk(3);};
  130. void() hknight_walk19 =[ $walk19, hknight_walk20 ] {ai_walk(3);};
  131. void() hknight_walk20 =[ $walk20, hknight_walk1 ] {ai_walk(2);};
  132. //===========================================================================
  133. void() hknight_run1 =[ $run1, hknight_run2 ] {
  134. hk_idle_sound();
  135. ai_run (20); CheckForCharge (); };
  136. void() hknight_run2 =[ $run2, hknight_run3 ] {ai_run(25);};
  137. void() hknight_run3 =[ $run3, hknight_run4 ] {ai_run(18);};
  138. void() hknight_run4 =[ $run4, hknight_run5 ] {ai_run(16);};
  139. void() hknight_run5 =[ $run5, hknight_run6 ] {ai_run(14);};
  140. void() hknight_run6 =[ $run6, hknight_run7 ] {ai_run(25);};
  141. void() hknight_run7 =[ $run7, hknight_run8 ] {ai_run(21);};
  142. void() hknight_run8 =[ $run8, hknight_run1 ] {ai_run(13);};
  143. //============================================================================
  144. void() hknight_pain1 =[ $pain1, hknight_pain2 ] {sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);};
  145. void() hknight_pain2 =[ $pain2, hknight_pain3 ] {};
  146. void() hknight_pain3 =[ $pain3, hknight_pain4 ] {};
  147. void() hknight_pain4 =[ $pain4, hknight_pain5 ] {};
  148. void() hknight_pain5 =[ $pain5, hknight_run1 ] {};
  149. //============================================================================
  150. void() hknight_die1 =[ $death1, hknight_die2 ] {ai_forward(10);};
  151. void() hknight_die2 =[ $death2, hknight_die3 ] {ai_forward(8);};
  152. void() hknight_die3 =[ $death3, hknight_die4 ]
  153. {self.solid = SOLID_NOT; ai_forward(7);};
  154. void() hknight_die4 =[ $death4, hknight_die5 ] {};
  155. void() hknight_die5 =[ $death5, hknight_die6 ] {};
  156. void() hknight_die6 =[ $death6, hknight_die7 ] {};
  157. void() hknight_die7 =[ $death7, hknight_die8 ] {};
  158. void() hknight_die8 =[ $death8, hknight_die9 ] {ai_forward(10);};
  159. void() hknight_die9 =[ $death9, hknight_die10 ] {ai_forward(11);};
  160. void() hknight_die10 =[ $death10, hknight_die11 ] {};
  161. void() hknight_die11 =[ $death11, hknight_die12 ] {};
  162. void() hknight_die12 =[ $death12, hknight_die12 ] {};
  163. void() hknight_dieb1 =[ $deathb1, hknight_dieb2 ] {};
  164. void() hknight_dieb2 =[ $deathb2, hknight_dieb3 ] {};
  165. void() hknight_dieb3 =[ $deathb3, hknight_dieb4 ]
  166. {self.solid = SOLID_NOT;};
  167. void() hknight_dieb4 =[ $deathb4, hknight_dieb5 ] {};
  168. void() hknight_dieb5 =[ $deathb5, hknight_dieb6 ] {};
  169. void() hknight_dieb6 =[ $deathb6, hknight_dieb7 ] {};
  170. void() hknight_dieb7 =[ $deathb7, hknight_dieb8 ] {};
  171. void() hknight_dieb8 =[ $deathb8, hknight_dieb9 ] {};
  172. void() hknight_dieb9 =[ $deathb9, hknight_dieb9 ] {};
  173. void() hknight_die =
  174. {
  175. // check for gib
  176. if (self.health < -40)
  177. {
  178. sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
  179. ThrowHead ("progs/h_hellkn.mdl", self.health);
  180. ThrowGib ("progs/gib1.mdl", self.health);
  181. ThrowGib ("progs/gib2.mdl", self.health);
  182. ThrowGib ("progs/gib3.mdl", self.health);
  183. return;
  184. }
  185. // regular death
  186. sound (self, CHAN_VOICE, "hknight/death1.wav", 1, ATTN_NORM);
  187. if (random() > 0.5)
  188. hknight_die1 ();
  189. else
  190. hknight_dieb1 ();
  191. };
  192. //============================================================================
  193. void() hknight_magica1 =[ $magica1, hknight_magica2 ] {ai_face();};
  194. void() hknight_magica2 =[ $magica2, hknight_magica3 ] {ai_face();};
  195. void() hknight_magica3 =[ $magica3, hknight_magica4 ] {ai_face();};
  196. void() hknight_magica4 =[ $magica4, hknight_magica5 ] {ai_face();};
  197. void() hknight_magica5 =[ $magica5, hknight_magica6 ] {ai_face();};
  198. void() hknight_magica6 =[ $magica6, hknight_magica7 ] {ai_face();};
  199. void() hknight_magica7 =[ $magica7, hknight_magica8 ] {hknight_shot(-2);};
  200. void() hknight_magica8 =[ $magica8, hknight_magica9 ] {hknight_shot(-1);};
  201. void() hknight_magica9 =[ $magica9, hknight_magica10] {hknight_shot(0);};
  202. void() hknight_magica10 =[ $magica10, hknight_magica11] {hknight_shot(1);};
  203. void() hknight_magica11 =[ $magica11, hknight_magica12] {hknight_shot(2);};
  204. void() hknight_magica12 =[ $magica12, hknight_magica13] {hknight_shot(3);};
  205. void() hknight_magica13 =[ $magica13, hknight_magica14] {ai_face();};
  206. void() hknight_magica14 =[ $magica14, hknight_run1 ] {ai_face();};
  207. //============================================================================
  208. void() hknight_magicb1 =[ $magicb1, hknight_magicb2 ] {ai_face();};
  209. void() hknight_magicb2 =[ $magicb2, hknight_magicb3 ] {ai_face();};
  210. void() hknight_magicb3 =[ $magicb3, hknight_magicb4 ] {ai_face();};
  211. void() hknight_magicb4 =[ $magicb4, hknight_magicb5 ] {ai_face();};
  212. void() hknight_magicb5 =[ $magicb5, hknight_magicb6 ] {ai_face();};
  213. void() hknight_magicb6 =[ $magicb6, hknight_magicb7 ] {ai_face();};
  214. void() hknight_magicb7 =[ $magicb7, hknight_magicb8 ] {hknight_shot(-2);};
  215. void() hknight_magicb8 =[ $magicb8, hknight_magicb9 ] {hknight_shot(-1);};
  216. void() hknight_magicb9 =[ $magicb9, hknight_magicb10] {hknight_shot(0);};
  217. void() hknight_magicb10 =[ $magicb10, hknight_magicb11] {hknight_shot(1);};
  218. void() hknight_magicb11 =[ $magicb11, hknight_magicb12] {hknight_shot(2);};
  219. void() hknight_magicb12 =[ $magicb12, hknight_magicb13] {hknight_shot(3);};
  220. void() hknight_magicb13 =[ $magicb13, hknight_run1] {ai_face();};
  221. //============================================================================
  222. void() hknight_magicc1 =[ $magicc1, hknight_magicc2 ] {ai_face();};
  223. void() hknight_magicc2 =[ $magicc2, hknight_magicc3 ] {ai_face();};
  224. void() hknight_magicc3 =[ $magicc3, hknight_magicc4 ] {ai_face();};
  225. void() hknight_magicc4 =[ $magicc4, hknight_magicc5 ] {ai_face();};
  226. void() hknight_magicc5 =[ $magicc5, hknight_magicc6 ] {ai_face();};
  227. void() hknight_magicc6 =[ $magicc6, hknight_magicc7 ] {hknight_shot(-2);};
  228. void() hknight_magicc7 =[ $magicc7, hknight_magicc8 ] {hknight_shot(-1);};
  229. void() hknight_magicc8 =[ $magicc8, hknight_magicc9 ] {hknight_shot(0);};
  230. void() hknight_magicc9 =[ $magicc9, hknight_magicc10] {hknight_shot(1);};
  231. void() hknight_magicc10 =[ $magicc10, hknight_magicc11] {hknight_shot(2);};
  232. void() hknight_magicc11 =[ $magicc11, hknight_run1] {hknight_shot(3);};
  233. //===========================================================================
  234. void() hknight_char_a1 =[ $char_a1, hknight_char_a2 ] {ai_charge(20);};
  235. void() hknight_char_a2 =[ $char_a2, hknight_char_a3 ] {ai_charge(25);};
  236. void() hknight_char_a3 =[ $char_a3, hknight_char_a4 ] {ai_charge(18);};
  237. void() hknight_char_a4 =[ $char_a4, hknight_char_a5 ] {ai_charge(16);};
  238. void() hknight_char_a5 =[ $char_a5, hknight_char_a6 ] {ai_charge(14);};
  239. void() hknight_char_a6 =[ $char_a6, hknight_char_a7 ] {ai_charge(20); ai_melee();};
  240. void() hknight_char_a7 =[ $char_a7, hknight_char_a8 ] {ai_charge(21); ai_melee();};
  241. void() hknight_char_a8 =[ $char_a8, hknight_char_a9 ] {ai_charge(13); ai_melee();};
  242. void() hknight_char_a9 =[ $char_a9, hknight_char_a10 ] {ai_charge(20); ai_melee();};
  243. void() hknight_char_a10=[ $char_a10, hknight_char_a11 ] {ai_charge(20); ai_melee();};
  244. void() hknight_char_a11=[ $char_a11, hknight_char_a12 ] {ai_charge(18); ai_melee();};
  245. void() hknight_char_a12=[ $char_a12, hknight_char_a13 ] {ai_charge(16);};
  246. void() hknight_char_a13=[ $char_a13, hknight_char_a14 ] {ai_charge(14);};
  247. void() hknight_char_a14=[ $char_a14, hknight_char_a15 ] {ai_charge(25);};
  248. void() hknight_char_a15=[ $char_a15, hknight_char_a16 ] {ai_charge(21);};
  249. void() hknight_char_a16=[ $char_a16, hknight_run1 ] {ai_charge(13);};
  250. //===========================================================================
  251. void() hknight_char_b1 =[ $char_b1, hknight_char_b2 ]
  252. {CheckContinueCharge (); ai_charge(23); ai_melee();};
  253. void() hknight_char_b2 =[ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee();};
  254. void() hknight_char_b3 =[ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee();};
  255. void() hknight_char_b4 =[ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee();};
  256. void() hknight_char_b5 =[ $char_b5, hknight_char_b6 ] {ai_charge(18); ai_melee();};
  257. void() hknight_char_b6 =[ $char_b6, hknight_char_b1 ] {ai_charge(8); ai_melee();};
  258. //===========================================================================
  259. void() hknight_slice1 =[ $slice1, hknight_slice2 ] {ai_charge(9);};
  260. void() hknight_slice2 =[ $slice2, hknight_slice3 ] {ai_charge(6);};
  261. void() hknight_slice3 =[ $slice3, hknight_slice4 ] {ai_charge(13);};
  262. void() hknight_slice4 =[ $slice4, hknight_slice5 ] {ai_charge(4);};
  263. void() hknight_slice5 =[ $slice5, hknight_slice6 ] {ai_charge(7); ai_melee();};
  264. void() hknight_slice6 =[ $slice6, hknight_slice7 ] {ai_charge(15); ai_melee();};
  265. void() hknight_slice7 =[ $slice7, hknight_slice8 ] {ai_charge(8); ai_melee();};
  266. void() hknight_slice8 =[ $slice8, hknight_slice9 ] {ai_charge(2); ai_melee();};
  267. void() hknight_slice9 =[ $slice9, hknight_slice10 ] {ai_melee();};
  268. void() hknight_slice10 =[ $slice10, hknight_run1 ] {ai_charge(3);};
  269. //===========================================================================
  270. void() hknight_smash1 =[ $smash1, hknight_smash2 ] {ai_charge(1);};
  271. void() hknight_smash2 =[ $smash2, hknight_smash3 ] {ai_charge(13);};
  272. void() hknight_smash3 =[ $smash3, hknight_smash4 ] {ai_charge(9);};
  273. void() hknight_smash4 =[ $smash4, hknight_smash5 ] {ai_charge(11);};
  274. void() hknight_smash5 =[ $smash5, hknight_smash6 ] {ai_charge(10); ai_melee();};
  275. void() hknight_smash6 =[ $smash6, hknight_smash7 ] {ai_charge(7); ai_melee();};
  276. void() hknight_smash7 =[ $smash7, hknight_smash8 ] {ai_charge(12); ai_melee();};
  277. void() hknight_smash8 =[ $smash8, hknight_smash9 ] {ai_charge(2); ai_melee();};
  278. void() hknight_smash9 =[ $smash9, hknight_smash10 ] {ai_charge(3); ai_melee();};
  279. void() hknight_smash10 =[ $smash10, hknight_smash11 ] {ai_charge(0);};
  280. void() hknight_smash11 =[ $smash11, hknight_run1 ] {ai_charge(0);};
  281. //============================================================================
  282. void() hknight_watk1 =[ $w_attack1, hknight_watk2 ] {ai_charge(2);};
  283. void() hknight_watk2 =[ $w_attack2, hknight_watk3 ] {ai_charge(0);};
  284. void() hknight_watk3 =[ $w_attack3, hknight_watk4 ] {ai_charge(0);};
  285. void() hknight_watk4 =[ $w_attack4, hknight_watk5 ] {ai_melee();};
  286. void() hknight_watk5 =[ $w_attack5, hknight_watk6 ] {ai_melee();};
  287. void() hknight_watk6 =[ $w_attack6, hknight_watk7 ] {ai_melee();};
  288. void() hknight_watk7 =[ $w_attack7, hknight_watk8 ] {ai_charge(1);};
  289. void() hknight_watk8 =[ $w_attack8, hknight_watk9 ] {ai_charge(4);};
  290. void() hknight_watk9 =[ $w_attack9, hknight_watk10 ] {ai_charge(5);};
  291. void() hknight_watk10 =[ $w_attack10, hknight_watk11 ] {ai_charge(3); ai_melee();};
  292. void() hknight_watk11 =[ $w_attack11, hknight_watk12 ] {ai_charge(2); ai_melee();};
  293. void() hknight_watk12 =[ $w_attack12, hknight_watk13 ] {ai_charge(2); ai_melee();};
  294. void() hknight_watk13 =[ $w_attack13, hknight_watk14 ] {ai_charge(0);};
  295. void() hknight_watk14 =[ $w_attack14, hknight_watk15 ] {ai_charge(0);};
  296. void() hknight_watk15 =[ $w_attack15, hknight_watk16 ] {ai_charge(0);};
  297. void() hknight_watk16 =[ $w_attack16, hknight_watk17 ] {ai_charge(1);};
  298. void() hknight_watk17 =[ $w_attack17, hknight_watk18 ] {ai_charge(1); ai_melee();};
  299. void() hknight_watk18 =[ $w_attack18, hknight_watk19 ] {ai_charge(3); ai_melee();};
  300. void() hknight_watk19 =[ $w_attack19, hknight_watk20 ] {ai_charge(4); ai_melee();};
  301. void() hknight_watk20 =[ $w_attack20, hknight_watk21 ] {ai_charge(6);};
  302. void() hknight_watk21 =[ $w_attack21, hknight_watk22 ] {ai_charge(7);};
  303. void() hknight_watk22 =[ $w_attack22, hknight_run1 ] {ai_charge(3);};
  304. //============================================================================
  305. void() hk_idle_sound =
  306. {
  307. if (random() < 0.2)
  308. sound (self, CHAN_VOICE, "hknight/idle.wav", 1, ATTN_NORM);
  309. };
  310. void(entity attacker, float damage) hknight_pain =
  311. {
  312. if (self.pain_finished > time)
  313. return;
  314. sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);
  315. if (time - self.pain_finished > 5)
  316. { // allways go into pain frame if it has been a while
  317. hknight_pain1 ();
  318. self.pain_finished = time + 1;
  319. return;
  320. }
  321. if ((random()*30 > damage) )
  322. return; // didn't flinch
  323. self.pain_finished = time + 1;
  324. hknight_pain1 ();
  325. };
  326. float hknight_type;
  327. void() hknight_melee =
  328. {
  329. hknight_type = hknight_type + 1;
  330. sound (self, CHAN_WEAPON, "hknight/slash1.wav", 1, ATTN_NORM);
  331. if (hknight_type == 1)
  332. hknight_slice1 ();
  333. else if (hknight_type == 2)
  334. hknight_smash1 ();
  335. else if (hknight_type == 3)
  336. {
  337. hknight_watk1 ();
  338. hknight_type = 0;
  339. }
  340. };
  341. /*QUAKED monster_hell_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
  342. */
  343. void() monster_hell_knight =
  344. {
  345. if (deathmatch)
  346. {
  347. remove(self);
  348. return;
  349. }
  350. precache_model2 ("progs/hknight.mdl");
  351. precache_model2 ("progs/k_spike.mdl");
  352. precache_model2 ("progs/h_hellkn.mdl");
  353. precache_sound2 ("hknight/attack1.wav");
  354. precache_sound2 ("hknight/death1.wav");
  355. precache_sound2 ("hknight/pain1.wav");
  356. precache_sound2 ("hknight/sight1.wav");
  357. precache_sound ("hknight/hit.wav"); // used by C code, so don't sound2
  358. precache_sound2 ("hknight/slash1.wav");
  359. precache_sound2 ("hknight/idle.wav");
  360. precache_sound2 ("hknight/grunt.wav");
  361. precache_sound ("knight/sword1.wav");
  362. precache_sound ("knight/sword2.wav");
  363. self.solid = SOLID_SLIDEBOX;
  364. self.movetype = MOVETYPE_STEP;
  365. setmodel (self, "progs/hknight.mdl");
  366. setsize (self, '-16 -16 -24', '16 16 40');
  367. self.health = 250;
  368. self.th_stand = hknight_stand1;
  369. self.th_walk = hknight_walk1;
  370. self.th_run = hknight_run1;
  371. self.th_melee = hknight_melee;
  372. self.th_missile = hknight_magicc1;
  373. self.th_pain = hknight_pain;
  374. self.th_die = hknight_die;
  375. walkmonster_start ();
  376. };