Hello Phenom,
I am not a good coder, but I want to try to help you with that "jump" idea.
I think it is a great idea.
First of all, be aware, that the jump code is not inside "player.qc". It is declared inside "client.qc"
So what you want to do first, open that file and go to function: PlayerJump ()
It is called every frame via: PlayerPreThink() by the way.
Read through it and you will see what happens when you are inside water and so on.
Lets say you only want to make your "front flip" when you are out of water.
So scroll down til the very end of that function and add:
Now, to be able to compile your new code later on, you need to know that "client.qc" is read before "player.qc"
during compilation (because this order is declared inside "progs.scr" ).
So what you need to do now is to add one single line on the very top of the file "client.qc":
So that the compiler already knows the new function which we will add later on.
That is all you need to do to "client.qc".
Next is the file "player.qc".
Open it and go to the very end of it.
Here you need to add these lines:
Code: Select all
$frame jump jump1 jump2 jump3 jump4 jump5 jump6 jump7 jump8 jump9 jump10 // these are your new animation frames, as you told us.
void() player_flip1 = [ $jump, player_flip2 ] {};
void() player_flip2 = [ $jump1, player_flip3 ] {};
void() player_flip3 = [ $jump2, player_flip4 ] {};
void() player_flip4 = [ $jump3, player_flip5 ] {};
void() player_flip5 = [ $jump4, player_flip6 ] {};
void() player_flip6 = [ $jump5, player_flip7 ] {};
void() player_flip7 = [ $jump6, player_flip8 ] {};
void() player_flip8 = [ $jump7, player_flip9 ] {};
void() player_flip9 = [ $jump8, player_flip10 ] {};
void() player_flip10 = [ $jump9, player_flip11 ] {};
void() player_flip11 = [ $jump10, player_run ] {};
Be aware though that there is an automatic "nextthink" of 0.1 second between each frame.
That means, your 11 frame jump animation is long. "Maybe" too long.
You maybe will still make your flip, when you already landed.
So try to shorten your animation if it is the case.
If it is not the case, then your new code should work.
That is it.
I just tested it with the original "axedeath" player animation. LOOL
Everytime I jumped, the player died midair, hehe.
Of course my knowledge is very limited, so there is most probably a better way in doing it.
But at least you can now start to flip around in Quake
PS: You can of course add a ninja scream during your flip animation.
If you want, just add a sound line into the second or third frame:
Example:
Code: Select all
sound (self, CHAN_VOICE, "player/ninja_scream.wav", 1, ATTN_NORM);
Put the .wav file "ninja_scream.wav" into your subfolder: ID1\sound\player
If you want to spawn the scream not everytime you jump, but only every 25% or so,
you need to add a random line to do it.
This would be your final code in "player.qc" then:
Code: Select all
$frame jump jump1 jump2 jump3 jump4 jump5 jump6 jump7 jump8 jump9 jump10 // these are your new animation frames, as you told us.
void() player_flip1 = [ $jump, player_flip2 ] {};
void() player_flip2 = [ $jump1, player_flip3 ] {
local float zufall;
zufall = random();
if (zufall < 0.25)
sound (self, CHAN_VOICE, "player/ninja_scream.wav", 1, ATTN_NORM);
};
void() player_flip3 = [ $jump2, player_flip4 ] {};
void() player_flip4 = [ $jump3, player_flip5 ] {};
void() player_flip5 = [ $jump4, player_flip6 ] {};
void() player_flip6 = [ $jump5, player_flip7 ] {};
void() player_flip7 = [ $jump6, player_flip8 ] {};
void() player_flip8 = [ $jump7, player_flip9 ] {};
void() player_flip9 = [ $jump8, player_flip10 ] {};
void() player_flip10 = [ $jump9, player_flip11 ] {};
void() player_flip11 = [ $jump10, player_run ] {};
Good luck with your mod Phenom.
Best wishes,
Seven