Landing event

Piccolo

Well-known member
Hello,

What is the best way to check for something when a player lands ?

First I thought of simply running a function in jumpland animation, but that's not the only way some characters can land on something.

Can't figure a way to handle this with onemovea script event either.

(FYI I want to check if player landed on a platform or on the ground. Code works but I just don't know where to trigger it).

Thanks.
 
Thanks, I wasn't aware of the "base" property.

Though that doesn't really help solving the whole issue, or does it ? I still can't tell if just landed on a platform.
 
put the code in jumpland anim. If the entity has landed in something, but its A property is different than "BASE" property, then the entity is over a platform.
 
Yes, but as I said in the first post, characters doesn't always land with jumpland (which is the core of my problem). For example, when a character use a charge in air, the charge continue a bit after landing (~ sliding effect), so jumpland anim never plays.
 
Any animation with the potential to slide or otherwise override jumpland should get a landframe. This will solve most of your problems and look better to boot.

DC
 
Code:
int is_on_base(void self) {
    float a = getentityproperty(self,"y");
    float base = getentityproperty(self,"base");

    if ( a <= base ) return 1;
    else return 0;
}
 
Thanks, I know I can check in every "custom" & potential landing animation (which actually use landframe because jump height varies).

I just wanted to avoid doing so, because it's not really global and "event" based.
 
You can define you animations ex.:
if ( getentityproperty(self,"animationid") == openborconstant("ANI_FOLLOW#") ) ... ... ...

and to check the instant in that you land on base:
Code:
                if ( is_on_base(self) && glv("land_frame") == 1 ) { // ----------- THIS IS THE LAND INSTANT -------------
                    playsample(loadsample("data/sounds/fall2.wav"));
                    spawnsubentity("dust",x,z,a);
                    // WHAT YOU WANT
                }

                if ( is_on_base(self) ) slv("land_frame",0);
                else slv("land_frame",1);
 
Thank you White Dragon, but in which script would you put this ? In the standard entity "script" one (ie entity update script) ?

FYI I tested the previous solution (triggering my function in jumpland first frame + in every other landframe frames), it works great except when character fall from a platform (for exemple if you walk too far, there is no switch to jumpland when character hit the ground, he just continue to walk). I guess a combining check in walk/run animations or with onemovea event (when a == 0) could take care of this though.
 
O Ilusionista said:
That is the WALKOFF anim. If you put a landframe and put the code there, it might work.

Thanks, didn't know there was an animation for that. But as I expected this animation doesn't help when entity fall off while sliding too much after a powerful charge for exemple  :-[
 
Why don't you set script to change animation to WALKOFF if entity falls off platform or wall in that animation?
 
Bloodbane said:
Why don't you set script to change animation to WALKOFF if entity falls off platform or wall in that animation?

Because it won't look ok on most of these animations (especially those which have heavy speed momentum).

Anyway, how would you know when to switch to WALKOFF (other than with solutions posted in this topic) ?
 
Back
Top Bottom