The PlayerBase.IsSprinting method always seems to return false, even if the player is actually sprinting.
Tested on DayZ version 1.14.154258.
The PlayerBase.IsSprinting method always seems to return false, even if the player is actually sprinting.
Tested on DayZ version 1.14.154258.
Create a mod that prints the return value of PlayerBase.IsSprinting on every tick. For example:
modded class PlayerBase { override void OnTick() { super.OnTick(); PrintFormat( "%1 :: IsSprinting=%2 :: m_iMovement=%3", this, IsSprinting(), m_MovementState.m_iMovement); } };
Load this mod on a server and connect to it.
When the player is standing still, a line similar to the following will be printed to the script log:
SCRIPT : SurvivorBase<a0b90210> :: IsSprinting=0 :: m_iMovement=0
When the player is running but not sprinting, a line similar to the following will be printed:
SCRIPT : SurvivorBase<a0b90210> :: IsSprinting=0 :: m_iMovement=2
When the player is sprinting, a line similar to the following will be printed:
SCRIPT : SurvivorBase<a0b90210> :: IsSprinting=0 :: m_iMovement=3
The following replacement implementation of PlayerBase.IsSprinting appears to work correctly:
bool IsSprinting() { return m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT; }
The following patch appears to fix the issue:
--- scripts/4_World/Entities/ManBase/PlayerBase.c.original 2021-11-09 18:45:04.589091000 -0600 +++ scripts/4_World/Entities/ManBase/PlayerBase.c 2021-11-09 18:52:43.798113700 -0600 @@ -4714,7 +4714,7 @@ bool IsSprinting() { - return m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENT_SPRINT); + return m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT; } bool CanSprint()
Note that the 1.14.154258 implementation contains an errant trailing ) character. DayZ experimental version 1.15.154306 contains the same broken implementation.