1

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... tongue

Mika.

2

Re: [HELP] Jump

Mika56 wrote:

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... tongue

Mika.

You mean after an amount of seconds the user jump's?
Don't know what you meaning roll

3

Re: [HELP] Jump

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 tongue

4

Re: [HELP] Jump

Anybody ?

Mika

5

Re: [HELP] Jump

Use at least translator. What do you want to do with jump? You want to know its values right?

Stay wild big_smile

6

Re: [HELP] Jump

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.

7

Re: [HELP] Jump

To jump player, its not right. Maybe to let player jump?

Stay wild big_smile

8

Re: [HELP] 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 >.>

9 (edited by Mika56 2009-07-10 16:12:10)

Re: [HELP] Jump

I don't understand at all sad

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)
}

10

Re: [HELP] Jump

I guess he want to make the player jump, server-side.

11

Re: [HELP] Jump

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,

12 (edited by Mika56 2009-07-10 22:04:08)

Re: [HELP] Jump

First, thank you, i'm sure i'm not far of what I want with you smile

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... yikes
Thank you a lot lxde