Topic: [HELP] Jump
Hi,
I'm doing a mod, and I have a problem :
I would love that, at a time (i know how to do), an user jump (and here, I don't know the function)
If any help me...
Mika.
You are not logged in. Please login or register.
Teeworlds Forum → Fan Art and Other → [HELP] Jump
Hi,
I'm doing a mod, and I have a problem :
I would love that, at a time (i know how to do), an user jump (and here, I don't know the function)
If any help me...
Mika.
Hi,
I'm doing a mod, and I have a problem :
I would love that, at a time (i know how to do), an user jump (and here, I don't know the function)If any help me...
Mika.
You mean after an amount of seconds the user jump's?
Don't know what you meaning
Not exactely that.
I just want the code to jump a player.
I think that the code is character->xxx, but I don't know what is exactely the code.
Mika.
Ps : Sorry, if you can't understand, but i'm french
Anybody ?
Mika
Use at least translator. What do you want to do with jump? You want to know its values right?
Using a translator is not necessarily better ...
What I seek is the command that will allow me to jump a player, for example, for those who know, the mod FNG, when unfreezed.
Mika.
To jump player, its not right. Maybe to let player jump?
oh the variable of the jump is in character.cpp jumped
0 means didn't jump
1 mean jumped one time
2 means jumped two times and cant jump again
and if u use windows you can use the search function to search in the files for a code >.>
I don't understand at all
This is what I do :
CHARACTER *victim = (CHARACTER *)game.players[client_id];
victim->jumped = 1;
(Where client_id is the id of the client)
But it doesn't work at all, the player doesn't jump.
Where is the wrong ?
Mika.
Edit : And i'm not sure you understand me too...
What i want is :
if(cond == true)
{
//Do a player jump (not playerS)
}
I guess he want to make the player jump, server-side.
The variable "jumped" indicates wether the player jumped already,
for example to handle air jumps.
It doesn't make a player jump if it is set.
The jump handling is done by the code in "src/game/gamecore.cpp",
in the function "void CHARACTER_CORE::tick(bool use_input)",line 219 to 239
[...]
// handle jump
if(input.jump)
{
if(!(jumped&1))
{
if(grounded)
{
triggered_events |= COREEVENT_GROUND_JUMP;
vel.y = -world->tuning.ground_jump_impulse;
jumped |= 1;
}
else if(!(jumped&2))
{
triggered_events |= COREEVENT_AIR_JUMP;
vel.y = -world->tuning.air_jump_impulse;
jumped |= 3;
}
}
}
else
jumped &= ~1;
[...]
On the server, this function is called in the file "src/game/server/entities/character.cpp",
function "void CHARACTER::tick()", line 544/545:
core.input = input;
core.tick(true);
This piece of code assigns the value of the input-variable of CHARACTER (file: "src/game/server/entites/character.hpp", line 265)
to the "input"-variable of CHARACTER_CORE (file: "src/game/gamecore.cpp", line 179).
When you want to make a player jump, you have to set the "jump" value of the "input" variable to true,
for example with this piece of code:
victim->input.jump = 1;
Sorry for the long post, hope it works,
First, thank you, i'm sure i'm not far of what I want with you
But i have a problem, the server crash when player must jump.
I've first thinked to a mistake var, but i didn't find the bug.
Here is the code used (no compilation problem)
CHARACTER *victim = (CHARACTER *)game.players[client_id];
victim->core.input.jump = 1;
victim->core.input.target_x = 0;
victim->core.input.target_y = 0;
victim->core.input.direction = 1;
victim->core.tick(true, client_id);
Thank for help,
Mika.
Edit : Work fine now, maybe a humain error...
Thank you a lot lxde
Teeworlds Forum → Fan Art and Other → [HELP] Jump
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.