This event is called when an actor tries to jump. The
applyFatigueCost can be modified.
--- @param e jumpEventData local function jumpCallback(e) end event.register(tes3.event.jump, jumpCallback)
This event can be filtered based on the
reference event data.
This event supports blocking by setting
true or returning
false. Blocking the event prevents vanilla behavior from happening. For example, blocking an
equip event prevents the item from being equipped.
An event can be claimed by setting
true, or by returning
false from the callback. Claiming the event prevents any lower priority callbacks from being called.
false, this jump will not reduce fatigue.
isDefaultJump(boolean): Read-only. If
true, the jump has been initiated from the ground and without custom velocity or fatigue cost. This does not change if other event callbacks change any of these parameters.
mobile(tes3mobileActor): Read-only. The mobile actor that is trying to jump.
reference(tes3reference): Read-only. Mobile's related reference.
velocity(tes3vector3): The velocity of the jump.
Example: Disable jumping while encumbered
Disables jumping for the player if their current encumbrance is over 50%.
local function onJump(e) -- Check if the actor that is trying to jump is the player. if e.mobile == tes3.mobilePlayer then -- Define the threshold at which we no longer want to be able to jump. -- This is set to 50% of the player's maximum encumbrance. local encumbranceThreshold = e.mobile.encumbrance.base * 0.5 -- Check if the current encumbrance is higher than our defined threshold and prevent jumping. if e.mobile.encumbrance.current > encumbranceThreshold then -- Show a message to the player to inform them that jumping is not possible. tes3.messageBox("You are unable to jump.") -- Block the vanilla jump logic and prevent other jump events from being triggered. return false end end end event.register(tes3.event.jump, onJump)
Example: Double jump height
Double the height of every jump.
local function onJump(e) -- Multiply the velocity on the Z-Axis (Up/Down) by 2. e.velocity.z = e.velocity.z * 2 end event.register(tes3.event.jump, onJump)
Example: Force player jump height
Forces the jump height of the player to a fixed value, not taking into account attributes, skills, fatigue, encumbrance and other factors.
local function onJump(e) -- Check if the actor that is trying to jump is the player. if e.mobile == tes3.mobilePlayer then -- Define the fixed height of the jump. local jumpHeight = 300 -- Multiply the normalized direction vector of the jump by the fixed jump height. -- This will make jumps initiated during movement behave like they normally do. e.velocity = e.velocity:normalized() * jumpHeight end end event.register(tes3.event.jump, onJump)