esx or standalone ?
this will make your pc blewup
Found the fix to spawn animals again without any script. It’s caused by streamed .ymt files! Just search for them and remove them from your MLOs. After that, all scenarios will be back. Have fun
I done it. But i don’t have any animals so far.
All “*.ymt” -files are removed.
And Server-Cache was also cleared.
I’ve now tested it without an active MLO and it works again.
So either I didn’t look properly for animals or I still have a .ymt file somewhere.
Thanks for help.
i’ve forgot to remove the streamed .ymt data-entrys in the fxmanifest.lua
What code section do I need to reproduce to spawn some pedestrians in this script? This would help my taxi missions.
My guess is this for each ped I want with the right model and zone, right?
local player = GetPlayerPed(-1)
local pos = GetEntityCoords(player,1)
local ground
if (IsEntityInZone(player, "SLAB"))--check zone to only spawn animals in wilderness - more zones: int GET_ZONE_FROM_NAME_ID(char* zoneName);
and #entities < 1 then--repeat until 15 entities are spawned
--and pedcount < 15 then--repeat until 15 entities are spawned
RequestModel("cs_orleans")
while not HasModelLoaded("cs_orleans") or not HasCollisionForModelLoaded("cs_orleans") do
Wait(1)
end
posX = pos.x+math.random(-100,100)--radius example
posY = pos.y+math.random(-100,100)--radius example
Z = pos.z+999.0
heading = math.random(0,359)+.0
ground,posZ = GetGroundZFor_3dCoord(posX+.0,posY+.0,Z,1)--set Z pos as on ground
if(ground) then--if ground find
ped = CreatePed(28, "cs_orleans", posX, posY, posZ, heading, true, true)
SetEntityAsMissionEntity(ped, true, true)
TaskWanderStandard(ped, 10.0, 10)
SetEntityAsMissionEntity(ped, true, true)
TaskCombatPed(npc, GetPlayerPed(-1), 0, 16)
SetModelAsNoLongerNeeded(ped) -- despawn, specify model hash instead?
SetPedAsNoLongerNeeded(ped) -- despawn
table.insert(entities,ped)--insert ped in tables
local blip = AddBlipForEntity(ped)--add blip for ped
SetBlipSprite(blip,40)
SetBlipColour(blip,40)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("spawned entity")
EndTextCommandSetBlipName(blip)
end
end
--this part avoid ped to spawn in water
for i, ped in pairs(entities) do
if IsEntityInWater(ped) then--detect if ped is in water.If in water the ped is deleted and the loop restart until the 15 entities are well on ground
local model = GetEntityModel(ped)
SetEntityAsNoLongerNeeded(ped)
SetModelAsNoLongerNeeded(model)
DeleteEntity(ped)
table.remove(entities,i)
end
end
------------------------------------------
end
end)
is it possible to set this to a specific range / too use coords?!
that’s my try… but it will spawn unlimited animals…
---YOU CAN COPY PASTE LINES 3 THROUGH 65 AND CHANGE ANIMAL MODELS TO SPAWN OTHER ANIMALS---
local entities = {}
Citizen.CreateThread(function()
while true do
Wait(0)
local pos = vector3(1449.77, 1067.26, 114.33)
local playerpos = GetEntityCoords(ped)
local ground
if (Vdist(pos.x, pos.y, pos.z, playerpos.x, playerpos.y, playerpos.z) < 20.0) and #entities < 10 then--how many animals to spawn
RequestModel("a_c_cow") --model of animal, this is a deer (OBVIOUSLY xD).
end
posX = pos.x+math.random(-10,10)
posY = pos.y+math.random(-10,10)
Z = pos.z+2.0
heading = math.random(0,359)+0.0
ground,posZ = GetGroundZFor_3dCoord(posX+0.0,posY+0.0,Z,1)
if(ground) then
ped = CreatePed(28, "a_c_cow", posX, posY, posZ, heading, true, true)
SetEntityAsMissionEntity(ped, true, true)
TaskWanderStandard(ped, 10.0, 10)
SetModelAsNoLongerNeeded(ped)
SetPedAsNoLongerNeeded(ped) -- despawn when player no longer in the area
table.insert(entities,ped)
end
end
end)
amazing idea
Beautiful
trying to do a zoo but they arnt spawning where im trying to make em. Any way to make it cord based?
how to make sharks spawn in water
for us the animals are not instant spawning even when we are in the area
I dont think this works with onesync anymore. It stopped working on our server as of late. Worked once like months back but not anymore
Says the file is outdated and needs an update
can we have an example on how to set more than 1 animal i copied the script over again but am getting errors
just change the model names really in the metas depending on the animal
i can spawn peds but i wanna do multiple areas can someone show me how to stack each group?
any idea?
wist this was in github