spawn multiple peds and have them attack the player, most of them don't do anything?
-
I have a simple loop that spawns many peds and then tasks them to fight the player. Problem is, a few of them do at first but then virtually none of the peds I spawn when I keep hitting the key will attack the player.
Any ideas?
for (int i = 0; i < 5; i++) { Vector3 spawn_location = player.Position + player.ForwardVector * -5f; Ped ped = GTA.World.CreatePed(PedHash.Business01AMY, spawn_location); ped.Weapons.Give(WeaponHash.Bat, 999, true, true); ped.Task.ClearAllImmediately(); GTA.Native.Function.Call(GTA.Native.Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, ped, 1); GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_FLEE_ATTRIBUTES, ped, 0, 0); GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_COMBAT_ATTRIBUTES, ped, 46, 1); // make them fight ped.Task.AimAt(player, 1); ped.Task.FightAgainst(player); }
-
@prismspecs There is a maximum amount of peds that can be in melee combat at a time. I believe this cap can be adjusted in the gameconfig.xml, i cant remember what the value is called though. Some digging around should come up with something.