Forum

monster_dogs in QW?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby redrum » Wed Sep 26, 2007 4:44 pm

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


I only found Clientconnect() in client.qc.?

So I put it there, I'm still not spawning cujo.

Check this code for me:

Code: Select all
                void() monster_dog =                                                       //cujo
{
                self.solid = SOLID_SLIDEBOX;
                self.movetype = MOVETYPE_STEP;
                setmodel (self, "progs/dog.mdl");

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

                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();

                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);

};


This is at the end of void() PutClientInServer =

Getting an error:
error: expected;, found monster_dog
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 5:02 pm

Sorry, I got confused.
ClientConnect() is in client.qc, and add the code at the very bottom of ClientConnect():

Code: Select all
local entity dog, spot;                                                               
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);


You can't put any function inside another function.
Remove the code above from monster_dog(), and move monster_dog() out PutClientInServer(), move monster_dog() above PutClientInServer().

PS: Go to the PasteBin, that I've posted modified ai.qc, fight.qc and server.qc, otherwise you may get "function was not defined" errors.
Don't forget to backup the original ones.

ai.qc:
http://www.inside3d.com/pastebin.php?action=show&id=158

fight.qc:
http://www.inside3d.com/pastebin.php?action=show&id=159

server.qc:
http://www.inside3d.com/pastebin.php?action=show&id=160
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Wed Sep 26, 2007 8:17 pm

error: monster_dog redeclared, prev instance in dog.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 10:26 pm

Remove monster_dog from dog.qc.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Sep 27, 2007 3:45 am

No more errors! :D

No cujo :(
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 3:51 am

Have you put the specified code at the very bottom of ClientCommect() (client.qc)?

If you put, the dog won't spawn inside you, he'll spawn anywhere in the map, in any respawn spots. Mabe you didn't find one.
Just sometimes he'll spawn inside you, and when this occurs, he telefrags himself.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Sep 27, 2007 4:32 am

Here's my ClientConnect:

Code: Select all
void() ClientConnect =
{
        local entity dog, spot;                                                          //cujo
        ClientInRankings(); // FrikBot                                                   //frikbot
   bprint (PRINT_HIGH, self.netname);
   bprint (PRINT_HIGH, " entered Spisi's Fragfest!\n");
   
        // a client connecting during an intermission can cause problems
   if (intermission_running)
      GotoNextMap ();
        //stuffcmd(self, "impulse 100;\n");                                              //adds a bot when player connects to server


        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);

};


Server error message:

Client redrum connected
redrum entered Spisi's Fragfest!
CALL1 13912(visible)()
ai.qc : FindTarget
ai.qc : ai_stand
dog.qc : dog_stand1
<NO FUNCTION>
NULL function
SV_Error: Program error


BTW thanks for your time and patience! :)
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 4:37 am

Weird...
Try this:

At the very bottom of monster_dog there's a walkmonster_start() call.
Change it to walkmonster_start_go(); and add a (self.classname = "monster_dog";) line at the very top of monster_dog().
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Sep 27, 2007 4:50 am

Errors, (expected;, found self) here's the code:

Code: Select all
void() monster_dog =                                                                        //cujo
{
                self.classname = "monster_dog"
                self.solid = SOLID_SLIDEBOX;
                self.movetype = MOVETYPE_STEP;
                setmodel (self, "progs/dog.mdl");

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

                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_go();
           
};
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 4:59 am

The semicolon at the end of self.classname = "monster_dog" is missing, the emoticon hidden it.
It should be:

self.classname = "monster_dog";
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Sep 27, 2007 5:05 am

Damn, I should have noticed that!

Anyway, didn't work. Server error:

Client redrum connected
redrum entered Spisi's Fragfest!
walkmonster in wall at: ' 0.0 -142.0 -183.0'
CALL1 13912(visible)()
ai.qc : FindTarget
ai.qc : ai_stand
dog.qc : dog_stand6
<NO FUNCTION>
NULL function
SV_Error: Program error
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 » Thu Sep 27, 2007 5:12 am

Ok, I was able to log in without the server crashing. :)
I then switched to spectator mode. I saw cujo! :)
I then reconnected in normal mode. When I came into cujo's view it then crashed. :(
I tried it twice, and the same thing happened.
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 Preach » Thu Sep 27, 2007 9:53 am

The error seems to be suggesting that the function called "visible" is a null_function. That probably means you've made a prototype for the function but not actually defined it. If you add the "visible" function to the end of the ai file then it should prevent that crash.
Preach
 
Posts: 122
Joined: Thu Nov 25, 2004 7:20 pm

Postby Urre » Thu Sep 27, 2007 11:15 am

Is it even compileable without defining prototypes? Or maybe that's just a warning?
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Preach » Thu Sep 27, 2007 12:49 pm

Urre wrote:Is it even compileable without defining prototypes? Or maybe that's just a warning?


Pretty sure it's just a warning in fte and probably frikqcc since they support all the function pointers stuff. Prototyping is kinda like defining the function and assigning it a null pointer, then giving it the correct pointer when you actually define it (I'd imagine). Having a null pointer for a function might be useful for extension checking or something.
Preach
 
Posts: 122
Joined: Thu Nov 25, 2004 7:20 pm

PreviousNext

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest