3 const vector WIZARD_MIN = '-16 -16 -45';
4 const vector WIZARD_MAX = '16 16 16';
7 string WIZARD_MODEL = "models/monsters/wizard.mdl";
13 float autocvar_g_monster_wizard;
14 float autocvar_g_monster_wizard_health;
15 float autocvar_g_monster_wizard_speed_walk;
16 float autocvar_g_monster_wizard_speed_run;
17 float autocvar_g_monster_wizard_spike_damage;
18 float autocvar_g_monster_wizard_spike_edgedamage;
19 float autocvar_g_monster_wizard_spike_radius;
20 float autocvar_g_monster_wizard_spike_speed;
23 const float wizard_anim_hover = 0;
24 const float wizard_anim_fly = 1;
25 const float wizard_anim_magic = 2;
26 const float wizard_anim_pain = 3;
27 const float wizard_anim_death = 4;
29 void Wiz_FastExplode()
31 self.event_damage = func_null;
32 self.takedamage = DAMAGE_NO;
33 RadiusDamage (self, self.realowner, autocvar_g_monster_wizard_spike_damage, autocvar_g_monster_wizard_spike_edgedamage, autocvar_g_monster_wizard_spike_radius, world, 0, self.projectiledeathtype, other);
42 if(other == self.owner)
46 if(other.team == self.owner.team)
49 pointparticles(particleeffectnum("TE_WIZSPIKE"), self.origin, '0 0 0', 1);
57 local vector dir = '0 0 0';
58 local float dist = 0, flytime = 0;
60 self.attack_finished_single = time + 0.2;
62 dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
63 dist = vlen (self.enemy.origin - self.origin);
64 flytime = dist * 0.002;
68 self.v_angle = self.angles;
69 makevectors (self.angles);
72 missile.owner = missile.realowner = self;
73 setsize (missile, '0 0 0', '0 0 0');
74 setorigin (missile, self.origin + v_forward * 14 + '0 0 30' + v_right * 14);
75 missile.enemy = self.enemy;
76 missile.nextthink = time + 3;
77 missile.think = Wiz_FastExplode;
78 missile.velocity = dir * autocvar_g_monster_wizard_spike_speed;
79 missile.avelocity = '300 300 300';
80 missile.solid = SOLID_BBOX;
81 missile.movetype = MOVETYPE_FLYMISSILE;
82 missile.touch = Wiz_FastTouch;
83 missile.projectiledeathtype = DEATH_MONSTER_SCRAG;
84 CSQCProjectile(missile, TRUE, PROJECTILE_CRYLINK, TRUE);
87 missile.owner = missile.realowner = self;
88 setsize (missile, '0 0 0', '0 0 0');
89 setorigin (missile, self.origin + v_forward * 14 + '0 0 30' + v_right * -14);
90 missile.enemy = self.enemy;
91 missile.nextthink = time + 3;
92 missile.touch = Wiz_FastTouch;
93 missile.solid = SOLID_BBOX;
94 missile.movetype = MOVETYPE_FLYMISSILE;
95 missile.think = Wiz_FastExplode;
96 missile.velocity = dir * autocvar_g_monster_wizard_spike_speed;
97 missile.avelocity = '300 300 300';
98 missile.projectiledeathtype = DEATH_MONSTER_SCRAG;
99 CSQCProjectile(missile, TRUE, PROJECTILE_CRYLINK, TRUE);
104 self.think = wizard_think;
105 self.nextthink = time + self.ticrate;
107 monster_move(autocvar_g_monster_wizard_speed_run, autocvar_g_monster_wizard_speed_walk, 300, wizard_anim_fly, wizard_anim_hover, wizard_anim_hover);
110 void wizard_fastattack ()
117 Monster_CheckDropCvars ("wizard");
119 self.think = Monster_Fade;
120 self.nextthink = time + 5;
121 self.flags = FL_ONGROUND;
122 self.velocity_x = -200 + 400 * random();
123 self.velocity_y = -200 + 400 * random();
124 self.velocity_z = 100 + 100 * random();
126 monsters_setframe(wizard_anim_death);
128 monster_hook_death(); // for post-death mods
140 self.health = autocvar_g_monster_wizard_health * self.scale;
142 self.classname = "monster_wizard";
143 self.checkattack = GenericCheckAttack;
144 self.attack_ranged = Wiz_Missile;
145 self.nextthink = time + random() * 0.5 + 0.1;
146 self.movetype = MOVETYPE_FLY; // TODO: make it fly up/down
147 self.flags |= FL_FLY;
148 self.think = wizard_think;
149 self.sprite_height = 30;
151 monster_hook_spawn(); // for post-spawn mods
154 void spawnfunc_monster_wizard ()
156 if not(autocvar_g_monster_wizard) { remove(self); return; }
158 self.monster_spawnfunc = spawnfunc_monster_wizard;
160 if(Monster_CheckAppearFlags(self))
165 if not (monster_initialize(
166 "Scrag", MONSTER_SCRAG,
167 WIZARD_MIN, WIZARD_MAX,
169 wizard_die, wizard_spawn))
175 precache_model ("models/spike.mdl");
176 precache_sound ("weapons/spike.wav");
179 // compatibility with old spawns
180 void spawnfunc_monster_scrag () { spawnfunc_monster_wizard(); }