Forum

SUB_regen... its there but wont do it

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

SUB_regen... its there but wont do it

Postby MeTcHsteekle » Thu Jul 17, 2008 1:05 am

i have been doing teh AIcafe` stuff but when i do the monster item roam it has a sub regen in it and frik gui has no idea what i doing say like this :

Code: Select all
//~~~~~~~~~~~~~~~~~~~~~
void() bot_grab_items =
//~~~~~~~~~~~~~~~~~~~~~
{
   if (self.goalentity == world)
      return;

   if (vlen(self.origin - self.goalentity.origin) <= 70)
      {
         self.goalentity.solid = SOLID_NOT;
         self.goalentity.model = string_null;
         self.goalentity.nextthink = time + 20;
         self.goalentity.think = SUB_regen;
         if (self.goalentity.healamount)
            sound(self, CHAN_ITEM,"items/health1.wav", 1,ATTN_NORM);
         else if (self.goalentity.weapon)
            sound(self, CHAN_ITEM,"weapons/pkup.wav", 1,ATTN_NORM);
         else
            sound(self, CHAN_ITEM,"items/armor1.wav", 1,ATTN_NORM);
         self.goalentity = world;
      }
};

ya and i get this warning
[quotewarning: Q206: subs.qc:25:SetMovedir: not all control paths return a value
warning: Q116: fight.qc:299:Local enemy_yaw redeclared
warning: Q202: ai.qc:368:FindTarget must return a value
error: Q505: ai.qc:479:Unknown value "SUB_regen"
warning: Q202: ai.qc:630:CheckAnyAttack must return a value]

ooooh a 505 :p gross
i am doing exactly as it says in tutorial and keeps getting this

i also get a diffrent one with the knight and the monster improvements where it stops the game and gives me a host error, but thats for lator :roll: [im still new to this modding..and quake in general][/quote]
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby Electro » Thu Jul 17, 2008 1:17 am

progs.src determines the order the compiler actually compiles the qc files.

When a function (or anything really) is unknown, it means it hasn't been declared/defined yet.

So in this case, you're trying to use SUB_regen before it is actually declared, meaning that your bot file is being compiled BEFORE SUB_regen even exists (items.qc would be further down in your progs.src)

To fix this, you can let the compiler know what the function is, and that it will be defined later on by doing:

Code: Select all
void() SUB_regen;


Put this above your bot_grab_items function. Be careful not to do this for functions that don't actually exist, because the compiler will spit errors at you more than a camel.
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 CocoT » Thu Jul 17, 2008 3:19 am

Image
Neurotic Conversions - New location: Update your bookmarks!
User avatar
CocoT
 
Posts: 695
Joined: Tue Dec 14, 2004 5:39 pm
Location: Belly-Gum

Postby Electro » Thu Jul 17, 2008 4:25 am

haha see! It's watching you MeTcHsteekle O_O
Even has the spit ready.
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 MeTcHsteekle » Thu Jul 17, 2008 5:06 am

heh gross

thanks guys it worked i moved items above ai cos i got more errors :P its a nice one cos the monsters that are to guard stay put most of time and the "fillers" roam :D
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby MeTcHsteekle » Thu Jul 17, 2008 5:47 am

ok now gots everything roaming round wooooooo :o

but i hast cought the error with the knight and the "improved monster ai" in deed it is improved but the knoght will stop game and gives this error

===== Output on Gyro frame: 3812 =====
You got the Double-barrelled Shotgun
You receive 25 health
You got armor
You got the shells
You got the shells
You got armor
CALL0 5366(?]
ai.qc : ai_run
knight.qc : knight_run7
<NO FUNCTION>
NULL function

===========================
Host_Error: Program error
===========================

]condump


i guess somthing to do with this
Code: Select all
void()   knight_run1   =[   $runb1,      knight_run2   ] {
if (random() < 0.2)
   sound (self, CHAN_VOICE, "knight/idle.wav", 1,  ATTN_IDLE);
ai_run(16);};
void()   knight_run2   =[   $runb2,      knight_run3   ] {ai_run(20);};
void()   knight_run3   =[   $runb3,      knight_run4   ] {ai_run(13);};
void()   knight_run4   =[   $runb4,      knight_run5   ] {ai_run(7);};
void()   knight_run5   =[   $runb5,      knight_run6   ] {ai_run(16);};
void()   knight_run6   =[   $runb6,      knight_run7   ] {ai_run(20);};
void()   knight_run7   =[   $runb7,      knight_run8   ] {ai_run(14);};
void()   knight_run8   =[   $runb8,      knight_run1   ] {ai_run(6);};


i guess i could replace the knight completlty with the grumbler [not init yet] but i happen to like the knight, so i dont know wut ta do :?

oh ya the tutorial is http://minion.planetquake.gamespy.com/t ... tutor2.htm

meh thinks...somthing :? :?

just ran it again and got similar :evil: but diffrent
You receive 25 health
You got armor
You got the shells
CALL0 5429(?]
ai.qc : ai_run
knight.qc : knight_run5
<NO FUNCTION>
NULL function

===========================
Host_Error: Program error
===========================

]condump
this time i also have http://minion.planetquake.gamespy.com/t ... stmons.htm on it also .. damn u knight why do u have to be so cool but not work :evil: :evil: :evil:
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby MeTcHsteekle » Thu Jul 17, 2008 6:33 am

perhaps there is a way to have the knoght void these feature?

like if classname == kinght

return?

i just noticed this in the frikgui
warning: Q206: subs.qc:25:SetMovedir: not all control paths return a value
warning: Q116: fight.qc:343:Local enemy_yaw redeclared
warning: Q105: items.qc:47:droptofloor: Too few parameters. See definition defs.qc(602)
warning: Q202: ai.qc:368:FindTarget must return a value
warning: Q202: ai.qc:631:CheckAnyAttack must return a value
warning: Q105: ai.qc:773:ai_back: Too few parameters. See definition ai.qc(430)
warning: Q116: weapons.qc:92:Local org redeclared
warning: Q206: client.qc:134:FindIntermission: not all control paths return a value
warning: Q105: monsters.qc:75:droptofloor: Too few parameters. See definition defs.qc(602)
warning: Q205: misc.qc:179:No operation performed
warning: Q105: misc.qc:249:droptofloor: Too few parameters. See definition defs.qc(602)
warning: Q105: misc.qc:281:droptofloor: Too few parameters. See definition defs.qc(602)
warning: Q105: misc.qc:536:makestatic: Too few parameters. See definition defs.qc(650)
warning: Q105: ogre.qc:305:ai_charge: Too few parameters. See definition fight.qc(201)
warning: Q105: soldier.qc:206:W_FireSpikes: Too few parameters. See definition weapons.qc(655)
warning: Q105: soldier.qc:211:W_FireSpikes: Too few parameters. See definition weapons.qc(655)
warning: Q206: wizard.qc:180:WizardAttackFinished: not all control paths return a value
warning: Q116: enforcer.qc:76:Local vec redeclared

thres alot i know, but perhaps that back one is a problem?
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby FrikaC » Thu Jul 17, 2008 4:18 pm

You receive 25 health
You got armor
You got the shells
CALL0 5429(?]
ai.qc : ai_run
knight.qc : knight_run5
<NO FUNCTION>
NULL function

===========================
Host_Error: Program error
===========================

]condump



This callstack means ai_run in ai.qc tried to call a function that doesn't exist. Likely, it's one of the .th_* fields you didn't fill in (ala th_pain or something.

As far as the warnings, they all look normal.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby MeTcHsteekle » Thu Jul 17, 2008 5:48 pm

...ok its only happing with the knights tho
Code: Select all
/*
=============
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(time < self.enemy.attack_finished)
      {
         ai_run_slide();
         return;
      }

   if(self.health < 25)
      {
         ai_back();
         self.th_missile();
         return;
      }

   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...
   makevectors(self.angles);
   self.flags = self.flags - (self.flags & FL_ONGROUND);
   self.velocity = v_forward * 200;
};



it seemes to happen when it attacks and has a corilation with the run anim. sequence


hmmm or i think, as i skimm thru knight qc it has no missile attack but only a melee and seeing the code above i se missile and run r liknked by ai_run_missile (); but then there is the melee right after that...so it cant be a problem? other wise soldier would crash it to because there is no melee for hmm :/ ill keep looking thru tho :?
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby FrikaC » Thu Jul 17, 2008 7:11 pm

MeTcHsteekle wrote:...ok its only happing with the knights tho


Okay the three th_ functions it calls are th_missile, th_walk and th_stand. Look in the spawn function for the enemy (monster_knight?) and see if those are filled in with something.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby MeTcHsteekle » Thu Jul 17, 2008 7:34 pm

i think these are them and this is wut i got
Code: Select all
   self.health = 75;

   self.th_stand = knight_stand1;
   self.th_walk = knight_walk1;
   self.th_run = knight_run1;
   self.th_melee = knight_atk1;
   self.th_pain = knight_pain;
   self.th_die = knight_die;
   
   walkmonster_start ();

   Gyro_Object_Activate(self, 190);
   Gyro_Object_SetBouyancy(self, 190*1.2);



ugh grabed a bit too much ill look for more of these and compare i
guess :?

//edit, i killed the problem

what caused the crash was when a monsters health was 25 or lower it would retreat and shoot at same time but fer some odd reason the knight does not have a th._missile so it coulden't shoot so it read that first i guess and messed it up

so i just removed the retreat {or ai_back} completly, thanks for helping me look at the th's :D
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest