1 #ifdef REGISTER_MONSTER
4 /* functions */ M_Wyvern, M_Wyvern_Attack,
5 /* spawnflags */ MONSTER_TYPE_FLY | MONSTER_SIZE_BROKEN | MON_FLAG_RANGED,
6 /* mins,maxs */ '-20 -20 -58', '20 20 20',
7 /* model */ "wizard.mdl",
8 /* netname */ "wyvern",
9 /* fullname */ _("Wyvern")
14 float autocvar_g_monster_wyvern_health;
15 float autocvar_g_monster_wyvern_damageforcescale = 0.6;
16 float autocvar_g_monster_wyvern_attack_fireball_damage;
17 float autocvar_g_monster_wyvern_attack_fireball_edgedamage;
18 float autocvar_g_monster_wyvern_attack_fireball_damagetime;
19 float autocvar_g_monster_wyvern_attack_fireball_force;
20 float autocvar_g_monster_wyvern_attack_fireball_radius;
21 float autocvar_g_monster_wyvern_attack_fireball_speed;
22 float autocvar_g_monster_wyvern_speed_stop;
23 float autocvar_g_monster_wyvern_speed_run;
24 float autocvar_g_monster_wyvern_speed_walk;
27 const float wyvern_anim_hover = 0;
28 const float wyvern_anim_fly = 1;
29 const float wyvern_anim_magic = 2;
30 const float wyvern_anim_pain = 3;
31 const float wyvern_anim_death = 4;
34 void M_Wyvern_Attack_Fireball_Explode()
39 pointparticles(particleeffectnum("fireball_explode"), self.origin, '0 0 0', 1);
41 RadiusDamage(self, self.realowner, (autocvar_g_monster_wyvern_attack_fireball_damage), (autocvar_g_monster_wyvern_attack_fireball_edgedamage), (autocvar_g_monster_wyvern_attack_fireball_force), world, world, (autocvar_g_monster_wyvern_attack_fireball_radius), self.projectiledeathtype, world);
43 for(e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); ) if(vlen(e.origin - self.origin) <= (autocvar_g_monster_wyvern_attack_fireball_radius))
44 Fire_AddDamage(e, self, 5 * MONSTER_SKILLMOD(self), (autocvar_g_monster_wyvern_attack_fireball_damagetime), self.projectiledeathtype);
50 void M_Wyvern_Attack_Fireball_Touch()
54 M_Wyvern_Attack_Fireball_Explode();
57 void M_Wyvern_Attack_Fireball()
59 entity missile = spawn();
60 vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
62 monster_makevectors(self.enemy);
64 missile.owner = missile.realowner = self;
65 missile.solid = SOLID_TRIGGER;
66 missile.movetype = MOVETYPE_FLYMISSILE;
67 missile.projectiledeathtype = DEATH_MONSTER_WYVERN;
68 setsize(missile, '-6 -6 -6', '6 6 6');
69 setorigin(missile, self.origin + self.view_ofs + v_forward * 14);
70 missile.flags = FL_PROJECTILE;
71 missile.velocity = dir * (autocvar_g_monster_wyvern_attack_fireball_speed);
72 missile.avelocity = '300 300 300';
73 missile.nextthink = time + 5;
74 missile.think = M_Wyvern_Attack_Fireball_Explode;
75 missile.enemy = self.enemy;
76 missile.touch = M_Wyvern_Attack_Fireball_Touch;
77 CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
80 float M_Wyvern_Attack(float attack_type)
84 case MONSTER_ATTACK_MELEE:
85 case MONSTER_ATTACK_RANGED:
87 self.attack_finished_single = time + 1.2;
88 self.anim_finished = time + 1.2;
90 M_Wyvern_Attack_Fireball();
99 void spawnfunc_monster_wyvern() { Monster_Spawn(MON_WYVERN); }
103 bool M_Wyvern(int req)
114 self.pain_finished = time + 0.5;
115 setanim(self, self.anim_pain1, true, true, false);
120 setanim(self, self.anim_die1, false, true, true);
121 self.velocity_x = -200 + 400 * random();
122 self.velocity_y = -200 + 400 * random();
123 self.velocity_z = 100 + 100 * random();
130 vector none = '0 0 0';
131 self.anim_die1 = animfixfps(self, '4 1 0.5', none); // 2 seconds
132 self.anim_walk = animfixfps(self, '1 1 1', none);
133 self.anim_idle = animfixfps(self, '0 1 1', none);
134 self.anim_pain1 = animfixfps(self, '3 1 2', none); // 0.5 seconds
135 self.anim_shoot = animfixfps(self, '2 1 5', none); // analyze models and set framerate
136 self.anim_run = animfixfps(self, '1 1 1', none);
144 if(!self.health) self.health = (autocvar_g_monster_wyvern_health);
145 if(!self.speed) { self.speed = (autocvar_g_monster_wyvern_speed_walk); }
146 if(!self.speed2) { self.speed2 = (autocvar_g_monster_wyvern_speed_run); }
147 if(!self.stopspeed) { self.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
148 if(!self.damageforcescale) { self.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
150 self.monster_loot = spawnfunc_item_cells;
156 precache_model("models/monsters/wizard.mdl");
165 #endif // REGISTER_MONSTER