Forum

monster attack weirdness

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

monster attack weirdness

Postby hondobondo » Wed Aug 31, 2016 3:13 pm

can anyone explain why this is happening?
https://youtu.be/Sw6gM46ppIQ
trying to create a new monster and his attack is coming from two different origins
here is the code:
Code: Select all
void (vector org, vector vec) LaunchBolt = {

   sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
   vec = normalize (vec);
   newmis = spawn ();
   newmis.owner = self;
   newmis.classname = "bolt";
   newmis.movetype = MOVETYPE_FLYMISSILE;
   newmis.solid = SOLID_BBOX;
   newmis.effects = EF_BRIGHTLIGHT;
   setmodel (newmis,"progs/bolt.mdl");
   setsize (newmis,VEC_ORIGIN,VEC_ORIGIN);
   setorigin (newmis,org);
   newmis.velocity = (vec * 1000.000);
   newmis.velocity = newmis.velocity + v_right*crandom()*50 + v_up*crandom()*50;
   newmis.angles = vectoangles (newmis.velocity);
   newmis.touch = T_BoltTouch;
   newmis.nextthink = time + 5;
   newmis.think     = SUB_Remove;

};
void () jesus_bolt =
{
   local vector dir;
   local entity en;

   ai_face ();
   //sound (self,CHAN_WEAPON,"weapons/spike2.wav",TRUE,ATTN_NORM);
   en = self.enemy;
   dir = (en.origin - (en.velocity * 0.200));
   dir = normalize ((dir - self.origin));
   LaunchBolt(self.origin+v_right*32+'0 0 64',dir);
};

void () monster_player_bolt1 = [103,monster_player_bolt2]{jesus_bolt();self.nextthink = time + 0.05;ai_face();};
void () monster_player_bolt2 = [104,monster_player_bolt3]{self.nextthink = time + 0.05;ai_face();};
void () monster_player_bolt3 = [103,monster_player_bolt4]{jesus_bolt();self.nextthink = time + 0.05;ai_face();};
void () monster_player_bolt4 = [104,monster_player_bolt5]{self.nextthink = time + 0.05;ai_face();};
void () monster_player_bolt5 = [103,monster_player_bolt6]{self.nextthink = time + 0.05;jesus_bolt();ai_face();};
void () monster_player_bolt6 = [104,monster_player_boss_run1]{self.nextthink = time + 0.05;SUB_CheckRefire(monster_player_bolt1); ai_face();};

i've tested it in darkplaces and enhanced glquake. same results. could it be the compiler? i'm using fteqcc
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Re: monster attack weirdness

Postby Spike » Wed Aug 31, 2016 5:43 pm

you don't have any call to makevectors.
this means the v_right/v_up vectors that you're using are basically undefined (depending on when it was last called, and by which entity).
Spike
 
Posts: 2853
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: monster attack weirdness

Postby hondobondo » Wed Aug 31, 2016 8:11 pm

true true
awesome now on to other things
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Re: monster attack weirdness

Postby hondobondo » Wed Aug 31, 2016 8:16 pm

i totally knew that
thanks spike
now i just need some jesus waves
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 2 guests