I was wondering how I could make a ped shoot out of a van.
I have the following in mind: I want to create a pursuite where, if the player is close enough to the van, the back doors whould open and two peds should shoot at the player.
I've got the logic for the pursuit and the doors opening when the player gets close, but I can't figure out how to make the peds shoot out of the van.
Here's the code:
Ped creation:
shooter1 = new Ped(spawnPoint);
shooter1.IsPersistent = true;
shooter1.BlockPermanentEvents = true;
shooter1.Inventory.GiveNewWeapon(WeaponHash.MicroSMG, 400, true);
shooter1.WarpIntoVehicle(van, 1);
shooter2 = new Ped(spawnPoint);
shooter2.IsPersistent = true;
shooter2.BlockPermanentEvents = true;
shooter2.Inventory.GiveNewWeapon(WeaponHash.Pistol, 400, true);
shooter2.WarpIntoVehicle(van, 2);
Shooting logic:
shooter1.RelationshipGroup = RelationshipGroup.HatesPlayer;
shooter2.RelationshipGroup = RelationshipGroup.HatesPlayer;
shooter1.Inventory.EquippedWeapon = shooter1.Inventory.Weapons[0];
shooter2.Inventory.EquippedWeapon = shooter2.Inventory.Weapons[0];
shooter1.Tasks.FightAgainst(playerPed);
shooter2.Tasks.FightAgainst(playerPed);
van.Doors[2].Open(false);
van.Doors[3].Open(false);
So far, once the player gets close, everything works except the peds shooting. They instead just keep calmly sitting in the back of the van even closing the doors again after they were opened.
Please help ❤️