fangflecked-old

old project. ive since repurposed the name
git clone git://moonbender.net/fangflecked-old
Log | Files | Refs | README

scrambler.qc (2400B)


      1 void() SpitwadTouch =
      2 {
      3 	if (other == self.owner)
      4 		return;		// don't explode on owner
      5 		
      6 	if (pointcontents(self.origin) == CONTENT_SKY)
      7 	{
      8 		remove(self);
      9 		return;
     10 	}
     11 	
     12 	if (other.health)
     13 	{
     14 		T_Damage (other, self, self.owner, 20); 
     15 	}
     16 	
     17 	remove(self);
     18 }
     19 		
     20 void() acidspit =
     21 {
     22 	local entity spitwad;
     23 	
     24 	sound(self, CHAN_VOICE, "sounds/hock.wav", 1, ATTN_NORM);
     25 
     26 	spitwad = spawn();
     27 	spitwad.owner = self;
     28 	spitwad.movetype = MOVETYPE_BOUNCE;
     29 	spitwad.solid = SOLID_BBOX;
     30 	
     31 	setmodel (spitwad, "models/spitwad.iqm");
     32 	spitwad.origin = self.origin + '0 0 50';
     33 	setsize (spitwad, '-16 -16 -16', '16 16 16');
     34 	
     35 	spitwad.velocity = normalize(self.enemy.origin - self.origin);
     36 	spitwad.velocity = spitwad.velocity * 450;
     37 	spitwad.velocity_z = 200;
     38 	
     39 	spitwad.angles = vectoangles(spitwad.velocity);
     40 	spitwad.classname = "spitwad";
     41 	
     42 	spitwad.touch = SpitwadTouch; 
     43 	spitwad.nextthink = time + 2.5;
     44 	spitwad.think = SUB_Remove;
     45 	
     46 }
     47 
     48 
     49 void() trif_testattack =
     50 {
     51 	ai_face();
     52 	self.frame = 2;
     53 	if(time >= self.attack_finished)
     54 	{
     55 		acidspit();
     56 		self.think = self.th_run;
     57 	}
     58 	self.nextthink = time + 0.1;
     59 }
     60 
     61 void() trif_run =
     62 {
     63 	self.frame = 0;
     64 	local float enemy_range;
     65 	
     66 	enemy_range = range(self.enemy);
     67 	if (enemy_range > 300)
     68 	{
     69 		ai_run(60);
     70 	}
     71 	if (enemy_range <= 300)
     72 	{
     73 		self.attack_finished = time + .3;
     74 		self.think = trif_testattack;
     75 	}
     76 	self.nextthink = time + 0.1;
     77 }
     78 
     79 void() trif_stand = 
     80 {
     81 //	ai_stand();
     82 //	self.nextthink = time + 0.1;
     83 }
     84 
     85 void() trif_dead
     86 {
     87 	self.nextthink = time + 0.1;
     88 }
     89 
     90 
     91 void() trif_die =
     92 {
     93 	self.solid = SOLID_NOT;
     94 	self.frame = 1;
     95 	self.think = trif_dead;
     96 
     97 	self.nextthink = time + 0.1;
     98 }
     99 
    100 void(entity attacker, float damage) trif_pain =
    101 {
    102 
    103 }
    104 
    105 void() trif_walk =
    106 {
    107 
    108 }
    109 
    110 
    111 
    112 void() monster_scrambler =
    113 {
    114 	self.solid = SOLID_SLIDEBOX;
    115 	self.movetype = MOVETYPE_STEP;
    116 	self.yaw_speed = 20;
    117 	
    118 	setmodel (self, "models/spitter.iqm");
    119 	setsize(self, '-32 -32 0', '32 32 64');
    120 	self.health = 200;
    121 //	self.painchance = 5; no painchance var
    122 
    123 	self.th_stand = trif_stand;
    124 	self.th_walk = trif_walk;
    125 	self.th_run = trif_run;
    126 	self.th_die = trif_die;
    127 	self.th_pain = trif_pain;
    128 //	self.th_missile = trif_attack1;
    129 	self.th_missile = trif_testattack;
    130 
    131 	self.takedamage = DAMAGE_AIM;
    132 
    133 	self.think = monster_init;
    134 	self.nextthink = time + 0.1;
    135 
    136 };