Jump to content

Any way to find out whether a player is jumping with papyrus script?


hidconsp

Recommended Posts

You'll need to obtain the DXScanCode of the key that the user has bound to the jump command. Then check for when that key is pressed. All of that requires SKSE

 

Obtain the DXScanCode with GetMappedKey

Register that DXScanCode so that you can use Key listening events with RegisterForKey

Then use the OnKeyDown event

 

Result, whenever the key is pressed an event will run that you can use to do whatever you need to for when the player has jumped.

 

Only issue is that jumps are so short that the script coding might not have enough time to complete what you want it to do while the player is in the air.

Link to comment
Share on other sites

You'll need to obtain the DXScanCode of the key that the user has bound to the jump command. Then check for when that key is pressed. All of that requires SKSE

 

Obtain the DXScanCode with GetMappedKey

Register that DXScanCode so that you can use Key listening events with RegisterForKey

Then use the OnKeyDown event

 

Result, whenever the key is pressed an event will run that you can use to do whatever you need to for when the player has jumped.

 

Only issue is that jumps are so short that the script coding might not have enough time to complete what you want it to do while the player is in the air.

 

 

Well I found the right answer: player.getAnimationVariableBool("bInJumpState")

Link to comment
Share on other sites

That could work too. I don't deal with animations. Thus did not think to delve into the deeper layers of those. However, my answer was not incorrect. It would have informed you of when the player was jumping too. One looks for the animation, the other looks for the user's deliberate key press. Now you need to decide which method will actually work. I have a feeling that the animation one will catch more than just jumping (i.e. falling).

Link to comment
Share on other sites

  • 10 years later...
On 7/8/2014 at 2:28 AM, hidconsp said:

 

 

Well I found the right answer: player.getAnimationVariableBool("bInJumpState")

That sounds great! and so far sounds like the only way for me to achieve something similiar. I have a spell that works perfectly in the air and on the ground. however I want a different magnitude to kick in if I'm on the ground vs in the air.

 

My question is, how can I apply that to my script as a function I guess? I'm still very new to learning this. Below are my lines. The top part is perfectly fine, under the "elseif" section is where I'm trying to work on it. Any help would be greatly aprreciated

 

function OnEffectStart(Actor Target, Actor Caster)

    if CombatSprintGlobalVariable.getValue() == 0 as Float
        CombatSprintGlobalVariable.setValue(1 as Float)
        AirWalk = Caster.PlaceAtMe(NightcrawlerJump as form, 1, false, false)
        AirWalk.MoveTo(Caster as ObjectReference, 0 as Float, 0 as Float, 0 as Float, true)
        AirWalk.Activate(Caster as ObjectReference, false)
        actorbase PlayerBase = Caster.GetBaseObject() as actorbase
        debug.SendAnimationEvent(Caster as ObjectReference, "ShoutStart")
        debug.SendAnimationEvent(Caster as ObjectReference, "ShoutSprintLongStart")
        CastSpellName.Cast(Caster as ObjectReference, none)

    elseif player.getAnimationVariableBool("bInJumpState")=0
        debug.SendAnimationEvent(Caster as ObjectReference, "ShoutStart")
        debug.SendAnimationEvent(Caster as ObjectReference, "ShoutSprintShortStart")
        CastSpellName.Cast(Caster as ObjectReference, none)
    endIf

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...