View previous topic :: View next topic |
Author |
Message |
MDave

Joined: 17 Dec 2007 Posts: 75
|
Posted: Sun May 25, 2008 11:17 pm Post subject: bow and arrow problem |
|
|
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
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. |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Mon May 26, 2008 3:33 am Post subject: |
|
|
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 |
|
 |
scar3crow Inside3D Staff

Joined: 18 Jan 2005 Posts: 837 Location: Las Vegas, NV
|
Posted: Mon May 26, 2008 3:54 am Post subject: |
|
|
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 |
|
 |
MDave

Joined: 17 Dec 2007 Posts: 75
|
Posted: Mon May 26, 2008 9:24 am Post subject: |
|
|
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. |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Mon May 26, 2008 11:50 pm Post subject: |
|
|
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 |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Tue May 27, 2008 5:37 am Post subject: |
|
|
Can you post your modified W_Attack also? |
|
Back to top |
|
 |
MDave

Joined: 17 Dec 2007 Posts: 75
|
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Tue May 27, 2008 6:33 pm Post subject: |
|
|
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 |
|
 |
MDave

Joined: 17 Dec 2007 Posts: 75
|
Posted: Tue May 27, 2008 6:42 pm Post subject: |
|
|
I posted the player_arrow1 code in my first post
http://pastebin.com/m10c639c4
I'm using version 2.7. |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Tue May 27, 2008 6:50 pm Post subject: |
|
|
oh so you did. I was expecting an anim....Hmm. |
|
Back to top |
|
 |
Supa

Joined: 26 Oct 2004 Posts: 122
|
Posted: Tue May 27, 2008 7:30 pm Post subject: |
|
|
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 |
|
 |
MDave

Joined: 17 Dec 2007 Posts: 75
|
Posted: Tue May 27, 2008 10:30 pm Post subject: |
|
|
Thanks, that seems to have fixed it! I added other.think1=SUB_Null; in the 'execute_changelevel' function's while loop.
Many thanks!
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 |
|
 |
MDave

Joined: 17 Dec 2007 Posts: 75
|
Posted: Wed May 28, 2008 10:29 am Post subject: |
|
|
Damn, I thought It was fixed but I'm getting the error again  |
|
Back to top |
|
 |
MDave

Joined: 17 Dec 2007 Posts: 75
|
Posted: Wed May 28, 2008 2:55 pm Post subject: |
|
|
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
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 |
|
 |
|