Forum

monster_dogs in QW?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby FrikaC » Thu Sep 27, 2007 2:13 pm

It's returned as an error, not merely a warning in FrikQCC, because a prototype defines the variable as constant. Any constants not assigned a value at the end cause an error.
Last edited by FrikaC on Thu Sep 27, 2007 4:09 pm, edited 1 time in total.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby redrum » Thu Sep 27, 2007 2:17 pm

I'm confused. What should I do next?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby FrikaC » Thu Sep 27, 2007 2:33 pm

Make sure visible() from the ai.qc in the original Quake exists in your code, not merely as a prototype.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Orion » Thu Sep 27, 2007 2:52 pm

Oh, great.
Now I've seen my modified ai.qc at the PasteBin, and there's no visible() and infront() in there!

redrum: Paste visible() and infront() from your original ai.qc after range() from my modified ai.qc.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Sep 27, 2007 7:18 pm

Still crashing :cry:

Server error messages:

Client redrum connected
redrum entered Spisi's Fragfest!
walkmonster in wall at: '463.0 -543.0 185.0'
CALL1 13893(anglemod)()
ai.qc : FacingIdeal
ai.qc : ai_run_melee
ai.qc : ai_run
dog.qc : dog_run2
<NO FUNCTION>
NULL function
SV_Error: Program error


It seems once cujo senses me, it then crashes.

I have all those functions called in their respective files.
This is in ai.qc

Code: Select all
/*
============
FacingIdeal

============
*/
float() FacingIdeal =
{
   local   float   delta;
   
   delta = anglemod(self.angles_y - self.ideal_yaw);
   if (delta > 45 && delta < 315)
      return FALSE;
   return TRUE;
};


//=============================================================================

float()   DogCheckAttack;

float() CheckAnyAttack =
{
   if (!enemy_vis)
      return FALSE;
   if (self.classname == "monster_dog")
      return DogCheckAttack ();
   return CheckAttack ();
};


/*
=============
ai_run_melee

Turn and close until within an angle to launch a melee attack
=============
*/
void() ai_run_melee =
{
   self.ideal_yaw = enemy_yaw;
   ChangeYaw ();

   if (FacingIdeal())
   {
      self.th_melee ();
      self.attack_state = AS_STRAIGHT;
   }
};


/*
=============
ai_run_missile

Turn in place until within an angle to launch a missile attack
=============
*/
void() ai_run_missile =
{
   self.ideal_yaw = enemy_yaw;
   ChangeYaw ();
   if (FacingIdeal())
   {
      self.th_missile ();
      self.attack_state = AS_STRAIGHT;
   }
};


/*
=============
ai_run_slide

Strafe sideways, but stay at aproximately the same range
=============
*/
void() ai_run_slide =
{
   local float   ofs;
   
   self.ideal_yaw = enemy_yaw;
   ChangeYaw ();
   if (self.lefty)
      ofs = 90;
   else
      ofs = -90;
   
   if (walkmove (self.ideal_yaw + ofs, movedist))
      return;
      
   self.lefty = 1 - self.lefty;
   
   walkmove (self.ideal_yaw - ofs, movedist);
};


/*
=============
ai_run

The monster has an enemy it is trying to kill
=============
*/
void(float dist) ai_run =
{
   local   vector   delta;
   local   float   axis;
   local   float   direct, ang_rint, ang_floor, ang_ceil;
   
   movedist = dist;
// see if the enemy is dead
   if (self.enemy.health <= 0)
   {
      self.enemy = world;
   // FIXME: look all around for other targets
      if (self.oldenemy.health > 0)
      {
         self.enemy = self.oldenemy;
         HuntTarget ();
      }
      else
      {
         if (self.movetarget)
            self.th_walk ();
         else
            self.th_stand ();
         return;
      }
   }

   self.show_hostile = time + 1;      // wake up other monsters

// check knowledge of enemy
   enemy_vis = visible(self.enemy);
   if (enemy_vis)
      self.search_time = time + 5;

// look for other coop players
   if (coop && self.search_time < time)
   {
      if (FindTarget ())
         return;
   }

   enemy_infront = infront(self.enemy);
   enemy_range = range(self.enemy);
   enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
   
   if (self.attack_state == AS_MISSILE)
   {
//dprint ("ai_run_missile\n");
      ai_run_missile ();
      return;
   }
   if (self.attack_state == AS_MELEE)
   {
//dprint ("ai_run_melee\n");
      ai_run_melee ();
      return;
   }

   if (CheckAnyAttack ())
      return;               // beginning an attack
      
   if (self.attack_state == AS_SLIDING)
   {
      ai_run_slide ();
      return;
   }
      
// head straight in
   movetogoal (dist);      // done in C code...
};


and dog.qc...

Code: Select all
void() dog_run1      =[   $run1  ,   dog_run2   ] {
if (random() < 0.2)
   sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_run(16);};
void() dog_run2      =[   $run2  ,   dog_run3   ] {ai_run(32);};
void() dog_run3      =[   $run3  ,   dog_run4   ] {ai_run(32);};
void() dog_run4      =[   $run4  ,   dog_run5   ] {ai_run(20);};
void() dog_run5      =[   $run5  ,   dog_run6   ] {ai_run(64);};
void() dog_run6      =[   $run6  ,   dog_run7   ] {ai_run(32);};
void() dog_run7      =[   $run7  ,   dog_run8   ] {ai_run(16);};
void() dog_run8      =[   $run8  ,   dog_run9   ] {ai_run(32);};
void() dog_run9      =[   $run9  ,   dog_run10   ] {ai_run(32);};
void() dog_run10   =[   $run10  ,   dog_run11   ] {ai_run(20);};
void() dog_run11   =[   $run11  ,   dog_run12   ] {ai_run(64);};
void() dog_run12
Last edited by redrum on Thu Sep 27, 2007 7:38 pm, edited 2 times in total.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Thu Sep 27, 2007 7:35 pm

Redrum, I'm sorry.. I've taken off anglemod(), visible() and infront from my modified ai.qc to use with my bots...
Just paste this at the very top of ai.qc:

Code: Select all
float(float v) anglemod =
{
   while (v >= 360)
      v = v - 360;
   while (v < 0)
      v = v + 360;
   return v;
};


And to avoid the walkmonster in wall at 'origin', change the setsize() line at monster_dog to this:

Code: Select all
setsize (self, '-16 -16 -24', '16 16 40');


This will make the dog to don't get stuck in the wall.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby vegetous » Thu Sep 27, 2007 8:05 pm

User avatar
vegetous
 
Posts: 14
Joined: Wed Oct 25, 2006 2:51 am

Postby redrum » Tue Oct 02, 2007 4:15 am

Cujo is working great! Killing people at will! :D
One small problem. When Cujo telefrags a player it just says "you were telefragged by". How can I add "Cujo" to the end.

I tried this in ClientObituary:

Code: Select all
      if (attacker.classname == "teledeath" && (attacker.classname == "monster_dog"))   
      {
         bprint (PRINT_MEDIUM,targ.netname);
         bprint (PRINT_MEDIUM," was telefragged by ");
         bprint (PRINT_MEDIUM,attacker.owner.netname); ???
         bprint (PRINT_MEDIUM,"\n");
         return;
      }

Problem is Cujo doesn't have a .netname (I think this is the problem).
How can I get him one?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Tue Oct 02, 2007 4:20 am

At monster_dog(), add this line at the very top:

Code: Select all
self.netname = "Cujo";


This will give it a name to be displayed on the obituary.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Tue Oct 02, 2007 4:25 am

I actually figured that one out, got the same answer that you gave me! :shock:
Thanks.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Electro » Tue Oct 02, 2007 7:05 am

so cujo has turned out to be quite the best eh?

he ain't so tough
http://www.racingstable.com/sitebuildercontent/sitebuilderpictures/cujo.jpg NWS
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Postby redrum » Tue Oct 02, 2007 2:30 pm

Is that a dingo!? Scary!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Sajt » Tue Oct 02, 2007 3:14 pm

It looks like a killer breed of warrior wolf
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest