[Free Release] Animal Spawner

Di you manage to make so that animals attack ?

1 Like

they dont spawn must i turn no-npc off?

2 Likes

i would assume so lol

Hello, the animals spawn once only, when they are gone. They wont respawn again. How can i solve it?

1 Like

Awesome script!!
Now our hunting script is useful

1 Like

So i was attempting to use this script to add AI security patrols via this script and a ā€œTask_Patrolā€ statement - but failed big time. Anyone have an idea on how to get the AI to spawn but instead of it being at random when entering zone, its exact when entering the zone, and patrolling?

2 Likes

which map was it, just curious if i have the same issue :slight_smile:

Disable all custom maps and check if I had ballas MLO

1 Like

is there a way to add another animals type on another location ?
I try copy paste line 3 to 65, doesnā€™t work

If possible; i would like to spawn one ped per exact coordinate (x, y, z, heading) with the ability to make them aggressive, and have different walk styles. Also, If the ability to make them spawn again after they were all killed were possibleā€¦ This would be literally the perfect animals and ped script.

Hereā€™s an example of some different walk styles. Iā€™m not sure how to implement any of these things personally, and iā€™ve tried implementing code from other scripts only for it to completely break the script because itā€™s either (A, Not made for it or (B, iā€™m not placing the code in the right place or somethingā€¦

local walks = {
ā€œmove_m@drunk@verydrunkā€,
ā€œmove_m@drunk@moderatedrunkā€,
ā€œmove_m@drunk@aā€,
ā€œanim_group_move_ballisticā€,
ā€œmove_lester_CaneUpā€,

Iā€™ve also come to realize i have to restart the script every time i want my peds to spawn as well.

Same here, did you find a solution? Once spawned and deleted, they dont respawn

I believe you have to leave the area and come back to it

Nope. Tried that. Even though, it would not be a great solution.

1 Like

what zone is the island

1 Like

any way to keep animals spawning but totally remove npc peds?

Hi, how do we put coordinates in place of a zone? Thank you

so how would this look if I made it for a a_c_mtlion? please and thanks

Hello! A lot of folks seem to be having issues with animals still not spawning. I had that too and I commented out the table.insert and table.remove commands. NOTE: I have a Qbcore Framework.


local entities = {}
Citizen.CreateThread(function()

while true do
Wait(250000)

local player = GetPlayerPed(-1)
local pos = GetEntityCoords(player,1)
local ground = ground
if (IsEntityInZone(player, ā€œCMSWā€)ā€“These are the zones animals spawn in, to find more zones search google for int GET_ZONE_FROM_NAME_ID
or IsEntityInZone(player, ā€œMTCHILā€)
or IsEntityInZone(player, ā€œMTGORDOā€)
or IsEntityInZone(player, ā€œMTJOSEā€)
or IsEntityInZone(player, ā€œPALFORā€)
or IsEntityInZone(player, ā€œPALHIGHā€)
or IsEntityInZone(player, ā€œSANCHIAā€)
or IsEntityInZone(player, ā€œTONGVAHā€)
or IsEntityInZone(player, ā€œPALHIGHā€))
and #entities < 2 thenā€“how many animals to spawn

RequestModel(ā€œa_c_deerā€) --model of animal, this is a deer (OBVIOUSLY xD).
while not HasModelLoaded(ā€œa_c_deerā€) or not HasCollisionForModelLoaded(ā€œa_c_deerā€) do
Wait(1000)
end

posX = pos.x+math.random(-100,100)
posY = pos.y+math.random(-100,100)
Z = pos.z+999.0
heading = math.random(0,359)+.0

ground,posZ = GetGroundZFor_3dCoord(posX+.0,posY+.0,Z,1)

if(ground) then

ped = CreatePed(28, ā€œa_c_deerā€, 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)

local blip = AddBlipForEntity(ped)
SetBlipSprite(blip,103) --if you want the animals to have blips change the 0 to a different blip number
SetBlipColour(blip,0)
BeginTextCommandSetBlipName(ā€œSTRINGā€)
AddTextComponentString(ā€œspawned entityā€)
EndTextCommandSetBlipName(blip)
end
end

for i, ped in pairs(entities) do
if IsEntityInWater(ped) then --if the animal spawns in water it will auto delete
local model = GetEntityModel(ped)
SetEntityAsNoLongerNeeded(ped)
SetModelAsNoLongerNeeded(model)
DeleteEntity(ped)
ā€“ table.remove(entities,i)
end
end

end
end)

soā€¦ what was the MLO?

My zone is CMSW and the all the animals are spawning on the road not on the forest. Someone knows what to do ?

1 Like