View previous topic :: View next topic |
Author |
Message |
Ghost_Fang
Joined: 12 Nov 2009 Posts: 162
|
Posted: Thu Nov 12, 2009 4:41 am Post subject: Weapon Reload |
|
|
I've for been looking for a while, and im sorry if i missed it.
I am not a QC coder, but our dev team doesnt have a coder at the moment so all i am doing is following tutorials and copying and pasting provided codes until we get a coder for our mod.
I can't find reload anywhere.
Could someone point me in the direction of a tutorial that would show me how to add reload to vanilla quake. And/or to add the reload frames to the weapon models.
Thank you. |
|
Back to top |
|
 |
r00k
Joined: 13 Nov 2004 Posts: 483
|
Posted: Thu Nov 12, 2009 5:15 am Post subject: |
|
|
What MOD are you supporting?
I'm asking for engine support as well. This narrows down the QC side of help. If its a PSP mod then it would need basic QuakeC features. And your query is easily do able in basic quakec.
Check out player.qc for animations. Normal FPS is 10fps for Quake. |
|
Back to top |
|
 |
Ghost_Fang
Joined: 12 Nov 2009 Posts: 162
|
Posted: Thu Nov 12, 2009 5:20 am Post subject: |
|
|
well, its for jailbroken iphones. I dont know if you have heard quake4iphone? Well it was the original shareware quake ported to iphone. And thats the source I'm using, original quake.
I don't know anything about QC syntax or anything like that. I would need the actual code and be told where to put it and thats all im asking. And if possible how to add the reloading animations as well. If its all in one code thats even better. |
|
Back to top |
|
 |
lth

Joined: 11 Nov 2004 Posts: 129
|
Posted: Fri Nov 13, 2009 2:04 pm Post subject: |
|
|
Adding the QC for reloading to the original QC code is a relatively simply task. Here's how I'd add reloading to the shotgun, off the top of my head:
Open up defs.qc and add a line at the bottom:
Code: | .float ammo_shotgun; |
In weapons.qc:
- In W_SetCurrentAmmo for the shotgun, change
Code: | self.currentammo = self.ammo_shells |
to:
Code: | self.currentammo = self.ammo_shotgun; |
- Add a new impulse to ImpulseCommands:
Code: | if (self.impulse==23) // or whatever number
{
if (self.weapon == IT_SHOTGUN)
{
if (self.ammo_shells < 8)
{
self.currentammo = self.ammo_shotgun = self.ammo_shells;
self.ammo_shells = 0;
}
else
{
self.currentammo = self.ammo_shotgun = 8;
self.ammo_shells = self.ammo_shells - 8;
}
}
} |
You'd need to muck about in client.qc too to handle level transitions properly, but I can't really remember how to do that offhand.
Building the actual reload animations would be an immense pain in the arse and I doubt anyone is going to volunteer to do them for you. Good luck with that... _________________ randomviolence - tactical combat boardgame |
|
Back to top |
|
 |
Ghost_Fang
Joined: 12 Nov 2009 Posts: 162
|
Posted: Sun Nov 15, 2009 9:50 pm Post subject: |
|
|
it sort of worked, it just didnt start loaded, but i could just do a simple autoexec for that.
As for the animation, couldnt i just add the frames to the model,
(reload1 reload2 reload3 etc)
Then add them in the weapons.qc
then set it so that not only impulse 23 reloads, it plays the reload animation. Wouldnt that work? |
|
Back to top |
|
 |
lth

Joined: 11 Nov 2004 Posts: 129
|
Posted: Sun Nov 15, 2009 10:03 pm Post subject: |
|
|
Quote: | it sort of worked, it just didnt start loaded, but i could just do a simple autoexec for that. |
You probably want to set it up so that when you start a new game, it starts loaded, but if you go to the next level it either maintains its loaded state, or becomes fully loaded, taking any required ammo out of your shells supply. That would mean fiddling with *ChangeParms in client.qc, ideally.
Quote: | As for the animation, couldnt i just add the frames to the model,
(reload1 reload2 reload3 etc)
Then add them in the weapons.qc
then set it so that not only impulse 23 reloads, it plays the reload animation. Wouldnt that work? |
Indeed, that's exactly what you'd need to do. You probably want to set:
Code: | self.attack_finished = time + 0.5; |
in your new reload function too. That's also where you'd start off the animation (and play a sound if you want), and by setting an attack_finished time you prevent the player from shooting or changing weapon while the reload animation is in progress. _________________ randomviolence - tactical combat boardgame |
|
Back to top |
|
 |
Ghost_Fang
Joined: 12 Nov 2009 Posts: 162
|
Posted: Sun Nov 15, 2009 11:30 pm Post subject: |
|
|
Im not that experienced coder at all, how would i go about making the reload thingy with animation and sound based on the current code you gave me. level transitions arent an issue atm.
Could you just give me code and tell me where to put it and that be it? |
|
Back to top |
|
 |
UrbanKid
Joined: 22 Aug 2008 Posts: 44
|
Posted: Wed Nov 18, 2009 9:40 am Post subject: O a |
|
|
o a reload code....i could use some help for csportable i want to add more frames for all my custom animated weapons in the game
this could help thanks. |
|
Back to top |
|
 |
lth

Joined: 11 Nov 2004 Posts: 129
|
Posted: Wed Nov 18, 2009 10:11 am Post subject: |
|
|
Ghost_Fang:
If you actually want to mod Quake, you're going to have to learn how to mod Quake! No-one else is going to do it all for you
If you're not bothered about level transitions at the moment, then go to PutClientInServer in client.qc and add:
Code: | self.ammo_shotgun = 8; |
Somewhere before W_SetCurrentAmmo. PutClientInServer is the function that is called whenever a player starts a level, so anything you want all players to have when they start should go in here. Notice that PutClientInServer also does stuff like set the player's health and max_health, their model, and spawns a teleflash if necessary.
For the reload animations, first you'll need to get qMe or other model editor and actually make the animation frames showing the weapon doing what you want. After you've done that, I can show you how to add the reloading animations to the game. _________________ randomviolence - tactical combat boardgame |
|
Back to top |
|
 |
UrbanKid
Joined: 22 Aug 2008 Posts: 44
|
Posted: Wed Nov 18, 2009 11:59 am Post subject: yes i have a model |
|
|
i converted glock pistol from cs and i wanted to add full firing animations and reload animations
oh yeah i always check the forums every 5minutes or less
http://www.sendspace.com/file/y5mmkm |
|
Back to top |
|
 |
lth

Joined: 11 Nov 2004 Posts: 129
|
|
Back to top |
|
 |
UrbanKid
Joined: 22 Aug 2008 Posts: 44
|
Posted: Thu Nov 19, 2009 1:51 am Post subject: thanks |
|
|
...edited.....
i have encountered this problem
Quote: | compiling csportable/cspplayer.qc
in function player_reloadk39 (line 939),
csportable/cspplayer.qc:939: error: Unknown frame macro $stand41
in function player_reloadk40 (line 940),
csportable/cspplayer.qc:940: error: Unknown frame macro $stand42
in function player_reloadk41 (line 941),
csportable/cspplayer.qc:941: error: Unknown frame macro $stand43
in function player_reloadk42 (line 942),
csportable/cspplayer.qc:942: error: Unknown frame macro $stand44
in function player_reloadk43 (line 943),
csportable/cspplayer.qc:943: error: Unknown frame macro $stand45
in function player_reloadk44 (line 944),
csportable/cspplayer.qc:944: error: Unknown frame macro $stand46
in function player_reloadk45 (line 945),
csportable/cspplayer.qc:945: error: Unknown frame macro $stand47
in function player_reloadk46 (line 946),
csportable/cspplayer.qc:946: error: Unknown frame macro $stand48
in function player_reloadk47 (line 947),
csportable/cspplayer.qc:947: error: Unknown frame macro $stand49
in function player_reloadk48 (line 948),
csportable/cspplayer.qc:948: error: Unknown frame macro $stand50
in function player_reloadk49 (line 949),
csportable/cspplayer.qc:949: error: Unknown frame macro $stand51
************ ERROR ************
Errors have occured
|
|
|
Back to top |
|
 |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Mon Nov 23, 2009 11:03 pm Post subject: |
|
|
I'm no expert, but I'm guessing you didn't precache. _________________ Welcome to the Overlook Hotel 69.113.123.178:27500 |
|
Back to top |
|
 |
Dr. Shadowborg Inside3D Staff

Joined: 16 Oct 2004 Posts: 726
|
Posted: Tue Nov 24, 2009 12:09 am Post subject: |
|
|
Actually it looks more like he didn't define his frame macros in the cspplayer.qc file.
Look at player.qc in stock quakec to see how your supposed to define frame macros. Also keep in mind that frame macros define starting from frame 0. Any additional frame macros defined will advance from that. Also, frame macros will ONLY apply within the scope of the file you've defined them in. Try to use them in another file, and it won't work. (You CAN however redefine them inside that file and then it will work.) _________________ "Roboto suggests Plasma Bazooka." |
|
Back to top |
|
 |
UrbanKid
Joined: 22 Aug 2008 Posts: 44
|
Posted: Tue Nov 24, 2009 7:14 am Post subject: o |
|
|
ok....thanks! |
|
Back to top |
|
 |
|