1 /* ALL MONSTERS SHOULD BE 1 0 0 IN COLOR */
3 // name =[framenum, nexttime, nextthink] {code}
7 // self.frame=framenum;
8 // self.nextthink = time + nexttime;
9 // self.think = nextthink
21 Using a monster makes it angry at the current activator
22 LordHavoc: using a monster with the spawnflag 'Appear' makes it appear
32 if (self.spawnflags & MONSTER_APPEAR)
34 self.nextthink = time + 0.1;
35 self.spawnflags = self.spawnflags - MONSTER_APPEAR;
36 self.solid = SOLID_SLIDEBOX;
37 self.takedamage = DAMAGE_AIM;
38 //self.movetype = MOVETYPE_STEP;
39 self.model = self.mdl;
41 self.modelindex = self.modelindex2;
43 //setorigin(self, self.origin + '0 0 1');
44 spawn_tdeath(self.origin, self, self.origin);
49 if (activator.items & IT_INVISIBILITY)
52 if (activator.flags & FL_NOTARGET)
54 if (activator.classname != "player")
57 // delay reaction so if the monster is teleported, its sound is still heard
58 self.enemy = activator;
59 self.nextthink = time + 0.1;
60 self.think = FoundTarget;
63 void() monster_appearsetup =
65 if ((self.spawnflags & MONSTER_APPEAR) == 0)
67 self.mdl = self.model;
68 self.modelindex2 = self.modelindex;
70 self.solid = SOLID_NOT;
71 self.takedamage = DAMAGE_NO;
72 //self.movetype = MOVETYPE_NONE;
81 Sets relative alpha of monster in skill 4 mode.
84 void(float a) monster_setalpha =
86 if (skill < 4 || self.classname == "monster_hellfish")
94 // randomly forget enemy, this makes monsters randomly return to their normal ghostlike state
99 // randomly blink (playing the same alarming sound as if attacking)
100 if (self.enemy == world)
103 if (time >= 0.3) // don't blink during the init process because it might become permanent
104 if (random() < 0.005)
106 // blink for an instant, this causes the appear sound, alarming the player as if under attack
107 sound(self, CHAN_AUTO, "wizard/wsight.wav", 1, ATTN_NORM);
111 // if ghosted, become non-solid and immune to damage
112 if (a <= 0 || self.enemy == world)
114 self.solid = SOLID_NOT;
115 self.takedamage = DAMAGE_NO;
119 // if unghosting, make sure we have an enemy, otherwise stay ghosted (even if blinking) so we can't be shot while blinking
120 if (self.solid != SOLID_SLIDEBOX)
121 sound(self, CHAN_AUTO, "wizard/wsight.wav", 1, ATTN_NORM);
122 self.solid = SOLID_SLIDEBOX;
123 self.takedamage = DAMAGE_AIM;
126 self.alpha = SKILL4_MINALPHA + (1 - SKILL4_MINALPHA) * bound(0, a, 1);
133 When a mosnter dies, it fires all of its targets with the current
137 void() monster_death_use =
140 if (self.flags & FL_FLY)
141 self.flags = self.flags - FL_FLY;
142 if (self.flags & FL_SWIM)
143 self.flags = self.flags - FL_SWIM;
148 activator = self.enemy;
153 void() monsterinwall =
156 if (!cvar("developer"))
158 // this is handy for level designers,
159 // puts a spikey ball where the error is...
161 setorigin(e, self.origin);
162 setmodel (e, "models/ebomb.mdl");
163 e.movetype = MOVETYPE_NONE;
170 //============================================================================
172 void() walkmonster_start_go =
174 self.origin_z = self.origin_z + 1; // raise off floor a bit
176 tracebox(self.origin, self.mins, self.maxs, self.origin, TRUE, self);
177 if (trace_startsolid)
179 dprint("walkmonster in wall at: ");
180 dprint(vtos(self.origin));
190 dprint("walkmonster in wall at: ");
191 dprint(vtos(self.origin));
197 //self.cantrigger = TRUE;
199 self.takedamage = DAMAGE_AIM;
201 self.ideal_yaw = self.angles * '0 1 0';
204 self.view_ofs = '0 0 25';
205 self.use = monster_use;
207 self.flags = self.flags | FL_MONSTER;
210 self.spawnflags = self.spawnflags | MONSTER_WANDER;
214 self.goalentity = self.movetarget = find(world, targetname, self.target);
215 self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
216 if (!self.movetarget)
218 dprint("Monster can't find target at ");
219 dprint(vtos(self.origin));
222 // this used to be an objerror
223 if (self.movetarget.classname == "path_corner")
227 if ((self.spawnflags & MONSTER_WANDER) && (!self.monsterawaitingteleport) && (self.spawnflags & 3) == 0 && (world.model != "maps/e1m7.bsp"))
229 monster_spawnwanderpath();
230 self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
235 self.pausetime = 99999999;
242 if ((self.spawnflags & MONSTER_WANDER) && (!self.monsterawaitingteleport) && (self.spawnflags & 3) == 0 && (world.model != "maps/e1m7.bsp"))
244 monster_spawnwanderpath();
245 self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
250 self.pausetime = 99999999;
255 // spread think times so they don't all happen at same time
256 self.nextthink = self.nextthink + random()*0.5 + 0.1;
257 self.iscreature = TRUE;
259 force_retouch = 2; // mainly to detect teleports
261 monster_appearsetup();
265 void() walkmonster_start =
267 self.candrown = 1; // this is turned off by some monsters like zombies
268 // delay drop to floor to make sure all doors have been spawned
269 // spread think times so they don't all happen at same time
270 self.nextthink = time + random()*0.5 + 0.3;
271 self.think = walkmonster_start_go;
272 total_monsters = total_monsters + 1;
273 self.bot_attack = TRUE;
274 self.frags = 2; // actually just used to get havocbots to attack it...
275 self.bleedfunc = genericbleedfunc;
276 self.ismonster = TRUE;
278 monster_setalpha (0);
283 void() flymonster_start_go =
285 self.takedamage = DAMAGE_AIM;
287 self.ideal_yaw = self.angles * '0 1 0';
290 self.view_ofs = '0 0 25';
291 self.use = monster_use;
293 self.flags = self.flags | FL_FLY;
294 self.flags = self.flags | FL_MONSTER;
298 dprint("flymonster in wall at: ");
299 dprint(vtos(self.origin));
304 //self.cantrigger = TRUE;
307 self.spawnflags = self.spawnflags | MONSTER_WANDER;
311 self.goalentity = self.movetarget = find(world, targetname, self.target);
312 if (!self.movetarget)
314 dprint("Monster can't find target at ");
315 dprint(vtos(self.origin));
318 // this used to be an objerror
319 if (self.movetarget.classname == "path_corner")
323 if ((self.spawnflags & MONSTER_WANDER) && (!self.monsterawaitingteleport) && (self.spawnflags & 3) == 0 && (world.model != "maps/e1m7.bsp"))
325 monster_spawnwanderpath();
326 self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
331 self.pausetime = 99999999;
338 if ((self.spawnflags & MONSTER_WANDER) && (!self.monsterawaitingteleport) && (self.spawnflags & 3) == 0 && (world.model != "maps/e1m7.bsp"))
340 monster_spawnwanderpath();
341 self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
346 self.pausetime = 99999999;
350 self.iscreature = TRUE;
352 force_retouch = 2; // mainly to detect teleports
354 monster_appearsetup();
357 void() flymonster_start =
360 // spread think times so they don't all happen at same time
361 self.nextthink = time + random()*0.5 + 0.1;
362 self.think = flymonster_start_go;
363 total_monsters = total_monsters + 1;
364 self.bot_attack = TRUE;
365 self.frags = 2; // actually just used to get havocbots to attack it...
366 self.bleedfunc = genericbleedfunc;
367 self.ismonster = TRUE;
369 monster_setalpha (0);
373 void() swimmonster_start_go =
381 //self.cantrigger = TRUE;
383 self.takedamage = DAMAGE_AIM;
385 self.ideal_yaw = self.angles * '0 1 0';
388 self.view_ofs = '0 0 10';
389 self.use = monster_use;
391 self.flags = self.flags | FL_SWIM;
392 self.flags = self.flags | FL_MONSTER;
395 self.spawnflags = self.spawnflags | MONSTER_WANDER;
399 self.goalentity = self.movetarget = find(world, targetname, self.target);
400 if (!self.movetarget)
402 dprint("Monster can't find target at ");
403 dprint(vtos(self.origin));
406 // this used to be an objerror
407 if (self.movetarget.classname == "path_corner")
411 if ((self.spawnflags & MONSTER_WANDER) && (!self.monsterawaitingteleport) && (self.spawnflags & 3) == 0 && (world.model != "maps/e1m7.bsp"))
413 monster_spawnwanderpath();
414 self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
419 self.pausetime = 99999999;
426 if ((self.spawnflags & MONSTER_WANDER) && (!self.monsterawaitingteleport) && (self.spawnflags & 3) == 0 && (world.model != "maps/e1m7.bsp"))
428 monster_spawnwanderpath();
429 self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
434 self.pausetime = 99999999;
438 self.iscreature = TRUE;
440 force_retouch = 2; // mainly to detect teleports
442 monster_appearsetup();
445 void() swimmonster_start =
447 // spread think times so they don't all happen at same time
449 self.nextthink = time + random()*0.5 + 0.1;
450 self.think = swimmonster_start_go;
451 total_monsters = total_monsters + 1;
452 self.bot_attack = TRUE;
453 self.frags = 2; // actually just used to get havocbots to attack it...
454 self.bleedfunc = genericbleedfunc;
455 self.ismonster = TRUE;
460 void(vector org, float bodydamage, float armordamage, vector force, float damgtype) genericbleedfunc =
463 v = '0 0 0' - force * 0.05;
465 te_spark(org, v, armordamage * 3);
467 te_blood(org, v, bodydamage);