-
Notifications
You must be signed in to change notification settings - Fork 17
/
m_shalrath.qc
411 lines (343 loc) · 13.1 KB
/
m_shalrath.qc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
/*
==============================================================================
SHAL-RATH
==============================================================================
*/
const float SHAL_BALL_TURN_RATE = 265;
const float SHAL_BALL_THINK_RATE = 0.1;
const float SHAL_BALL_VEL = 300;
$cd id1/models/shalrath
$origin 0 0 24
$base base
$skin skin
$scale 0.7
$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
$frame attack9 attack10 attack11
$frame pain1 pain2 pain3 pain4 pain5
$frame death1 death2 death3 death4 death5 death6 death7
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
$frame walk11 walk12
void() shal_stand =[ $walk1, shal_stand ] {ai_stand();}
void() shal_walk1 =[ $walk2, shal_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
ai_walk(6);}
void() shal_walk2 =[ $walk3, shal_walk3 ] {ai_walk(4);}
void() shal_walk3 =[ $walk4, shal_walk4 ] {ai_walk(0);}
void() shal_walk4 =[ $walk5, shal_walk5 ] {ai_walk(0);}
void() shal_walk5 =[ $walk6, shal_walk6 ] {ai_walk(0);}
void() shal_walk6 =[ $walk7, shal_walk7 ] {ai_walk(0);}
void() shal_walk7 =[ $walk8, shal_walk8 ] {ai_walk(5);}
void() shal_walk8 =[ $walk9, shal_walk9 ] {ai_walk(6);}
void() shal_walk9 =[ $walk10, shal_walk10 ] {ai_walk(5);}
void() shal_walk10 =[ $walk11, shal_walk11 ] {ai_walk(0);}
void() shal_walk11 =[ $walk12, shal_walk12 ] {ai_walk(4);}
void() shal_walk12 =[ $walk1, shal_walk1 ] {ai_walk(5);}
void() shal_run1 =[ $walk2, shal_run2 ] {ai_run(6);}
void() shal_run2 =[ $walk3, shal_run3 ] {ai_run(4);}
void() shal_run3 =[ $walk4, shal_run4 ] {ai_run(0);}
void() shal_run4 =[ $walk5, shal_run5 ] {ai_run(0);}
void() shal_run5 =[ $walk6, shal_run6 ] {ai_run(0);}
void() shal_run6 =[ $walk7, shal_run7 ] {ai_run(0);}
void() shal_run7 =[ $walk8, shal_run8 ] {ai_run(5);}
void() shal_run8 =[ $walk9, shal_run9 ] {ai_run(6);}
void() shal_run9 =[ $walk10, shal_run10 ] {ai_run(5);}
void() shal_run10 =[ $walk11, shal_run11 ] {ai_run(0);}
void() shal_run11 =[ $walk12, shal_run12 ] {ai_run(4);}
void() shal_run12 =[ $walk1, shal_run1 ] {ai_run(5);
if (random() < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
}
void() shal_attack1 =[ $attack1, shal_attack2 ] {
sound (self, CHAN_VOICE, "shalrath/attack.wav", 1, ATTN_NORM);
ai_face();
}
void() shal_attack2 =[ $attack2, shal_attack3 ] {ai_face();}
void() shal_attack3 =[ $attack3, shal_attack4 ] {ai_face();}
void() shal_attack4 =[ $attack4, shal_attack5 ] {ai_face();}
void() shal_attack5 =[ $attack5, shal_attack6 ] {ai_face();}
void() shal_attack6 =[ $attack6, shal_attack7 ] {ai_face();}
void() shal_attack7 =[ $attack7, shal_attack8 ] {
ai_face();
if (skill == 3)
self.dest = enemy_vispos();
}
void() shal_attack8 =[ $attack8, shal_attack9 ] {
ai_face();
if (skill == 3 && visible(self.enemy))
self.dest = enemy_vispos();
}
void() shal_attack9 =[ $attack9, shal_attack10 ] {ShalMissile();}
void() shal_attack10 =[ $attack10, shal_attack11 ] {ai_face();}
void() shal_attack11 =[ $attack11, shal_run1 ] {}
void() shal_pain1 =[ $pain1, shal_pain2 ] {}
void() shal_pain2 =[ $pain2, shal_pain3 ] {}
void() shal_pain3 =[ $pain3, shal_pain4 ] {}
void() shal_pain4 =[ $pain4, shal_pain5 ] {}
void() shal_pain5 =[ $pain5, shal_run1 ] {}
void() shal_death1 =[ $death1, shal_death2 ] {}
void() shal_death2 =[ $death2, shal_death3 ] {self.solid = SOLID_NOT;}
void() shal_death3 =[ $death3, shal_death4 ] {}
void() shal_death4 =[ $death4, shal_death5 ] {}
void() shal_death5 =[ $death5, shal_death6 ] {}
void() shal_death6 =[ $death6, shal_death7 ] {}
void() shal_death7 =[ $death7, SUB_Null ] {}
void( entity attacker, float damage ) shalrath_pain =
{
if (self.health <= 0) return;
if (self.pain_finished > time) return;
sound (self, CHAN_VOICE, "shalrath/pain.wav", 1, ATTN_NORM);
shal_pain1();
PainFinished(3);
}
void() shalrath_die =
{
// check for gib
if (self.health < -90)
{
Gib ("progs/h_shal.mdl", self.health);
return;
}
sound (self, CHAN_VOICE, "shalrath/death.wav", 1, ATTN_NORM);
shal_death1();
}
/*
================
ShalMissile
================
*/
void() ShalMissileExplode =
{
T_RadiusDamage (self, self.trueowner, 40, world);
//sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
T_ExplosiveTouch();
}
void() ShalMissileTouch =
{
if (CheckProjectilePassthru()) return;
if (other == self.owner)
return; // don't explode on owner
if (other.type == "zombie")
T_Damage (other, self, self.trueowner, other.health + 25);
ShalMissileExplode();
}
vector(vector targ, float turnrate) ShalTurnToward =
{
vector vel, aimdir, temp, temp2, out;
temp = targ + '0 0 10';
aimdir = temp - self.origin;
aimdir = normalize(aimdir);
vel = normalize(self.velocity);
temp = CrossProduct(vel, aimdir);
// try to flatten the rotation to the horizontal plane unless the difference is extreme
if (fabs(temp_z) > 0.92)
{
temp_z *= 4;
temp = normalize(temp);
}
out = rotateVectorAround(vel, temp, turnrate * SHAL_BALL_THINK_RATE);
// don't turn past the desired direction
temp2 = CrossProduct(out, aimdir);
if ((temp * temp2) < 0)
return aimdir;
return out;
}
void() ShalHome =
{
// a voreball with perfect homing causes combat to effectively stop, forcing the player
// to run around around trying to shake it, often backpedaling through lots of empty map.
// limiting the voreball's turn rate so they can be dodged and forgotten about makes vores
// a more flexible enemy and more useful to the mapper
float dist, rate, dot;
if (self.lifetime_finished < time)
{
ShalMissileExplode();
return;
}
if (!alive(self.enemy))
{
self.think = ShalMissileExplode;
self.nextthink = self.lifetime_finished;
//remove(self);
return;
}
if (!self.deadflag)
{
if ( self.owner.health <= 0 // if our mama dies
|| self.owner.customflags & CFL_PLUNGE ) // or falls in a hole
{
self.deadflag = TRUE;
setmodel(self, "progs/v_spike2.mdl"); // stop sparkling
setsize(self, VEC_ORIGIN, VEC_ORIGIN);
}
}
self.think = ShalHome;
self.nextthink = time + SHAL_BALL_THINK_RATE;
rate = SHAL_BALL_TURN_RATE;
dot = normalize(self.velocity) * normalize(self.enemy.origin - self.origin);
// reset our owner regularly, or else a voreball that passes through a notrace-invisible
// player will become owned by the player and remain nonsolid to them after the ring ends
self.owner = self.trueowner;
// if the projectile is inside a notrace entity at this time, it'll touch again this frame
// and reset anyway, so this state will pingpong until it passes out the other side
// go faster at long distance to close the gap, so snipey vores have a better presence
dist = vlen(self.enemy.origin - self.origin);
dist = saturate( (dist-200) / 600 );
if (skill < 3)
{
// 'poor' homing (half turn rate):
if ( self.deadflag // if our mama dies or falls in a hole
//|| !visible(self.enemy) // if we lost LOS
// took ^^ this one out, because it made voreballs even more effective at going
// around corners, which meant that courageous players had a nice new dodge move
// but those who tried to fight the vore the old cautious way were punished
|| has_invis(self.enemy) // if target is invis
|| pointcontents(self.origin) < CONTENT_SOLID ) // if voreball is underwater
{
// voreballs headed straight at the player when he's hidden should maintain course, to
// make the dodge possible without it immediately turning to hit him
if (dot > 0)
{
rate *= max(1, 1.5 * (1 - dot));
}
self.velocity = SHAL_BALL_VEL * ShalTurnToward(self.enemy.origin, rate * 0.33);
}
else // good homing (full turn rate):
{
// voreballs headed straight away from the player don't normally seem to be able to pick a direction to
// turn and wobble more or less straight away - amp turn rate in these cases to force a 'decision'
if (dot < 0)
{
rate *= min(1.4, 1.4 + fabs(dot));
}
self.velocity = SHAL_BALL_VEL * ShalTurnToward(self.enemy.origin, rate);
}
self.velocity *= 1 + dist;
self.velocity += Vector(crandom(),crandom(),crandom()) * 16;
}
else
{
// nightmare: vanilla-evil homing with corner following to force engagement rather than encourage it
enemy_vis = visible(self.enemy);
self.dest2 = self.dest;
if (enemy_vis) // go straight to follow player around corners
{
// remember last seen positions for corner hax
self.dest = self.enemy.origin;
}
else if (self.dest2 == self.dest)
{
// player has been out of sight for two frames, don't keep changing velocity or
// when we reach that point we'll dance around it weirdly
self.oldvelocity = self.velocity;
return;
}
// poor homing
if ( self.deadflag // if our mama dies or falls in a hole
|| pointcontents(self.origin) < CONTENT_SOLID )
{
if (dot > 0)
{
rate *= max(1, 1.5 * (1 - dot));
}
self.velocity = SHAL_BALL_VEL * ShalTurnToward(self.dest2, rate * 0.5);
}
else // evile homing
{
self.velocity = SHAL_BALL_VEL * normalize(self.dest2 + '0 0 10' - self.origin);
}
self.velocity *= 1 + dist;
self.velocity += Vector(crandom(),crandom(),crandom()) * 16;
}
self.oldvelocity = self.velocity;
}
void() ShalMissile =
{
entity missile;
vector dir;
self.effects = self.effects | EF_MUZZLEFLASH;
sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
makevectors(self.angles);
dir = (enemy_vispos() + '0 0 10') - self.origin + enemy_aim_vertical();
dir = normalize(dir);
// if player has strafed around behind, don't lob the missile out of our ass
if (angledif(self.ideal_yaw, self.angles_y) > 80)
{
dir_x = v_forward_x;
dir_y = v_forward_y;
dir = normalize(dir);
}
missile = launch_projectile(self.origin + '0 0 10' + v_forward * 16, dir * SHAL_BALL_VEL, "voreball");
SUB_ChangeModel (missile, "progs/v_spike.mdl");
missile.avelocity = '300 300 300';
missile.nextthink = time + 0.1;
missile.think = ShalHome;
missile.enemy = self.enemy;
missile.touch = ShalMissileTouch;
missile.lifetime_finished = time + 30; // blow up after a while
if (skill == 3) missile.dest = self.dest;
}
//=================================================================
void() monster_shalrath_spawn =
{
self.classname = "monster_shalrath";
self.solid = SOLID_SLIDEBOX;
//self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/shalrath.mdl");
setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.health = 400;
self.th_stand = shal_stand;
self.th_walk = shal_walk1;
self.th_run = shal_run1;
self.th_die = shalrath_die;
self.th_pain = shalrath_pain;
self.th_missile = shal_attack1;
self.th_checkattack = CheckAttack;
if (self.deathtype == string_null)
self.deathtype = "was exploded by a Vore";
//self.think = walkmonster_start;
//self.nextthink = time + 0.1 + random ()*0.1;
walkmonster_start();
}
void() monster_shalrath_spawner = {mon_spawner_use(monster_shalrath_spawn);}
/*QUAKED monster_shalrath (1 0 0) (-32 -32 -24) (32 32 40) AMBUSH ? ? ? TRIGGERED NOTFOG NOTELEFRAG INSTAWAKE
Vore (Shalrath), 400 health points.
Flags:
"ambush" only wake up on seeing the player, not another monster getting angry
"Triggered" will not spawn until triggered - triggering again will wake him up. Set 'count' to make this a multi-use spawner.
"NoTfog" supress teleport glitter when spawned with 'triggered'
"NoTelefrag" will silently fail to spawn if doing so would telefrag an existing monster. will try again automatically 2x/second until it succeeds.
"Instawake" spawn angry at activator
Keys:
"target" entity to trigger when killed
"targetname" entity name
"movedir" set to a velocity to make the monster jump on awakening
*/
/*FGD
@PointClass base(Monster) size(-32 -32 -24, 32 32 64) model({ "path": ":progs/shalrath.mdl" }) = monster_shalrath : "Vore" []
*/
void() monster_shalrath =
{
if (!SUB_ShouldSpawn()) return;
if (nomonster()) return;
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/shalrath.mdl");
precache_model2 ("progs/h_shal.mdl");
precache_model2 ("progs/v_spike.mdl");
precache_model2 ("progs/v_spike2.mdl");
precache_sound2 ("shalrath/attack.wav");
precache_sound2 ("shalrath/attack2.wav");
precache_sound2 ("shalrath/death.wav");
precache_sound2 ("shalrath/idle.wav");
precache_sound2 ("shalrath/pain.wav");
precache_sound2 ("shalrath/sight.wav");
self.health = 400;
setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
if ( monster_spawnsetup( monster_shalrath_spawner ) ) return;
addmonster(1);
monster_shalrath_spawn();
}