Forum

monster_dogs in QW?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

monster_dogs in QW?

Postby redrum » Mon Sep 24, 2007 11:30 pm

Is it at all possible to spawn a rotweiler in QW?
I tried adding dog.qc and monsters.qc.
I precached the .wavs and .mdl files in world.qc.
It won't compile.

Am I barking up the wrong tree?
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 leileilol » Tue Sep 25, 2007 12:17 am

We aren't psychic. Post error messages.
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Orion » Tue Sep 25, 2007 1:04 am

Have you ONLY added dog.qc and monsters.qc??
Man, that's why it won't compile. You should add fight.qc, and ai.qc too.

In progs.src the 4 files should be in this order:

Code: Select all
fight.qc
ai.qc
monsters.qc
dog.qc


I hope it works... If you receive any other error, post them here and we will help you.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Tue Sep 25, 2007 3:21 am

Ok, I added the other 2 .qc files.
Still getting an error though.
The error is:

couldn't open file fight.qc
error in misc.qc on line 732


I tried moving the 4 files (fight.qc, ai.qc, monsters.qc, and dog.qc) around in progs.src. Always returns the same error with the exception of it's always an error in a different file. But it's always the file that preceeds these 4 new ones.
I got the fight.qc from this website. Could it be corrupt?
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 redrum » Tue Sep 25, 2007 3:42 am

ok, rookie mistake. had the file named wrong.
Still errors though.

compiling fight.qc
in function CheckAttack (line 56),
fight.qc:123: error: unknown value "SUB_AttackFinished".
in function SoldierCheckAttack (line 234),
fight.qc:123: error: unknown value "SUB_AttackFinished".
in function ShamCheckAttack (line 293),
fight.qc:298: warning: Local "enemy_yaw" defined with name of a global
fight.qc:339: error: unknown value "SUB_AttackFinished".
in function OgreCheckAttack (line 353),
fight.qc:405: error: unknown value "SUB_AttackFinished".


So then I added soldier.qc, shambler.qc, and ogre.qc to progs.src below dog.qc. That didn't help though :(
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 Sep 25, 2007 4:07 am

Well, take out the shambler, ogre and soldier from progs.src.
SUB_AttackFinished() isn't used in QW, but you can make a new one.
Paste this code at the very bottom of subs.qc:

Code: Select all
void(float normal) SUB_AttackFinished =
{
   self.cnt = 0;   // refire count for nightmare
   if (skill != 3)
      self.attack_finished = time + normal;
};
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Tue Sep 25, 2007 4:33 pm

ok, couple more errors:

compiling subs.qc
in function SetMovedir (line 12),
subs.qc:25: warning: SetMovedir: not all control paths return a value
in function SubAttackFinished (line 287),
subs.qc:290: error: unknown value "skill".
subs.qc:290: error: type mismatch for != (_variant and float)


Remember I have FrikbotX installed. I guess that's where the "skill" error is coming from.

Is this what the bottom of subs.qc should look like::


Code: Select all
//
// fire targets
//
   if (self.target)
   {
      act = activator;
      t = world;
      do
      {
         t = find (t, targetname, self.target);
         if (!t)
         {
            return;
         }
         stemp = self;
         otemp = other;
         self = t;
         other = stemp;
         if (self.use != SUB_Null)
         {
            if (self.use)
               self.use ();
         }
         self = stemp;
         other = otemp;
         activator = act;
      } while ( 1 );
   }
   

};

void(float normal) SUB_AttackFinished =
{
   self.cnt = 0;      // refire count for nightmare
   if (skill != 3)
      self.attack_finished = time + normal;
};
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 Sep 25, 2007 4:53 pm

Open defs.qc and add this to the very bottom:

Code: Select all
float skill;


Now at StartFrame() in world.qc add this:

Code: Select all
skill = cvar("skill");


"skill" cvar will be updated every frame now.
You can add the line anywhere in StartFrame(), I reccomend adding after the cvar declarations.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Tue Sep 25, 2007 9:27 pm

Thanks Orion!
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 redrum » Wed Sep 26, 2007 12:15 am

Ok, it's all compiled but it added 38 more warnings.

Now I'm trying to get a dog to spawn each time a client logs into the server. How is this done?

I tried adding this code in PutClientInServer:

Code: Select all
void() monster_dog =
{
   if (deathmatch)
   {
      remove(self);
      return;
   }
   precache_model ("progs/h_dog.mdl");
   precache_model ("progs/dog.mdl");

   precache_sound ("dog/dattack1.wav");
   precache_sound ("dog/ddeath.wav");
   precache_sound ("dog/dpain1.wav");
   precache_sound ("dog/dsight.wav");
   precache_sound ("dog/idle.wav");

   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_STEP;

   setmodel (self, "progs/dog.mdl");

   setsize (self, '-32 -32 -24', '32 32 40');
   self.health = 25;

   self.th_stand = dog_stand1;
   self.th_walk = dog_walk1;
   self.th_run = dog_run1;
   self.th_pain = dog_pain;
   self.th_die = dog_die;
   self.th_melee = dog_atta1;
   self.th_missile = dog_leap1;

   walkmonster_start();
};


getting a bunch of errors though.
Then I tried adding just this:

Code: Select all
monster_dog ();


No luck there either.
Obviously, I'm new at this. I wish I was grasping this a little better.
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 » Wed Sep 26, 2007 1:04 am

Remove the (if (deathmatch)) stuff, otherwise the dog won't work for deathmatch.

You have put monster_dog or dog.qc before client.qc right?

The precaches you should put at the very end of worldspawn() in world.qc or at W_Precache() in weapons.qc, because you can only do precaches in spawn functions, worldspawn() is called by the engine itself, and W_Precache() is called by worldspawn().

So, a spawn function is a function called by the engine iteself or by worldspawn(). An ammo box for example is spawned by worldspawn(), you won't find any item stuff in worldspawn(), but they're "owned" by worldspawn.

You should do the following:

Add this code at the very end of PutClientInServer():

Code: Select all
local entity dog;
dog = spawn ();
spot = SelectSpawnPoint ();
dog.origin = spot.origin;
dog.nextthink = time + 0.1;
dog.think = monster_dog;
spawn_tfog (dog.origin);
spawn_tdeath (dog.origin, dog);


There's already a SelectSpawnPoint() call at the top of the function, but we should call another one otherwise the dog will spawn inside you. I've added a tfog flash and a tdeath, that will telefrag anyone who is stuck in it.

Just a recap, do you want to spawn a dog every time a client connects to a server or every time a client respawns?

If you want every time a client connects, you should add all that stuff at the very top of ClientConnect() in client.qc, and remove'em from PutClientInserver().

And don't forget to create a (local entity dog, spot;) line to don't get errors.

PutClientInServer() is called everytime a client respawns (see respawn()), not when a client connects.

Good luck with your mod! :)
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Wed Sep 26, 2007 2:05 am

Two steps forward, one step backward.
So I moved the 4 new .qc files above client.qc in progs,src.
Two new errors:

unknown value "ThrowGib". and
unknown value "ThrowHead".


in dog.qc, function dog_die.

And don't forget to create a (local entity dog, spot;) line to don't get errors.


What do you mean by this? Is this for defs.qc?
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 » Wed Sep 26, 2007 2:20 am

Add this at the very top of dog.qc:

Code: Select all
void(string gibname, float dm) ThrowGib;
void(string gibname, float dm) ThrowHead;


The entities should be at the very top of ClientConnect() in world.qc, not defs.qc.

Code: Select all
void() ClientConnect =
{
   local entity dog, spot;


The start of the function should look like the code above.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby Electro » Wed Sep 26, 2007 3:13 am

cujo!
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 » Wed Sep 26, 2007 4:04 am

OK, thanks. Try it out tomorrow.
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

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest