🤠 Wild Country Libs
Client API

Animations & Scenarios

One call to load the dict and play — no more RequestAnimDict boilerplate scattered through every script. Covers one-shot anims, looping anims, world-position anims, and RDR2 scenarios.

PlayAnim(ped, dict, clip, opts)client

Loads the animation dictionary then plays the clip on ped. Returns true if the animation started.

ParamTypeDescription
pednumberEntity handle.
dictstringAnimation dictionary name.
clipstringAnimation clip name.
optstable|nilSee options below.
opts keyDefaultDescription
blendIn8.0Blend-in speed.
blendOut-8.0Blend-out speed.
duration-1Duration in ms. -1 = play full clip once.
flags0TaskPlayAnim flags. Common: 0=once, 1=loop, 2=hold last frame.
loopfalseShorthand for flags = 1.
rate1.0Playback speed multiplier.
waitfalseBlock the current thread until the clip ends.
waitTimeout10000Max ms to wait (only used when wait = true).
dictTimeout5000Max ms to wait for the dict to load.
example
-- play once and block until finished
wc:PlayAnim(ped, 'mech_busted@unapproved', 'idle_b', { wait = true })

-- loop with reduced speed
wc:PlayAnim(ped, 'amb_rest@world_human_stand_impatient@male_a@idle_a', 'idle_a', {
  loop = true, rate = 0.8
})
PlayAnimLooped(ped, dict, clip, opts) → functionclient

Plays a looping animation. Returns a stopper function — call it to stop the loop cleanly.

example
local stop = wc:PlayAnimLooped(npcPed, 'amb_rest@world_human_hang_out_street@male_a@idle_a', 'idle_a')

Wait(5000)
stop() -- blend out and end loop
PlayAnimAt(ped, dict, clip, pos, rot, opts)client

Plays an animation at a specific world position and rotation using TaskPlayAnimAdvanced. Useful for in-place actions at a map point regardless of where the ped is standing.

ParamTypeDescription
posvector3World position to play at.
rotvector3|nilRotation. Defaults to vector3(0,0,0).
optstable|nilSame blendIn/blendOut/duration/flags/rate as PlayAnim.
example
local pos = GetEntityCoords(prop)
wc:PlayAnimAt(ped, 'mini@repair', 'fixing_a_ped', pos, nil, { duration = 4000 })
IsAnimPlaying(ped, dict, clip) → booleanclient

Returns true if the ped is currently playing the given animation.

StopAnim(ped)client

Stop all animations on the ped with a smooth blend-out (ClearPedTasks).

StopAnimNow(ped)client

Stop all animations immediately with no blend (ClearPedTasksImmediately). Use when you need an instant hard cut.


Scenarios

PlayScenario(ped, scenario, opts) → functionclient

Starts a scenario in place. Scenarios loop automatically. Returns a stopper function.

ParamTypeDescription
scenariostringRDR2 scenario name.
optstable | boolean | nilUse a table for duration and playEnterAnim. A boolean is still accepted as the old playEnterAnim argument.
opts.durationnumber | nilScenario duration in milliseconds. Default 0.
opts.playEnterAnimboolean | nilPlay the entry animation before the idle. Default false (snap instantly).
example
local stop = wc:PlayScenario(npcPed, 'WORLD_HUMAN_LEAN_WALL')

Wait(8000)
stop()
PlayScenarioAt(ped, scenario, x, y, z, heading, opts) → functionclient

Plays a scenario at a specific world position. Returns a stopper function.

opts keyDefaultDescription
duration-1Duration in ms. -1 = indefinite.
standingtruePlay as a standing scenario.
playEnterAnimfalsePlay the scenario entry animation.
example
local coords = GetEntityCoords(npcPed)
local stop = wc:PlayScenarioAt(npcPed,
  'WORLD_HUMAN_SMOKE_PIPE',
  coords.x, coords.y, coords.z,
  GetEntityHeading(npcPed),
  { duration = 10000 })

Wait(10000)
stop()
StopScenario(ped)client

Stops the scenario currently running on the ped.

Real Wild County example — trader idle scenario

wc_trader/client/main.lua
local stopIdle = wc:PlayScenario(traderPed, 'WORLD_HUMAN_STAND_IMPATIENT')

-- when the shop closes / resource stops
stopIdle()

Common mistakes

Troubleshooting