Peds, Horses & Props
Spawn helpers extracted directly from wc_encounter's eight encounter types. Framework-agnostic — these are pure RedM native wrappers, the same on VORP or RSG.
Spawns a single ped, ground-snapped and outfit-randomized.
| Param | Type | Description |
|---|---|---|
| hash | number | A loaded model hash — see LoadModel. |
| x, y, z | number | Spawn coordinates. |
| heading | number | nil | Defaults to 0. |
| isMission | boolean | nil | Marks as mission entity — won't get cleaned up by the engine. |
| invincible | boolean | nil | Sets invincible + blocks non-temp events. |
local hash = wc:LoadAnyModel({ "a_m_m_armtownfolk_01", "a_m_m_valrancher_01" })
local ped = wc:SpawnPed(hash, pos.x, pos.y, pos.z, 90.0, true, true)
Spawns an ambient decoration horse — mission-entity and invincible by default.
| Param | Type | Description |
|---|---|---|
| x, y, z | number | Spawn coordinates. |
| heading | number | nil | Defaults to random. |
| modelList | table | nil | Pool of horse model names to try. |
Spawns a frozen, no-collision decoration prop.
Safely deletes a ped or vehicle — unfreezes and unmarks mission-entity first, so the engine doesn't refuse the delete.
Turns the player and an NPC to directly face one another — standard "start a conversation" framing.
Sends an NPC walking away from the player in a random direction, 60 metres out. Useful for post-encounter dismissal.
| Param | Type | Description |
|---|---|---|
| ped | number | The ped entity to dismiss. Does nothing if it doesn't exist. |
-- dismiss civilian after dialogue ends
wc:NpcWalkAway(civilianPed)
Wait(4000)
wc:DeletePed(civilianPed)
Positions one ped relative to another using a forward/right/up offset in metres, plus a heading delta. Used for things like "place this NPC right in front of the player, facing them."
-- place the NPC just in front of the player, facing them
wc:PlacePedRelative(npcPed, PlayerPedId(), 0.1, 0.90, 0.09, 180.0)
Requests a model and waits for it to load.
| Returns | Type |
|---|---|
| hash | number | nil — nil if invalid or timed out |
Tries a list of model names in order, returns the first that loads. Useful for ped pools where any one of several models is fine.
Requests an animation dictionary and waits for it to load. Returns a boolean.
Bonus — GPS routes & dialogue camera
Two more world helpers extracted alongside the spawners:
wc:SetGPSRoute(wagon.x, wagon.y, wagon.z, 'COLOR_RED')
-- ...
wc:ClearGPSRoute()
wc:EnableDialogueCamera(npcPed)
-- ... run your dialogue ...
wc:DisableDialogueCamera()
Real Wild County example — trader NPC setup
local hash = wc:LoadModel("a_m_m_hillfolk_01")
local traderPed = wc:SpawnPed(hash, stall.x, stall.y, stall.z, stall.heading, true, true)
wc:PlayScenario(traderPed, "WORLD_HUMAN_STAND_IMPATIENT")
-- resource stop / shop teardown
wc:DeletePed(traderPed)
Common mistakes
- Deleting a ped/vehicle with the raw
DeletePed/DeleteVehiclenatives directly — they can refuse to delete a frozen or mission-flagged entity. Usewc:DeletePed/wc:DeleteVehicle, which unfreezes and unmarks first. - Spawning a ped without
isMission = trueand being surprised the engine despawns it after you walk away — set it when the NPC needs to persist. - Forgetting
SpawnHorseis for decorative/ambient horse peds, not rideable mounts — for player-drivable wagons/carts see Wagons. - Calling
SpawnPedwith an unloaded model hash — always go throughLoadModel/LoadAnyModelfirst so the hash is guaranteed loaded.
Troubleshooting
- If
SpawnPedreturnsnil: the model likely never finished loading in time — check the model name is valid and increase the timeout if you're on a slow connection. - If a ped won't delete: it's still frozen or mission-flagged from a native call outside wc_libs —
DeletePedalready unfreezes/unmarks first, so if it still fails, another script is re-freezing it. - If
ArmPedsilently does nothing: confirm the weapon name is a valid RedM weapon hash string, and that the ped exists before calling it.