Reloading in Vanilla Quake with Animations?
Reloading in Vanilla Quake with Animations?
i have a reload code but how would i add animations to it?
Re: Reloading in Vanilla Quake with Animations?
err.. im not to sure on this but maybe something like
if (self.reloading == 1 && self.weapon == x)
{
self.weaponframe = x;
if (time == time + 1)
self.weaponframes = self.weaponframe + 1;
};
prolly wrong... but it would be the first something i would try off the top of my head.
prolly throw in a check that the frame number doesn go over a certain number and if it does return;?
if (self.reloading == 1 && self.weapon == x)
{
self.weaponframe = x;
if (time == time + 1)
self.weaponframes = self.weaponframe + 1;
};
prolly wrong... but it would be the first something i would try off the top of my head.
prolly throw in a check that the frame number doesn go over a certain number and if it does return;?
Re: Reloading in Vanilla Quake with Animations?
Mine looks like this:
The kar98k reloading animations starts at Frame 4 and ends at frame 17...
And yes, the code looks like a mess...
The kar98k reloading animations starts at Frame 4 and ends at frame 17...
And yes, the code looks like a mess...
Code: Select all
void() player_rkar98k1 = [$stand1, player_rkar98k2 ] {self.nextthink = time + 0.15; self.weaponframe=4;};
void() player_rkar98k2 = [$stand2, player_rkar98k3 ] {self.nextthink = time + 0.15; self.weaponframe=5;};
void() player_rkar98k3 = [$stand3, player_rkar98k4 ] {self.nextthink = time + 0.15; self.weaponframe=6;};
void() player_rkar98k4 = [$stand4, player_rkar98k5 ] {self.nextthink = time + 0.15; self.weaponframe=7;
sound (self, CHAN_WEAPON, "weapons/kar98k_reload.wav", 1, ATTN_NORM);}; //plays the Reloading Sound
void() player_rkar98k5 = [$stand5, player_rkar98k6 ] {self.nextthink = time + 0.15; self.weaponframe=8;};
void() player_rkar98k6 = [$stand5, player_rkar98k7 ] {self.nextthink = time + 0.15; self.weaponframe=9;};
void() player_rkar98k7 = [$stand5, player_rkar98k8 ] {self.nextthink = time + 0.15; self.weaponframe=10;};
void() player_rkar98k8 = [$stand5, player_rkar98k9 ] {self.nextthink = time + 0.15; self.weaponframe=11;};
void() player_rkar98k9 = [$stand5, player_rkar98k10] {self.nextthink = time + 0.15; self.weaponframe=12;};
void() player_rkar98k10 = [$stand5, player_rkar98k11] {self.nextthink = time + 0.15; self.weaponframe=13;};
void() player_rkar98k11 = [$stand5, player_rkar98k12] {self.nextthink = time + 0.15; self.weaponframe=14;};
void() player_rkar98k12 = [$stand5, player_rkar98k13] {self.nextthink = time + 0.15; self.weaponframe=15;};
void() player_rkar98k13 = [$stand5, player_rkar98k14] {self.nextthink = time + 0.15; self.weaponframe=16;};
void() player_rkar98k14 = [$stand5, player_run ] {self.nextthink = time + 0.15; self.weaponframe=17;};
Re: Reloading in Vanilla Quake with Animations?
According to the docs, fteqcc can do ...
If so and if using that compiler, it may be possible to really streamline that code ...
Code: Select all
#define name(a,b) ((a)*(b))
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Re: Reloading in Vanilla Quake with Animations?
i should really learn quake animation macro's i just dont like them.
Re: Reloading in Vanilla Quake with Animations?
I made a nice system for my game that handles the weaponframes. It is built from 2 functions. First one is called whenever you want to update the frames (like at the start of reload). You can set starting frame, ensing frame, speed of animation, function to be called during or at the end of animation (useful for stuf like reload canceling, weapons that has animation before the actual fire). Second function is called every frame and updates the frames (usualy every 0.1 secpnds (or what ever quake time) but incase i have speeden
Or slowen the frame then at that time of course. It also calls the function i have assinged with the animation at given frame/end of the animation. Prety cool system
That doesnt require macro stuff or interfence
With player
Frames
And not hard to code at all
Or slowen the frame then at that time of course. It also calls the function i have assinged with the animation at given frame/end of the animation. Prety cool system
That doesnt require macro stuff or interfence
With player
Frames
And not hard to code at all
-
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Re: Reloading in Vanilla Quake with Animations?
There is actually a simpler way to use Quake's animation macros...ceriux wrote:i should really learn quake animation macro's i just dont like them.
Code: Select all
$frame reload1 reload2
void() player_reload1 = [$reload1, player_reload2] {self.weaponframe = 10;}; //Replace 10 with your start frame.
void() player_reload2 = [$reload2, player_reload3] {self.weaponframe = (self.weaponframe + 1);}; //This advances the frame count by 1.
void() player_reload3 =
{
if(self.weaponframe == 17) //If the animation has reached its end....
{
self.weaponframe = 0; //Set the frame back to the idle frame.
return; //Exit this function.
}
else //If the animation still has some frames left to play...
{
player_reload2(); //Continue the animation..
return; //Exit this function.
}
};
This isn't the best way to play animations, but if you're like me, and you like to keep things somewhat similar to the way that they were originally written, then this is the way to go..
EDIT: You can also add nextthinks to the animations to either speed up the rate at which frames are played, or slow them down. Like this:
Code: Select all
void() player_reload1 = [$reload1, player_reload2]
{
self.weaponframe = 10;
self.nextthink = (time + 0.03);
};
Last edited by DusterdooSmock on Fri Jan 13, 2012 8:55 pm, edited 1 time in total.
Re: Reloading in Vanilla Quake with Animations?
Nice..
BTW: Do you have problems when picking up ammo or new weapons?
My reloading animations are stopping when i picking up ammo and i still dont know how i can fix this the easy way xD
BTW: Do you have problems when picking up ammo or new weapons?
My reloading animations are stopping when i picking up ammo and i still dont know how i can fix this the easy way xD
-
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Re: Reloading in Vanilla Quake with Animations?
You would have to use a "reload_time" float or something similar.dr_mabuse wrote:Nice..
BTW: Do you have problems when picking up ammo or new weapons?
My reloading animations are stopping when i picking up ammo and i still dont know how i can fix this the easy way xD
Code: Select all
.float reload_time;
Code: Select all
void() player_reload2 = [$reload2, player_reload3]
{
self.weaponframe = (self.weaponframe + 1);
self.reload_time = (time + 0.2);
self.nextthink = (time + 0.03);
};
The reason I used 0.2 for "reload_time" is because every time the frame is advanced, the "reload_time" will be reset. It is best to add the "reload_time" line to every function in your animation so that there will be a final delay of 0.2 when the animation is finished. It makes it look nicer.
And in your W_WeaponFrame function, you would have something like this:
Code: Select all
if(self.reload_time > time)
return;
Re: Reloading in Vanilla Quake with Animations?
thanks, i will try it, finally something i can use
My little mod will have pickupable items like original Quake (ammo, weapons etc..), and everytime i reload and pick up ammo some seconds later the animations will stop...
But i think your post will help me
My little mod will have pickupable items like original Quake (ammo, weapons etc..), and everytime i reload and pick up ammo some seconds later the animations will stop...
But i think your post will help me
-
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Re: Reloading in Vanilla Quake with Animations?
No problem, but you may also want to check your weapon pickup functions for anything related to the players .weaponframe, or anything related to "player_run", and remove it, as it could be setting the frames back to 0, and or pausing them, depending on how your systems for animations and weapon pickups work.dr_mabuse wrote:thanks, i will try it, finally something i can use
My little mod will have pickupable items like original Quake (ammo, weapons etc..), and everytime i reload and pick up ammo some seconds later the animations will stop...
But i think your post will help me