Forum

bow and arrow problem

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

bow and arrow problem

Postby MDave » Sun May 25, 2008 11:17 pm

Hi there, I've had this problem for months and I still don't know how to fix it :( I have made a bow and arrow type weapon, and depending on its charge animation frame, shoots an arrow at a specific velocity. What the problem is, is soon after loading a map, and charging up an arrow, it crashes the server. But if I wait for a while, its safe to use it. It's been driving me nuts :shock:

Below is the code from weapons.qc

http://pastebin.com/m681eb311

And this is from player.qc

http://pastebin.com/m10c639c4

If this isn't enough information, I can provide a link to all my .qc files. I've got a few more bugs to handle too, but it might be asking for much to ask for help on those too :(

Thanks for reading.
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm

Postby Sajt » Mon May 26, 2008 3:33 am

Well, for one thing, you should not be using 'other' in Arrow_Explode (since you are using it as a delayed think function). Do 'self.enemy = other;' in arrow_f_touch(), and use that instead. Don't know if this is what is causing your crash though. Are you getting a useful error message, or is the crash completely mysterious?
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

Postby scar3crow » Mon May 26, 2008 3:54 am

Nothing to add, just wanted to point out Inside3d's own QC Pastebin - http://www.inside3d.com/pastebin.php

Be nice to see it used for something other than just keeping the spambots occupied =)
User avatar
scar3crow
InsideQC Staff
 
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Postby MDave » Mon May 26, 2008 9:24 am

scar3crow, thanks, I must of missed it somehow :)

Sajt wrote:Well, for one thing, you should not be using 'other' in Arrow_Explode (since you are using it as a delayed think function). Do 'self.enemy = other;' in arrow_f_touch(), and use that instead. Don't know if this is what is causing your crash though. Are you getting a useful error message, or is the crash completely mysterious?


Thanks for the tip!

Ahh sorry, forgot to post the error message:

"CALL0 14421(?]
: W_WeaponFrame
: PlayerPostThink
(NO FUNCTION)
NULL function
Host_Error : Program error"

EDIT: After further testing, it only seems to happen when you change level, and not when you use the map command or start a new game.
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm

Postby Sajt » Mon May 26, 2008 11:50 pm

Can you post the contents of W_WeaponFrame?

Also, what QCC compiler are you using? I think many of them (FTEQCC included) have an evil habit of warning when they should error. For example, you could call a nonexistant function (perhaps misspelled) and it would still compile. Are you getting any qcc compiler warnings?
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

Postby FrikaC » Tue May 27, 2008 5:37 am

Can you post your modified W_Attack also?
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby MDave » Tue May 27, 2008 6:05 pm

I'm using Frikqcc.

I posted the code in the pastebin:

http://www.inside3d.com/pastebin.php?ac ... ow&id=4491

and W_Attack here.

http://www.inside3d.com/pastebin.php?ac ... ow&id=4492

I apologise for the somewhat messy code, I'm not really a coder by nature.
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm

Postby FrikaC » Tue May 27, 2008 6:33 pm

player_arrow1 I assume is your new animation sequence. Post that code please? I suspect the error has to deal with the next function in the state macros. If there's a spelling or typo error in the name(s) of the functions in the state macros you can get a NULL function when it tries to call it.

Dunno why FrikQCC didn't error if that is the case however, which version of frikqcc are you using? (wish I never did all those hacks to make Nehahra compile and never reverted them, damnit)
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby MDave » Tue May 27, 2008 6:42 pm

I posted the player_arrow1 code in my first post :P

http://pastebin.com/m10c639c4

I'm using version 2.7.
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm

Postby FrikaC » Tue May 27, 2008 6:50 pm

oh so you did. I was expecting an anim....Hmm.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Supa » Tue May 27, 2008 7:30 pm

Code: Select all
    if (self.aflag == 1)         // make sure to fix downed gun

    {
        self.aflag = 0;         // no longer down

        self.think1();          // function called to raise gun

        self.think1=SUB_Null;   // reset pointer

    }

Just a guess - are you properly setting up self.think1 on changelevel? That could be why you're getting a null function error, if you're calling self.think1() and you haven't set it to anything yet (ie another weapon hasn't set it to SUB_Null/anything else yet).
User avatar
Supa
 
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Postby MDave » Tue May 27, 2008 10:30 pm

Thanks, that seems to have fixed it! I added other.think1=SUB_Null; in the 'execute_changelevel' function's while loop. :)

Many thanks! :D

I can get onto my next problem then.

How can I make my arrows and remote mines not stick to doors/platforms/trains? And fall down to the floor instead?
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm

Postby MDave » Wed May 28, 2008 10:29 am

Damn, I thought It was fixed but I'm getting the error again :(
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm

Postby MDave » Wed May 28, 2008 2:55 pm

Ok, I fixed it for good this time, just added:
Code: Select all
        self.aflag = 0;                 // we'll say gun isn't down yet
        self.think1=SUB_Null;         // so we don't need to raise it



before player_arrow1; in W_Attack :)

I also fixed my arrows and remote mines problem. Almost glitch free now! Now I just need to figure out the best way to stick remote mines onto players/monsters properly.
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm


Return to QuakeC Programming

Who is online

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