Knowledge from the fieldRedM

Player-ped velocity overrides need PRF_ForcePedToStrafe (reset flag 10) — DISABLE_CONTROL_ACTION on movement isn't enough

learning:23

Player-ped velocity overrides need PRF_ForcePedToStrafe (reset flag 10) — DISABLE_CONTROL_ACTION on movement isn't enough

Context

Building a Superman-style flight script: setting SET_ENTITY_VELOCITY on the player ped each frame, with gravity disabled. As soon as the user pressed W (INPUT_MOVE_UD), velocity override stopped working — character would barely move forward instead of accelerating.

The trap

Two layers fight your velocity:

  1. The player-locomotion task reads movement input and writes its own velocity to the ped each frame.
  2. Even after DISABLE_CONTROL_ACTION for INPUT_MOVE_UD / INPUT_MOVE_LR (which kills the locomotion task's input), the ped still ends up in a locomotion state that intercepts and overwrites scripted velocity when W is held.

A workaround the user discovered: aim first, then press W → flight works. Aiming puts the ped in strafe mode which doesn't fight velocity overrides. That's the key clue.

The fix

Set PRF_ForcePedToStrafe every frame:

-- SET_PED_RESET_FLAG (ped, flagId, doReset) — flag 10 = PRF_ForcePedToStrafe
Citizen.InvokeNative(0xC1E8A365BF3B29F2, ped, 10, true)

This forces the same posture/state aiming would. Velocity overrides flow through cleanly when W is held. Verified with A/B test: removing flag 10 (with everything else in place — disabled controls, gravity off, fall-task suppressed) reproduces the broken behavior.

What does NOT work alone

  • SET_PED_USING_ACTION_MODE(ped, true, -1, "DEFAULT_ACTION") — visually puts ped in action stance but doesn't stop the velocity intercept.
  • SET_PED_MAX_MOVE_BLEND_RATIO(ped, 100.0) — actively counter-productive: it lets locomotion push higher velocities that fight you harder.
  • DISABLE_CONTROL_ACTION on movement inputs alone.

Recommended combo for player flight

  • SET_ENTITY_HAS_GRAVITY(ped, false) + SET_PED_GRAVITY(ped, false) (per frame)
  • SET_PED_CAN_RAGDOLL(ped, false) + SET_PED_RAGDOLL_ON_COLLISION(ped, false)
  • SET_PED_RESET_FLAG 29 (PRF_SuppressInAirEvent) — prevents fall task spawning
  • SET_PED_RESET_FLAG 10 (PRF_ForcePedToStrafe) — required to keep velocity overrides flowing
  • Optional: flags 21 (DisableAutoVaulting), 39 (DisableDropDowns), 247 (DisableAutoJumping)

Linked natives

  • SET_PED_RESET_FLAG (0xC1E8A365BF3B29F2)

Tags: flight, player-ped, velocity, reset-flags, strafe, locomotion
Category: discoveries
Source: ch-superman
Created: 2026-05-03T12:32:57.228Z

Back to documentation