Inside3D!
     

bow and arrow problem

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
MDave



Joined: 17 Dec 2007
Posts: 75

PostPosted: Sun May 25, 2008 11:17 pm    Post subject: bow and arrow problem Reply with quote

Hi there, I've had this problem for months and I still don't know how to fix it Sad 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 Shocked

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 Sad

Thanks for reading.
Back to top
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon May 26, 2008 3:33 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
scar3crow
Inside3D Staff


Joined: 18 Jan 2005
Posts: 837
Location: Las Vegas, NV

PostPosted: Mon May 26, 2008 3:54 am    Post subject: Reply with quote

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 =)
Back to top
View user's profile Send private message AIM Address
MDave



Joined: 17 Dec 2007
Posts: 75

PostPosted: Mon May 26, 2008 9:24 am    Post subject: Reply with quote

scar3crow, thanks, I must of missed it somehow Smile

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.
Back to top
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon May 26, 2008 11:50 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Tue May 27, 2008 5:37 am    Post subject: Reply with quote

Can you post your modified W_Attack also?
Back to top
View user's profile Send private message Send e-mail
MDave



Joined: 17 Dec 2007
Posts: 75

PostPosted: Tue May 27, 2008 6:05 pm    Post subject: Reply with quote

I'm using Frikqcc.

I posted the code in the pastebin:

http://www.inside3d.com/pastebin.php?action=show&id=4491

and W_Attack here.

http://www.inside3d.com/pastebin.php?action=show&id=4492

I apologise for the somewhat messy code, I'm not really a coder by nature.
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Tue May 27, 2008 6:33 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message Send e-mail
MDave



Joined: 17 Dec 2007
Posts: 75

PostPosted: Tue May 27, 2008 6:42 pm    Post subject: Reply with quote

I posted the player_arrow1 code in my first post Razz

http://pastebin.com/m10c639c4

I'm using version 2.7.
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Tue May 27, 2008 6:50 pm    Post subject: Reply with quote

oh so you did. I was expecting an anim....Hmm.
Back to top
View user's profile Send private message Send e-mail
Supa



Joined: 26 Oct 2004
Posts: 122

PostPosted: Tue May 27, 2008 7:30 pm    Post subject: Reply with quote

Code:
    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).
Back to top
View user's profile Send private message Send e-mail
MDave



Joined: 17 Dec 2007
Posts: 75

PostPosted: Tue May 27, 2008 10:30 pm    Post subject: Reply with quote

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

Many thanks! Very Happy

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?
Back to top
View user's profile Send private message
MDave



Joined: 17 Dec 2007
Posts: 75

PostPosted: Wed May 28, 2008 10:29 am    Post subject: Reply with quote

Damn, I thought It was fixed but I'm getting the error again Sad
Back to top
View user's profile Send private message
MDave



Joined: 17 Dec 2007
Posts: 75

PostPosted: Wed May 28, 2008 2:55 pm    Post subject: Reply with quote

Ok, I fixed it for good this time, just added:
Code:

        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 Smile

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group