public AIConvoy Setup(int children) { leader = new GroundAI(); TeamManager.SetupTeam(this); var spawnPos = leader.Team.GroundSpawnPoint.Position; var pedModel = new Model(PedHash.Pilot02SMM); var vehModel = new Model(VehicleHash.Barracks); var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, spawnPos)); vehicle.Vehicle.EngineRunning = true; vehicle.Vehicle.Heading = leader.Team.GroundSpawnPoint.Heading; vehicle.AddBlip(); vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit; var ped = new ManageablePed(World.CreatePed(pedModel, spawnPos)); ped.Ped.RelationshipGroup = leader.Team.RelationshipGroup; ped.Ped.BlockPermanentEvents = false; ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver); leader.Manage(ped, vehicle); AddChildren(children); return(this); }
public void AddChildren(int count = 0) { var spawnPos = leader.Team.GroundSpawnPoint.Position; var pedModel = new Model(PedHash.Pilot02SMM); var vehModel = new Model(VehicleHash.Barracks3); if (!pedModel.IsLoaded) { pedModel.Request(1000); } if (!vehModel.IsLoaded) { vehModel.Request(1000); } for (int i = 0; i < count; i++) { var parent = children.Count > 0 ? children.Last() : leader; var childAsset = new GroundAI(); var pos = parent.ManagedVehicle.Position - parent.ManagedVehicle.ForwardVector * 6; var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, pos)); vehicle.Vehicle.EngineRunning = true; vehicle.Vehicle.Heading = leader.Team.GroundSpawnPoint.Heading; vehicle.AddBlip(); vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit; Function.Call(Hash.SET_ENTITY_LOAD_COLLISION_FLAG, vehicle.Handle, true); var ped = new ManageablePed(new Ped(Function.Call <int>(Hash.CREATE_PED_INSIDE_VEHICLE, vehicle.Handle, 6, pedModel.Hash, -1, 0, 0))); ped.Ped.RelationshipGroup = leader.Team.RelationshipGroup; ped.Ped.BlockPermanentEvents = false; ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver); childAsset.Manage(ped, vehicle); children.Add(childAsset); } }
public void AddChildren(int count = 0) { var spawnPos = leader.Team.GroundSpawnPoint.Position; var pedModel = new Model(PedHash.Pilot02SMM); var vehModel = new Model(VehicleHash.Barracks3); if (!pedModel.IsLoaded) pedModel.Request(1000); if (!vehModel.IsLoaded) vehModel.Request(1000); for (int i = 0; i < count; i++) { var parent = children.Count > 0 ? children.Last() : leader ; var childAsset = new GroundAI(); var pos = parent.ManagedVehicle.Position - parent.ManagedVehicle.ForwardVector * 6; var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, pos)); vehicle.Vehicle.EngineRunning = true; vehicle.Vehicle.Heading = leader.Team.GroundSpawnPoint.Heading; vehicle.AddBlip(); vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit; Function.Call(Hash.SET_ENTITY_LOAD_COLLISION_FLAG, vehicle.Handle, true); var ped = new ManageablePed(new Ped(Function.Call<int>(Hash.CREATE_PED_INSIDE_VEHICLE, vehicle.Handle, 6, pedModel.Hash, -1, 0, 0))); ped.Ped.RelationshipGroup = leader.Team.RelationshipGroup; ped.Ped.BlockPermanentEvents = false; ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver); childAsset.Manage(ped, vehicle); children.Add(childAsset); } }
public AIConvoy Setup(int children) { leader = new GroundAI(); TeamManager.SetupTeam(this); var spawnPos = leader.Team.GroundSpawnPoint.Position; var pedModel = new Model(PedHash.Pilot02SMM); var vehModel = new Model(VehicleHash.Barracks); var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, spawnPos)); vehicle.Vehicle.EngineRunning = true; vehicle.Vehicle.Heading = leader.Team.GroundSpawnPoint.Heading; vehicle.AddBlip(); vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit; var ped = new ManageablePed(World.CreatePed(pedModel, spawnPos)); ped.Ped.RelationshipGroup = leader.Team.RelationshipGroup; ped.Ped.BlockPermanentEvents = false; ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver); leader.Manage(ped, vehicle); AddChildren(children); return this; }