public void CreateSpawnerVehicle() { RCSpawner?.Delete(); RCSpawner = World.CreateVehicle(VehicleHash.GBurrito, Constants.SpawnerPos, Constants.SpawnerRot); RCSpawner.NumberPlate = "KABOOM"; RCSpawner.IsRadioEnabled = false; RCSpawner.CanBeVisiblyDamaged = false; RCSpawner.IsInvincible = true; // Absolutely useless but it looks cool RCSpawnerProp?.Delete(); RCSpawnerProp = World.CreateProp("hei_prop_mini_sever_02", Constants.SpawnerPos + new Vector3(0f, 0f, -5.0f), false, false); Function.Call( Hash.ATTACH_ENTITY_TO_ENTITY, RCSpawnerProp.Handle, RCSpawner.Handle, Function.Call <int>(Hash.GET_ENTITY_BONE_INDEX_BY_NAME, RCSpawner.Handle, "Prop_MB_crate_01A"), 0f, 1.1f, -0.39f, 0f, 0f, 0f, true, false, false, false, 2, true ); Blip spawnerBlip = RCSpawner.AddBlip(); spawnerBlip.IsShortRange = true; spawnerBlip.Sprite = (BlipSprite)646; spawnerBlip.Scale = 1.0f; spawnerBlip.Name = "RC Vehicle Van"; RCSpawner.IsPersistent = true; }
/// <summary> /// Spawn a helicopter at the offset relative to the player. /// </summary> /// <param name="mdl">Model of the helicopter to spawn</param> /// <param name="offset">offset, relative to the player, as a vector</param> /// <returns>Instance of <c>Vehicle</c></returns> protected Vehicle spawnHeli(Vector3 offset, Model model) { // spawn in heli Vehicle heli = World.CreateVehicle(model, _leader.Position + offset); // verify that the vehicle was successfully spawned if (heli == null) { // check if the model is the same as the fallback model if (model == fallbackModel) { GTA.UI.Notification.Show("~r~Failed the spawn default vehicle. Check that you have required DLC."); return(null); } // otherwise, try again with the fallback model GTA.UI.Notification.Show("~r~Failed to spawn the vehicle. " + "Check that you have you spelled the vehicle name correctly in INI. Falling back to default model"); return(spawnHeli(offset, fallbackModel)); } // apply settings to heli heli.IsEngineRunning = true; heli.HeliBladesSpeed = 1.0f; heli.LandingGearState = VehicleLandingGearState.Retracted; heli.IsBulletProof = _isBulletproof; // attach a blip (rotating helicopter) heli.AddBlip(); heli.AttachedBlip.Sprite = BlipSprite.HelicopterAnimated; heli.AttachedBlip.Color = defaultBlipColor; return(heli); }
/// <summary> /// Spawn a single strafing vehicle, as part of a strafing formation. /// </summary> /// <param name="formationAnchorPos">The position of the formation's anchor</param> /// <param name="spawnRotation">The initial rotation of the vehicle</param> /// <param name="n">The nth vehicle in the strafing formation</param> /// <returns>Returns an instance of <c>Vehicle</c></returns> protected Vehicle spawnStrafeVehicle(Vector3 formationAnchorPos, Vector3 spawnRotation, int n) { // compute the position to spawn the vehicle at Vector3 spawnPos = formationAnchorPos + Helper.rotateVectorZAxis(formationOffsets[n], spawnRotation.Z); // spawn strafe run vehicle Vehicle veh = World.CreateVehicle(strafeVehicleModel, spawnPos); // verify that the vehicle was successfully spawned if (veh == null) { Notification.Show("~r~Failed to spawn the vehicle. Check that you have the required DLC."); } // orient the vehicle towards the target veh.Rotation = spawnRotation; veh.ForwardSpeed = initialAirSpeed; // apply settings the the vehicle veh.IsEngineRunning = true; veh.LandingGearState = VehicleLandingGearState.Retracted; // attach a blip to the vehicle veh.AddBlip(); veh.AttachedBlip.Sprite = BlipSprite.B11StrikeForce; veh.AttachedBlip.Color = defaultBlipColor; return(veh); }
private static void GeneratePersonalVehicleAndBlip(string playerName, VehicleDefinition vehicleDefinition, Vector4 spawnPoint) { Model model = new Model(vehicleDefinition.VehicleName).Hash; model.Request(); while (!model.IsLoaded) { Script.Yield(); } _personalVehicle = World.CreateVehicle(vehicleDefinition.VehicleName, new Vector3(spawnPoint.X, spawnPoint.Y, spawnPoint.Z), spawnPoint.H); if (_personalVehicle == null) { Logger.Log("GeneratePersonalVehicleAndBlip(): World.CreateVehicle() failed to create a vehicle, which should never happen."); return; } _personalVehicle.PlaceOnGround(); ConfigurePersonalVehicle(_personalVehicle, vehicleDefinition); _personalVehicle.LockStatus = VehicleLockStatus.Locked; _personalVehicle.PreviouslyOwnedByPlayer = true; Logger.Log("GeneratePersonalVehicleAndBlip(): placed a " + _personalVehicle.PrimaryColor + " " + (VehicleHash)_personalVehicle.Model.Hash + " at (" + Math.Round(spawnPoint.X, 3) + ", " + Math.Round(spawnPoint.Y, 3) + ", " + Math.Round(spawnPoint.Z, 3) + ")"); _personalVehicleBlip = _personalVehicle.AddBlip(); _personalVehicleBlip.Sprite = BlipSprite.PersonalVehicleCar; _personalVehicleBlip.Name = vehicleDefinition.VehicleName; _personalVehicleBlip.Scale = 0.8888f; PlayerBlipColors colorToUse = (PlayerBlipColors)System.Enum.Parse(typeof(PlayerBlipColors), playerName); Function.Call(Hash.SET_BLIP_COLOUR, _personalVehicleBlip, (int)colorToUse); }
public override void Start() { this.pay = 500; issi = World.CreateVehicle(new Model("issi2"), new Vector3(-445.293f, -2179.457f, 10.31818f), 181.4f); van = World.CreateVehicle(new Model("fbi2"), new Vector3(2538.767f, -582.5017f, 65.25363f)); vanBlip = van.AddBlip(); vanBlip.Color = BlipColor.Blue; vanBlip.ShowRoute = true; driver = van.CreatePedOnSeat(VehicleSeat.Driver, new Model("s_m_y_swat_01")); passenger = van.CreatePedOnSeat(VehicleSeat.Passenger, new Model("s_m_y_swat_01")); driver.Task.CruiseWithVehicle(van, 30, 786603); driver.Weapons.Give(GTA.Native.WeaponHash.CarbineRifleMk2, 5000, true, true); passenger.Weapons.Give(GTA.Native.WeaponHash.CarbineRifleMk2, 5000, true, true); garageBlip = World.CreateBlip(new Vector3(-439.8835f, -2179.444f, 9.94509f)); garageBlip.Color = BlipColor.Yellow; garageBlip.ShowRoute = false; garageBlip.Alpha = 0; Main.spawnedVehicles.Add(van); Main.spawnedVehicles.Add(issi); Main.spawnedPeds.Add(driver); Main.spawnedPeds.Add(passenger); Main.blips.Add(vanBlip); Main.blips.Add(garageBlip); }
protected override Blip drawCustomBlip(Vehicle veh) { Blip blip = veh.AddBlip(); blip.Sprite = BlipSprite.Jet; blip.Color = BlipColor.Red; return(blip); }
private static void AddBlipToVehicle(Vehicle vehicle) { Blip blip = vehicle.AddBlip(); blip.Sprite = GetSprite(vehicle); blip.Color = GTA.BlipColor.Yellow; blip.Name = vehicle.FriendlyName; blip.Scale = 0.85f; }
private void setDrugCar() { drugVehicle = Game.Player.Character.CurrentVehicle; //Set Vehicle For Storaging Drugs drugVehicle.IsPersistent = true; //Make Vehicle Persistent Blip drugVehicleBlip = drugVehicle.AddBlip(); //Add Blip To Vehicle //Change Vehicle Blip Settings and stuff Function.Call(Hash.SET_BLIP_SPRITE, drugVehicleBlip, 225); drugVehicleBlip.Scale = 0.7f; }
protected override void populateDestructibleElements() { base.populateDestructibleElements(); vehicle = World.CreateVehicle(vehicleHash, position); vehicle.AddBlip(); vehicle.CurrentBlip.Sprite = BlipSprite.HelicopterAnimated; vehicle.CurrentBlip.Color = BlipColor.Green; vehicle.CurrentBlip.IsFlashing = true; vehicle.CurrentBlip.ShowRoute = true; }
// Spawn blip for vehicle public static Blip SpawnVehicleBlip(Vehicle vehName, BlipSprite sprite, int blipColour, bool showroute) { // Add blip to vehicle vehName.AddBlip(); // Give blip an icon vehName.CurrentBlip.Sprite = sprite; // Set GPS route for blip on/off vehName.CurrentBlip.ShowRoute = showroute; // Set colour of blip Function.Call(Hash.SET_BLIP_COLOUR, vehName.CurrentBlip, blipColour); // Set colour of GPS route Function.Call(Hash.SET_BLIP_ROUTE_COLOUR, vehName.CurrentBlip, blipColour); return(vehName.CurrentBlip); }
public TaxiEvent(Ped ped, Ped driver, Vehicle taxi) { hitch = ped; Driver = driver; Taxi = taxi; hitch.IsPersistent = true; Taxi.IsPersistent = true; Driver.IsPersistent = true; if (LivelyWorld.DebugBlips && !taxi.CurrentBlip.Exists()) { Taxi.AddBlip(); Taxi.CurrentBlip.Sprite = BlipSprite.Cab; Taxi.CurrentBlip.Color = BlipColor.Yellow; Taxi.CurrentBlip.IsShortRange = true; hitch.AddBlip(); hitch.CurrentBlip.Color = BlipColor.White; hitch.CurrentBlip.Scale = 0.7f; hitch.CurrentBlip.IsShortRange = true; } hitch.AlwaysKeepTask = true; driver.AlwaysKeepTask = true; if (hitch.IsInVehicle(Taxi)) { if (LivelyWorld.Debug >= DebugLevel.EventsAndScenarios) { UI.Notify("Taxi event mode: dropoff"); } DropOff = true; //Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, Driver, Taxi, pos.X, pos.Y, pos.Z, 10f, 1, Taxi.Model, 1 + 2 + 8 + 16 + 32 + 128 + 256, 15.0, 1.0); } else { if (LivelyWorld.Debug >= DebugLevel.EventsAndScenarios) { UI.Notify("Taxi event mode: pick up"); } Vector3 pos = hitch.Position; Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, Driver, Taxi, pos.X, pos.Y, pos.Z, 10f, 1, Taxi.Model, 1 + 2 + 8 + 16 + 32 + 128 + 256, 15.0, 1.0); hitch.Task.LookAt(Taxi, -1); } //Driver.Task.DriveTo(Taxi, hitch.Position, 10f, 10f, 1+2+ 16+32 + 128 + 256); }
public override void SpawnEntities() { Vector3 spawn = GetSpawnPoint(); if (IsValidSpawn(spawn)) { Vehicle vehicle = World.CreateVehicle(Database.GetRandomVehicleModel(), spawn, (float)Database.Random.Next(1, 360)); if (vehicle == null) { Complete(); } else { _vehicle = vehicle; Blip vehicleBlip = _vehicle.AddBlip(); vehicleBlip.Name = "Enemy Vehicle"; vehicleBlip.Sprite = GTA.BlipSprite.PersonalVehicleCar; vehicleBlip.Color = GTA.BlipColor.Red; EntityEventWrapper vehicleWrapper = new EntityEventWrapper(_vehicle); vehicleWrapper.Died += VehicleWrapperOnDied; vehicleWrapper.Updated += VehicleWrapperOnUpdated; for (int i = 0; i < vehicle.PassengerSeats + 1; i++) { if (_group.MemberCount < 6 && vehicle.IsSeatFree(GTA.VehicleSeat.Any)) { Ped ped = vehicle.CreateRandomPedOnSeat((i == 0) ? GTA.VehicleSeat.Driver : GTA.VehicleSeat.Any); if (!(ped == null)) { ped.Weapons.Give(Database.WeaponHashes[Database.Random.Next(Database.WeaponHashes.Length)], 25, true, true); ped.SetCombatAttributes(CombatAttributes.AlwaysFight, true); ped.SetAlertness(Alertness.FullyAlert); ped.RelationshipGroup = Relationships.HostileRelationship; _group.Add(ped, i == 0); Blip blip = ped.AddBlip(); blip.Name = "Enemy"; _peds.Add(ped); EntityEventWrapper pedWrapper = new EntityEventWrapper(ped); pedWrapper.Died += PedWrapperOnDied; pedWrapper.Updated += PedWrapperOnUpdated; pedWrapper.Disposed += PedWrapperOnDisposed; } } } UI.Notify("~r~Hostiles~s~ nearby!"); } } }
public Racer(Vehicle model, Ped racer, string name) { if (Util.CanWeUse(racer)) { Name = name; car = racer.CurrentVehicle; driver = racer; driver.SetIntoVehicle(car, VehicleSeat.Driver); if (!driver.IsPlayer) { Function.Call(GTA.Native.Hash.SET_DRIVER_AGGRESSIVENESS, driver, 0); Function.Call(GTA.Native.Hash.SET_DRIVER_ABILITY, driver, 10f); driver.AlwaysKeepTask = true; driver.BlockPermanentEvents = true; Blip blip = car.AddBlip(); blip.Color = BlipColor.Blue; blip.Name = Name; Function.Call(GTA.Native.Hash._0x0DC7CABAB1E9B67E, driver, true); //Load Collision Function.Call(GTA.Native.Hash._0x0DC7CABAB1E9B67E, car, true); //Load Collision car.EngineRunning = true; } if (StreetRaces.AIGodmode.Checked) { Function.Call(Hash.SET_VEHICLE_STRONG, car, true); car.IsInvincible = true; car.IsAxlesStrong = true; car.IsCollisionProof = true; car.IsBulletProof = true; car.IsExplosionProof = true; car.IsFireProof = true; if (driver.IsPlayer) { driver.IsInvincible = true; driver.IsCollisionProof = true; driver.IsBulletProof = true; driver.IsExplosionProof = true; driver.IsFireProof = true; } } } }
/// <summary> /// The mission setup. This spawns things like vehicles, blips, etc /// </summary> public override void Start() { this.pay = 1000; issi = World.CreateVehicle(new Model("issi2"), new Vector3(-926.974f, 11.819f, 47.719f), 214.167f); Main.spawnedVehicles.Add(issi); issiBlip = issi.AddBlip(); issiBlip.Name = "Issi"; issiBlip.Color = BlipColor.Blue; mansionBlip = World.CreateBlip(new Vector3(-926.974f, 11.819f, 47.719f)); mansionBlip.Color = BlipColor.Yellow; mansionBlip.Name = "Mansion"; mansionBlip.ShowRoute = true; Main.blips.Add(mansionBlip); Main.blips.Add(issiBlip); }
void SpawnEnemyJetPack_minigun() { float n1 = 100f + nX; float n2 = 40f + nY; float n3 = 101f + nX; float n4 = 40f + nY; if (EnemyPed_List == 0) { EnemyPedModelName = EnemyPedModelName1; } else if (EnemyPed_List == 1) { EnemyPedModelName = EnemyPedModelName2; } else { EnemyPedModelName = EnemyPedModelName3; } Vector3 EnemyJetPackPos = Game.Player.Character.Position + Game.Player.Character.UpVector * n2 + Game.Player.Character.ForwardVector * n1; //喷气背包刷出位置 EnemyJetPack_minigun = World.CreateVehicle(EnemyVehicleModelName, EnemyJetPackPos); //喷气背包刷出 Function.Call(Hash.SET_VEHICLE_ENGINE_ON, EnemyJetPack_minigun, true); Function.Call(Hash.SET_VEHICLE_MOD_KIT, EnemyJetPack_minigun, 0); Function.Call(Hash.SET_VEHICLE_MOD, EnemyJetPack_minigun, 10, 0, true); //给予喷气背包火神机枪的改装件 Vector3 EnemyJetPackDriverPos = Game.Player.Character.Position + Game.Player.Character.UpVector * n4 + Game.Player.Character.ForwardVector * n3; //喷气背包驾驶员JetPackDriver刷出位置 EnemyJetPackDriver = World.CreatePed(EnemyPedModelName, EnemyJetPackDriverPos); //喷气背包驾驶员JetPackDriver刷出 Function.Call(Hash.SET_PED_INTO_VEHICLE, EnemyJetPackDriver, EnemyJetPack_minigun, -1); //JetPackDriver进入喷气背包驾驶位 EnemyJetPackDriver.AlwaysKeepTask = true; //始终保持任务 EnemyJetPackDriver.Health = EnemyHp; //生命值 EnemyJetPackDriver.Armor = EnemyArmor; //护甲 int EnemyRelationShipGroup = Function.Call <int>(Hash.GET_HASH_KEY, "HATES_PLAYER"); //创建恨主角的阵营指数 Function.Call(Hash.SET_PED_RELATIONSHIP_GROUP_HASH, EnemyJetPackDriver, EnemyRelationShipGroup); //设置阵营为敌对阵营 Enemyblip = EnemyJetPack_minigun.AddBlip(); Enemyblip.Sprite = (BlipSprite)597; //强制转换枚举 EnemyJetPack_minigun.CurrentBlip.Color = BlipColor.Red; EnemyJetPack_minigun.CurrentBlip.Scale = 0.6f; EnemyJet.Add(new Tuple <Ped, Vehicle, Blip>(EnemyJetPackDriver, EnemyJetPack_minigun, Enemyblip)); UI.Notify(Spawed3[L]); }
protected internal VehicleMenu() : base("Vehicle Options") { SPEED_POINT = new System.Drawing.Point(SPEED_X, SPEED_Y); menu_speed_type = new UIMenuListItem("Display", speedTypes, 0); var spawn_menu = Main.Pool.AddSubMenu(menu, "Vehicles >>"); doorControl = new VehicleMenu_DoorControl(Main.Pool.AddSubMenu(menu, "Door Control >>")); spawn_menu.AddItem(menu_spawner_spawninveh); spawn_menu.AddItem(menu_spawner_showblip); foreach (SortedVehicleGroup group in SortedVehicleGroup.GetVehicleGroups()) { var submenu = Main.Pool.AddSubMenu(spawn_menu, group.Name); foreach (KeyValuePair <string, VehicleHash> pair in group.Vehicles) { var _menu = new UIMenuItem(pair.Key, $"Spawn a {pair.Key}"); _menu.Activated += (sender, args) => { Vehicle veh = GTA.World.CreateVehicle(pair.Value, playerPed.Position.Around(5)); if (menu_spawner_showblip.Checked) { Blip b = veh.AddBlip(); b.IsFriendly = true; b.IsShortRange = true; b.Name = String.Format("Spawned Car {0}", Enum.GetName(typeof(VehicleHash), (VehicleHash)veh.Model.Hash).ToString()); b.Sprite = BlipSprite.PersonalVehicleCar; } if (menu_spawner_spawninveh.Checked) { playerPed.SetIntoVehicle(veh, VehicleSeat.Driver); } }; submenu.AddItem(_menu); } } menu.AddItem(menu_godmode); menu.AddItem(menu_bullet_proof_tires); menu.AddItem(menu_repair); menu.AddItem(menu_show_health); menu.AddItem(menu_speed); menu.AddItem(menu_speed_type); menu.AddItem(menu_boost); }
private void onKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.NumPad1) { Vector3 safePos = World.GetNextPositionOnStreet(Game.Player.Character.GetOffsetInWorldCoords(new Vector3(80, 80, 50)), true); Vehicle car = World.CreateVehicle(VehicleHash.Stockade, safePos, getRoadHeading(safePos)); Blip carBlip = car.AddBlip(); carBlip.Scale = 0.5f; listVehicle.Add(car); listBlip.Add(carBlip); UI.Notify(listVehicle.ToString()); } if (e.KeyCode == Keys.NumPad3) { UI.Notify("" + enabled.ToString()); } }
/// <summary> /// The mission setup. This spawns things like vehicles, blips, etc /// </summary> public override void Start() { this.pay = 5000; voltic = World.CreateVehicle(new Model("voltic"), new Vector3(-926.974f, 11.819f, 47.719f), 214.167f); Main.spawnedVehicles.Add(voltic); volticBlip = voltic.AddBlip(); volticBlip.Name = "Voltic"; volticBlip.Color = BlipColor.Blue; mansionBlip = World.CreateBlip(new Vector3(-926.974f, 11.819f, 47.719f)); mansionBlip.Color = BlipColor.Yellow; mansionBlip.Name = "Mansion"; mansionBlip.ShowRoute = true; Main.drawnBlips.Add(mansionBlip); Main.drawnBlips.Add(volticBlip); UI.ShowSubtitle("Go to the ~y~Mansion", 15000); }
void SpawnFriendlyJetPack_minigun() { float n1 = -25f + nX; float n2 = -26f + nX; if (FriendlyPed_List == 0) { FriendlyPedModelName = FriendlyPedModelName1; } else if (FriendlyPed_List == 1) { FriendlyPedModelName = FriendlyPedModelName2; } else { FriendlyPedModelName = FriendlyPedModelName3; } Vector3 FriendlyJetPackPos = Game.Player.Character.Position + Game.Player.Character.UpVector * 40f + Game.Player.Character.ForwardVector * n1; //喷气背包刷出位置 FriendlyJetPack_minigun = World.CreateVehicle(FriendlyVehicleModelName, FriendlyJetPackPos); //喷气背包刷出 Function.Call(Hash.SET_VEHICLE_ENGINE_ON, FriendlyJetPack_minigun, true); Function.Call(Hash.SET_VEHICLE_MOD_KIT, FriendlyJetPack_minigun, 0); Function.Call(Hash.SET_VEHICLE_MOD, FriendlyJetPack_minigun, 10, 0, true); //给予喷气背包火神机枪的改装件 Vector3 FriendlyJetPackDriverPos = Game.Player.Character.Position + Game.Player.Character.UpVector * 40f + Game.Player.Character.ForwardVector * n2; //喷气背包驾驶员JetPackDriver刷出位置 FriendlyJetPackDriver = World.CreatePed(FriendlyPedModelName, FriendlyJetPackDriverPos); //喷气背包驾驶员JetPackDriver刷出 Function.Call(Hash.SET_PED_INTO_VEHICLE, FriendlyJetPackDriver, FriendlyJetPack_minigun, -1); //JetPackDriver进入喷气背包驾驶位 FriendlyJetPackDriver.Task.FightAgainstHatedTargets(500f); //对抗半径500米的一切敌对目标 FriendlyJetPackDriver.AlwaysKeepTask = true; //始终保持任务 FriendlyJetPackDriver.Health = FriendlyHp; //生命值 FriendlyJetPackDriver.Armor = FriendlyArmor; //护甲 FriendlyJetPackDriver.RelationshipGroup = Game.Player.Character.RelationshipGroup; //设置喷气背包驾驶员JetPackDriver属于主角阵营 Friendlyblip = FriendlyJetPack_minigun.AddBlip(); Friendlyblip.Sprite = (BlipSprite)597; //强制转换枚举 FriendlyJetPack_minigun.CurrentBlip.Color = BlipColor.Blue; FriendlyJetPack_minigun.CurrentBlip.Scale = 0.6f; FriendlyJet.Add(new Tuple <Ped, Vehicle, Blip>(FriendlyJetPackDriver, FriendlyJetPack_minigun, Friendlyblip)); Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, FriendlyJetPackDriver, FriendlyJetPack_minigun, PlayerPos.X, PlayerPos.Y, PlayerPos.Z, 30f, 1f, 1489874736, 16777216, 1f, true); UI.Notify(Spawed2[L]); }
private static void Drive() { if (driver != null) { driver.Delete(); } vehicle = Game.Player.Character.LastVehicle; vehicle.AddBlip().Sprite = BlipSprite.PersonalVehicleCar; driver = vehicle.CreateRandomPedOnSeat(VehicleSeat.Driver); currentplayerPos = Game.Player.Character.Position; currentplayerPos = currentplayerPos + Game.Player.Character.ForwardVector; driver.Task.DriveTo(vehicle, currentplayerPos, 15f, 10f); }
public SpawnedDrivingGangMember SpawnGangVehicle(Gang ownerGang, Vector3 spawnPos, Vector3 destPos, bool playerIsDest = false, bool mustReachDest = false, SuccessfulMemberSpawnDelegate onSuccessfulPassengerSpawn = null) { if (livingMembersCount >= ModOptions.instance.spawnedMemberLimit || spawnPos == Vector3.Zero || ownerGang.carVariations == null) { //don't start spawning, we're on the limit already or we failed to find a good spawn point or we haven't started up our data properly yet return(null); } if (ownerGang.carVariations.Count > 0) { Logger.Log("spawn car: start"); Vehicle newVehicle = World.CreateVehicle(RandoMath.GetRandomElementFromList(ownerGang.carVariations).modelHash, spawnPos); if (newVehicle != null) { newVehicle.PrimaryColor = ownerGang.vehicleColor; SpawnedGangMember driver = SpawnGangMember(ownerGang, spawnPos, onSuccessfulMemberSpawn: onSuccessfulPassengerSpawn); if (driver != null) { driver.curStatus = SpawnedGangMember.MemberStatus.inVehicle; driver.watchedPed.SetIntoVehicle(newVehicle, VehicleSeat.Driver); int passengerCount = newVehicle.PassengerSeats; if (destPos == Vector3.Zero && passengerCount > 4) { passengerCount = 4; //limit ambient passengers in order to have less impact in ambient spawning } for (int i = 0; i < passengerCount; i++) { SpawnedGangMember passenger = SpawnGangMember(ownerGang, spawnPos, onSuccessfulMemberSpawn: onSuccessfulPassengerSpawn); if (passenger != null) { passenger.curStatus = SpawnedGangMember.MemberStatus.inVehicle; passenger.watchedPed.SetIntoVehicle(newVehicle, VehicleSeat.Any); } } SpawnedDrivingGangMember driverAI = EnlistDrivingMember(driver.watchedPed, newVehicle, destPos, ownerGang == GangManager.instance.PlayerGang, playerIsDest, mustReachDest); if (ModOptions.instance.showGangMemberBlips) { newVehicle.AddBlip(); newVehicle.CurrentBlip.IsShortRange = true; Function.Call(Hash.SET_BLIP_COLOUR, newVehicle.CurrentBlip, ownerGang.blipColor); } Logger.Log("spawn car: end (success)"); return(driverAI); } else { newVehicle.Delete(); Logger.Log("spawn car: end (fail: couldnt spawn driver)"); return(null); } } Logger.Log("spawn car: end (fail: car creation failed)"); } return(null); }
private void OnTick(object sender, EventArgs e) { // If this mission has been completed if (Manager.Completion.Mission02 != 0) { // Remove the tick event and return Tick -= OnTick; return; } // If the 1st mission has not been completed if (Manager.Completion.Mission01 == 0) { // Return, because the user needs to complete that first return; } // If the player has not been notified and a minute has passed since the last mission if (!IsPlayerNotified && !IsInProgress && ((DateTime.UtcNow - DateTime.MinValue).TotalSeconds - Manager.Completion.Mission01) >= 60) { // Notify the user UI.Notify(Manager.Strings["M02_SMS"]); IsPlayerNotified = true; return; } // If the player has been notified and the mission has not been started if (IsPlayerNotified && !IsInProgress && Game.Player.CanControlCharacter) { // Draw a little marker where the mission should start World.DrawMarker(MarkerType.VerticalCylinder, Start, Vector3.Zero, Vector3.Zero, new Vector3(1, 1, 1), Color.Yellow); // If the player is near mission start witout a vehicle if (Start.DistanceTo(Game.Player.Character.Position) < 2 && Game.Player.Character.CurrentVehicle == null) { // Fade the screen out Game.FadeScreenOut(1000); Wait(1000); // Mark the mission as started IsInProgress = true; // And disable the notification flag IsPlayerNotified = false; // Change the time of day to morning World.CurrentDayTime = new TimeSpan(7, 0, 0); // Move the player to an appropiate position and lock him in place Game.Player.Character.Position = new Vector3(1290.3f, -1714, 54); Game.Player.Character.Heading = 111; Game.Player.Character.FreezePosition = true; // Request the freemode male model Model FreemodeMale = new Model(PedHash.FreemodeMale01); FreemodeMale.Request(); // Wait until the model has been loaded while (!FreemodeMale.IsLoaded) { Yield(); } // Then, spawn the objective ped and also freeze it in place Ped Objective = World.CreatePed(FreemodeMale, new Vector3(1288.5f, -1714, 54), 396.4f); Objective.Heading = 293; Objective.FreezePosition = true; // Fade in Game.FadeScreenIn(1000); Wait(1000); // And print the dialog UI.ShowSubtitle(Manager.Strings["M02_SUB01"], 4000); Wait(4000); UI.ShowSubtitle(Manager.Strings["M02_SUB02"], 4000); Wait(4000); UI.ShowSubtitle(Manager.Strings["M02_SUB03"], 4000); Wait(4000); UI.ShowSubtitle(Manager.Strings["M02_SUB04"], 4000); Wait(4000); UI.ShowSubtitle(Manager.Strings["M02_SUB05"], 4000); Wait(4000); // Then, fade out again Game.FadeScreenOut(1000); Wait(1000); // Remove the ped Objective.Delete(); // Change the player position Game.Player.Character.Position = new Vector3(1292.2f, -1718.4f, 54); Game.Player.Character.Heading = 206.5f; // Request the Banshee model Model Banshee = new Model(VehicleHash.Banshee2); Banshee.Request(); while (!Banshee.IsLoaded) { Yield(); } // Create a vehicle and add a blip Target = World.CreateVehicle(Banshee, new Vector3(1054.3f, -3039.7f, 5.7f), 268.2f); Target.AddBlip(); Target.CurrentBlip.Sprite = BlipSprite.GetawayCar; Target.CurrentBlip.IsShortRange = false; Target.CurrentBlip.Color = BlipColor.Green; // Change some tunning options Function.Call(Hash.SET_VEHICLE_EXTRA, Target, 2, 1); // Destroy the old blip MissionBlip.Remove(); MissionBlip = null; // Fade back in Game.FadeScreenIn(1000); Wait(750); // Unfreeze the player Game.Player.Character.FreezePosition = false; // And show a subtitle with instructions UI.ShowSubtitle(Manager.Strings["M02_SUB07"], 4000); } // If there is no blip and no vehicle to steal if (MissionBlip == null && Target == null) { // Create a blip on the start position MissionBlip = World.CreateBlip(Start); MissionBlip.Sprite = BlipSprite.Lester; MissionBlip.Color = BlipColor.Yellow; MissionBlip.Name = "Placeholder (LMP)"; } } // If the mission is in progress, the plalyer has not been notified and there is a vehicle if (IsInProgress && !IsPlayerNotified && Target != null) { // If the player is getting near the vehicle if (Target.Position.DistanceTo(Game.Player.Character.Position) < 500) { // Notify the player about the enemies UI.Notify(Manager.Strings["M02_SUB06"], true); IsPlayerNotified = true; // Request the models Model Triad1 = new Model(PedHash.ArmBoss01GMM); Triad1.Request(); while (!Triad1.IsLoaded) { Yield(); } // Create the enemies Enemies = new List <Ped> { World.CreatePed(Triad1, new Vector3(1046.3f, -3042.3f, 17.2f), 268.5f), World.CreatePed(Triad1, new Vector3(1059.6f, -3034.5f, 5.9f), 229f), World.CreatePed(Triad1, new Vector3(1051.9f, -3047.6f, 5.9f), 222.9f), World.CreatePed(Triad1, new Vector3(1048.9f, -3041.7f, 5.9f), 292.4f), World.CreatePed(Triad1, new Vector3(1059.7f, -3035.8f, 5.9f), 225f), }; // And add weapons to them foreach (Ped Enemy in Enemies) { Enemy.Weapons.Give(WeaponHash.CarbineRifleMk2, 9999, false, true); } } } }
//public Ped target=null; public Hunter(Vector3 place) { Function.Call(Hash.REQUEST_MISSION_AUDIO_BANK, "SCRIPT\\HUNTING_2_ELK_CALLS", 0, -1); if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Called for Hunter Event"); } /* * if( place == Vector3.Zero) * { * for (int i = 0; i < 50; i++) * { * if (place == Vector3.Zero) * { * place = LivelyWorld.GenerateSpawnPos(fix, LivelyWorld.Nodetype.Offroad, false);// World.GetSafeCoordForPed(Game.Player.Character.Position.Around(100), false); * } * } * }*/ if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Found suitable place, spawning Hunter"); } HunterPed = World.CreatePed(PedHash.Hunter, place); Vector3 pos = HunterPed.Position; if (LivelyWorld.DebugBlips) { HunterPed.AddBlip(); HunterPed.CurrentBlip.Sprite = BlipSprite.Hunting; HunterPed.CurrentBlip.Color = BlipColor.Yellow; HunterPed.CurrentBlip.IsShortRange = true; HunterPed.CurrentBlip.Name = "Hunter"; } HunterPed.AlwaysKeepTask = true; HunterPed.Accuracy = 100; //if(Game.Player.Character.Position.DistanceTo(place)>50F) DespawnRange = Game.Player.Character.Position.DistanceTo(place)*1.5f; //HunterPed.FiringPattern = FiringPattern.SingleShot; HunterPed.Weapons.Give(WeaponHash.SniperRifle, 999, true, true); HunterPed.Weapons.Current.SetComponent(WeaponComponent.AtArSupp02, true); if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Set up"); } World.SetRelationshipBetweenGroups(Relationship.Respect, HunterRLGroup, Game.GenerateHash("CIVMALE")); World.SetRelationshipBetweenGroups(Relationship.Respect, Game.GenerateHash("CIVMALE"), HunterRLGroup); World.SetRelationshipBetweenGroups(Relationship.Respect, Game.GenerateHash("CIVFEMALE"), HunterRLGroup); World.SetRelationshipBetweenGroups(Relationship.Respect, HunterRLGroup, Game.GenerateHash("CIVFEMALE")); World.SetRelationshipBetweenGroups(Relationship.Respect, Game.GenerateHash("COP"), HunterRLGroup); World.SetRelationshipBetweenGroups(Relationship.Respect, HunterRLGroup, Game.GenerateHash("COP")); World.SetRelationshipBetweenGroups(Relationship.Hate, HunterRLGroup, Game.GenerateHash("WILD_ANIMAL")); //World.SetRelationshipBetweenGroups(Relationship.Hate, Game.GenerateHash("WILD_ANIMAL"), HunterRLGroup); //World.SetRelationshipBetweenGroups(Relationship.Hate, Game.GenerateHash("DEER"), HunterRLGroup); World.SetRelationshipBetweenGroups(Relationship.Hate, HunterRLGroup, Game.GenerateHash("DEER")); if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - animal relationships set"); } //World.SetRelationshipBetweenGroups(Relationship.Hate, HunterRLGroup, Game.GenerateHash("PLAYER")); //World.SetRelationshipBetweenGroups(Relationship.Hate, Game.GenerateHash("PLAYER"), HunterRLGroup); //Function.Call(Hash.SET_PED_STEALTH_MOVEMENT, HunterPed, 1,0); //Function.Call(Hash.SET_PED_TARGET_LOSS_RESPONSE, HunterPed, 3); if (LivelyWorld.RandomInt(0, 10) <= 5) { HunterCar = World.CreateVehicle(LivelyWorld.HuntingTrucks[LivelyWorld.RandomInt(0, LivelyWorld.HuntingTrucks.Count - 1)], HunterPed.Position + (HunterPed.ForwardVector * -8)); //World.GetNextPositionOnStreet(HunterPed.Position) //LivelyWorld.MoveEntitytoNearestRoad(HunterCar,false,true); HunterCar.Position = HunterCar.Position + (HunterCar.RightVector * 3); if (LivelyWorld.DebugBlips) { HunterCar.AddBlip(); HunterCar.CurrentBlip.Sprite = BlipSprite.PersonalVehicleCar; HunterCar.CurrentBlip.Color = BlipColor.Yellow; HunterCar.CurrentBlip.IsShortRange = true; HunterCar.CurrentBlip.Name = "Hunter's car"; } } else { HunterDog = World.CreatePed(PedHash.Retriever, HunterPed.Position.Around(0)); HunterDog.RelationshipGroup = HunterRLGroup; HunterDog.AlwaysKeepTask = true; HunterDog.BlockPermanentEvents = true; } HunterPed.RelationshipGroup = HunterRLGroup; int patience = 0; while (patience < 500 && (!Function.Call <bool>(Hash.HAS_ANIM_SET_LOADED, "move_ped_crouched") || !Function.Call <bool>(Hash.HAS_ANIM_SET_LOADED, "move_ped_crouched_strafing"))) { patience++; Function.Call(Hash.REQUEST_ANIM_SET, "move_ped_crouched"); Function.Call(Hash.REQUEST_ANIM_SET, "move_ped_crouched_strafing"); } Script.Wait(300); Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, HunterPed, "move_ped_crouched", 1048576000); Function.Call(Hash.SET_PED_STRAFE_CLIPSET, HunterPed, "move_ped_crouched_strafing"); Function.Call(Hash.SET_PED_SEEING_RANGE, HunterPed, 150f); Function.Call(Hash.SET_PED_VISUAL_FIELD_MIN_ELEVATION_ANGLE, HunterPed, -40f); Function.Call(Hash.SET_PED_VISUAL_FIELD_MAX_ELEVATION_ANGLE, HunterPed, 5f); Function.Call(Hash.SET_PED_SHOOT_RATE, HunterPed, 50); Function.Call(Hash.SET_PED_COMBAT_MOVEMENT, HunterPed, 0); Function.Call(Hash.SET_PED_TARGET_LOSS_RESPONSE, HunterPed, 0); Function.Call(Hash.TASK_WANDER_IN_AREA, HunterPed, pos.X, pos.Y, pos.Z, 100f, 2f, 3f); //Function.Call(Hash.TASK_WANDER_STANDARD, HunterPed, 20f,0); if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - spawn finished"); } }
public static void spawn(Model Deloreanmodel, double movie, bool rescue) { if (Deloreanmodel.IsValid) { try { Vehicle Deloreon = null; Vector3 position; if (rescue) { position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 50, 0)); } else { position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 0, 0)); } // At 90 degrees to the players heading float heading = Game.Player.Character.Heading - 90; Ped traveler = null; //mainsystem.messageerrors[3] = "after traveler is null"; while (Deloreon == null) { try { Deloreon = World.CreateVehicle(Deloreanmodel, position, heading); //if (!Function.Call<bool>(Hash.IS_VEHICLE_EXTRA_TURNED_ON, new InputArgument[] { Deloreon, 10 })) //{ // Function.Call(Hash.SET_VEHICLE_EXTRA, new InputArgument[] { Deloreon, 10, 0 }); //} //if (Function.Call<bool>(Hash.IS_VEHICLE_EXTRA_TURNED_ON, new InputArgument[] { Deloreon, 1 })) //{ // Function.Call(Hash.SET_VEHICLE_EXTRA, new InputArgument[] { Deloreon, 1, -1 }); //} } catch { } if (Deloreon == null && Function.Call <bool>(Hash.IS_VEHICLE_EXTRA_TURNED_ON, new InputArgument[] { Deloreon, 1 })) { Script.Wait(500); } //else //{ // break; //} } if (rescue) { Deloreon.Rotation = new Vector3(Game.Player.Character.Rotation.X, Game.Player.Character.Rotation.Y, Game.Player.Character.Rotation.Z + 180); } else { Deloreon.Rotation = new Vector3(Game.Player.Character.Rotation.X, Game.Player.Character.Rotation.Y, Game.Player.Character.Rotation.Z); } Deloreon.PlaceOnGround(); Deloreon.DirtLevel = 0; Deloreon.NumberPlate = "OutATime"; Script.Wait(50); //Game.Player.Character.Task.WarpIntoVehicle(Deloreon, VehicleSeat.Driver); Deloreon.AddBlip(); if (rescue) { traveler = Deloreon.CreatePedOnSeat(VehicleSeat.Driver, Game.Player.Character.Model); traveler.RandomizeOutfit(); Deloreon.IsVisible = false; timecurcuitssystem.addToList(Game.GetUserInput(7).ToUpper(), movie, Deloreon, true); traveler.CanBeDraggedOutOfVehicle = true; if (movie == 3 || movie == 3.5) { Sounds.reenterybttf3.Play(); } else if (movie == 1) { Sounds.reenterybttf1.Play(); } else { Sounds.reenterybttf2.Play(); } if (Deloreon.Model == new Model("BTTF")) { World.DrawSpotLight(Deloreon.Position, Deloreon.Rotation, Color.SkyBlue, 80, 100, 60, 100, 5); Deloreon.IsVisible = true; Script.Wait(10); Deloreon.Speed = 0; Deloreon.IsVisible = false; Deloreon.Speed = 0; Script.Wait(50); Deloreon.Speed = 0; World.DrawSpotLight(Deloreon.Position, Deloreon.Rotation, Color.SkyBlue, 80, 100, 60, 100, 5); Deloreon.IsVisible = true; Script.Wait(10); Deloreon.Speed = 0; Deloreon.IsVisible = false; Script.Wait(50); Deloreon.Speed = 0; World.DrawSpotLight(Deloreon.Position, Deloreon.Rotation, Color.SkyBlue, 80, 100, 60, 100, 5); Deloreon.IsVisible = true; Script.Wait(10); Deloreon.Speed = 0; } else { try { World.DrawSpotLight(Deloreon.Position, Deloreon.Rotation, Color.DeepSkyBlue, 80, 100, 60, 100, 5); Deloreon.Speed = 0; if (Deloreon.Model == new Model("BTTF3") || Deloreon.Model == new Model("BTTF3rr")) { effects.make_effect("scr_martin1", "scr_sol1_sniper_impact", Deloreon); } Script.Wait(700); Deloreon.Speed = 0; if (Deloreon.Model == new Model("BTTF3") || Deloreon.Model == new Model("BTTF3rr")) { effects.make_effect("scr_martin1", "scr_sol1_sniper_impact", Deloreon); } World.DrawSpotLight(Deloreon.Position, Deloreon.Rotation, Color.DeepSkyBlue, 80, 100, 60, 100, 5); Script.Wait(700); Deloreon.Speed = 0; if (Deloreon.Model == new Model("BTTF3") || Deloreon.Model == new Model("BTTF3rr")) { effects.make_effect("scr_martin1", "scr_sol1_sniper_impact", Deloreon); } World.DrawSpotLight(Deloreon.Position, Deloreon.Rotation, Color.DeepSkyBlue, 80, 100, 60, 100, 5); } catch { } } Deloreon.Speed = 30; Script.Wait(10); Deloreon.IsVisible = true; traveler.IsVisible = true; while (Deloreon.Speed != 0) { Script.Wait(50); Deloreon.ApplyForceRelative(new Vector3(0, 0, 0), new Vector3(30, 0, 0)); } traveler.Task.LeaveVehicle(Deloreon, false); for (int count = 0; count < 100; count++) { Doors.doors(true, Deloreon, false); Script.Wait(10); } traveler.Task.GoTo(Deloreon.GetOffsetInWorldCoords(new Vector3(0, -3.6f, 0)), false); for (int count = 0; count < 100; count++) { Doors.doors(true, Deloreon, false); Script.Wait(10); } traveler.Task.GoTo(Deloreon.GetOffsetInWorldCoords(new Vector3(0, -2.3f, 0)), true); for (int count = 0; count < 70; count++) { Doors.doors(true, Deloreon, false); Script.Wait(10); } traveler.Task.ClearAll(); Function.Call(Hash.REQUEST_ANIM_DICT, "ah_1_mcs_1-0"); while (!Function.Call <bool>(Hash.HAS_ANIM_DICT_LOADED, "ah_1_mcs_1-0")) { Doors.doors(true, Deloreon, false); Script.Wait(10); } Game.Player.Character.Position = Deloreon.GetOffsetInWorldCoords(new Vector3(0, -2.3f, -1)); Game.Player.Character.Rotation = Deloreon.Rotation; Function.Call(Hash.REQUEST_ANIM_DICT, "ah_1_mcs_1-0"); Vector3 animxyz = Game.Player.Character.Position; Vector3 animrot = Game.Player.Character.Rotation; Function.Call(Hash.TASK_PLAY_ANIM_ADVANCED, Game.Player.Character, "ah_1_mcs_1-0", "csb_janitor_dual-0", animxyz.X, animxyz.Y, animxyz.Z, animrot.X, animrot.Y, animrot.Z, 0.8f, 0.5, 6000, (int)AnimationFlags.UpperBodyOnly, 0.35f, false, false); for (int count = 0; count < 15; count++) { Doors.doors(true, Deloreon, false); Script.Wait(10); } if (Deloreon != null) { if (Deloreon.Model == "bttf") { Sounds.pr0load.Play(); Deloreon.OpenDoor(VehicleDoor.Trunk, false, false); Script.Wait(3000); Deloreon.CloseDoor(VehicleDoor.Trunk, false); Script.Wait(500); Function.Call(Hash.STOP_ANIM_TASK, Game.Player.Character, "ah_1_mcs_1-0", "csb_janitor_dual-0", 1); } else { Sounds.Mrfrusionfill.Play(); Deloreon.OpenDoor(VehicleDoor.Trunk, false, false); Script.Wait(4000); Deloreon.CloseDoor(VehicleDoor.Trunk, false); } Traveler.traveler = traveler; Traveler.enabled = false; } } else { Game.Player.Character.Task.WarpIntoVehicle(Deloreon, VehicleSeat.Driver); timecurcuitssystem.addToList(Game.GetUserInput(7).ToUpper(), movie, Deloreon); } } catch { //mainsystem.messageerrors[0] = d.Message; //mainsystem.messageerrors[1] = d.Source; //mainsystem.messageerrors[2] = d.TargetSite.ToString(); //mainsystem.display_errors = true; } } }
public override void Start() { pay = 50000000; // Create the vehicles and their blips truck1 = World.CreateVehicle(new Model("stockade"), truck1Spawn); truck2 = World.CreateVehicle(new Model("stockade"), truck2Spawn); truck3 = World.CreateVehicle(new Model("stockade"), truck3Spawn); issi = World.CreateVehicle(new Model("issi2"), new Vector3(22.32739f, -649.8838f, 16.08807f)); issi.InstallModKit(); truck1.PrimaryColor = VehicleColor.BrushedBlackSteel; truck2.PrimaryColor = VehicleColor.BrushedBlackSteel; truck3.PrimaryColor = VehicleColor.BrushedBlackSteel; truck1.SecondaryColor = VehicleColor.BrushedBlackSteel; truck2.SecondaryColor = VehicleColor.BrushedBlackSteel; truck3.SecondaryColor = VehicleColor.BrushedBlackSteel; truck1Blip = truck1.AddBlip(); truck2Blip = truck2.AddBlip(); truck3Blip = truck3.AddBlip(); truck1Blip.Color = BlipColor.Blue; truck2Blip.Color = BlipColor.Blue; truck3Blip.Color = BlipColor.Blue; // Create the drivers truck1Driver = truck1.CreatePedOnSeat(VehicleSeat.Driver, new Model("s_m_m_armoured_01")); truck2Driver = truck2.CreatePedOnSeat(VehicleSeat.Driver, new Model("s_m_m_armoured_01")); truck3Driver = truck3.CreatePedOnSeat(VehicleSeat.Driver, new Model("s_m_m_armoured_01")); truck1Driver.Weapons.Give(GTA.Native.WeaponHash.AssaultrifleMk2, 5000, true, true); truck2Driver.Weapons.Give(GTA.Native.WeaponHash.AssaultrifleMk2, 5000, true, true); truck3Driver.Weapons.Give(GTA.Native.WeaponHash.AssaultrifleMk2, 5000, true, true); truck1Driver.Weapons.Give(GTA.Native.WeaponHash.PistolMk2, 5000, true, true); truck2Driver.Weapons.Give(GTA.Native.WeaponHash.PistolMk2, 5000, true, true); truck3Driver.Weapons.Give(GTA.Native.WeaponHash.PistolMk2, 5000, true, true); truck1Driver.Armor = 100; truck2Driver.Armor = 100; truck3Driver.Armor = 100; truck1Driver.RelationshipGroup = (int)Relationship.Dislike; truck2Driver.RelationshipGroup = (int)Relationship.Dislike; truck3Driver.RelationshipGroup = (int)Relationship.Dislike; // Create the passengers truck1Pass = truck1.CreatePedOnSeat(VehicleSeat.Passenger, new Model("s_m_m_armoured_01")); truck2Pass = truck2.CreatePedOnSeat(VehicleSeat.Passenger, new Model("s_m_m_armoured_01")); truck3Pass = truck3.CreatePedOnSeat(VehicleSeat.Passenger, new Model("s_m_m_armoured_01")); truck1Pass.Weapons.Give(GTA.Native.WeaponHash.AssaultrifleMk2, 5000, true, true); truck2Pass.Weapons.Give(GTA.Native.WeaponHash.AssaultrifleMk2, 5000, true, true); truck3Pass.Weapons.Give(GTA.Native.WeaponHash.AssaultrifleMk2, 5000, true, true); truck1Pass.Weapons.Give(GTA.Native.WeaponHash.PistolMk2, 5000, true, true); truck2Pass.Weapons.Give(GTA.Native.WeaponHash.PistolMk2, 5000, true, true); truck3Pass.Weapons.Give(GTA.Native.WeaponHash.PistolMk2, 5000, true, true); truck1Pass.Armor = 100; truck2Pass.Armor = 100; truck3Pass.Armor = 100; truck1Pass.RelationshipGroup = (int)Relationship.Dislike; truck2Pass.RelationshipGroup = (int)Relationship.Dislike; truck3Pass.RelationshipGroup = (int)Relationship.Dislike; // Driver AI truck1Driver.Task.CruiseWithVehicle(truck1, 25, 786603); truck2Driver.Task.DriveTo(truck2, new Vector3(-942.4401f, -2752.101f, 13.40687f), 10, 20, 786603); truck3Driver.Task.CruiseWithVehicle(truck3, 25, 786603); // Add the gold gold = World.CreateProp(new Model("prop_large_gold"), Vector3.Zero, false, false); gold.AttachTo(truck2, truck2.GetBoneIndex("chassis"), new Vector3(0, -2f, .82f), new Vector3(0, 0, 0)); // Blips tunnelBlip = World.CreateBlip(new Vector3(-64.07829f, -538.8095f, 31.85758f)); tunnelBlip.Color = BlipColor.Yellow; tunnelBlip.ShowRoute = false; tunnelBlip.Alpha = 0; trainBlip = World.CreateBlip(new Vector3(513.2259f, -639.1615f, 24.27212f)); trainBlip.Color = BlipColor.Yellow; trainBlip.Alpha = 0; trainBlip.ShowRoute = false; // Add all of the the vehicles, peds and blips to the lists in Main Main.spawnedVehicles.Add(truck1); Main.spawnedVehicles.Add(truck2); Main.spawnedVehicles.Add(truck3); Main.spawnedVehicles.Add(issi); Main.spawnedPeds.Add(truck1Driver); Main.spawnedPeds.Add(truck2Driver); Main.spawnedPeds.Add(truck3Driver); Main.spawnedPeds.Add(truck1Pass); Main.spawnedPeds.Add(truck2Pass); Main.spawnedPeds.Add(truck3Pass); Main.blips.Add(truck1Blip); Main.blips.Add(truck2Blip); Main.blips.Add(truck3Blip); Main.blips.Add(tunnelBlip); Main.blips.Add(trainBlip); MissionFunc.SendLesterText("They've sent out two extra trucks as decoys. You'll have to find the one with the gold in it."); MissionFunc.SendLesterText("And remember, don't let them get to the airport!"); }
public void prison_escape_tick() { if (steps == 0) { if (Game.Player.Character.IsInVehicle(escape_veh1)) { vehb.Remove(); vehb = escape_veh2.AddBlip(); vehb.Color = BlipColor.Yellow; vehb.ShowRoute = true; UI.ShowSubtitle("Go to the Meeting",3000); steps = 1; } } if (steps == 1) { if (Game.Player.Character.Position.DistanceTo(escape_veh2.Position) < 100f) { vehb.Color = BlipColor.Blue; vehb.ShowRoute = false; UI.ShowSubtitle("Enter the ~b~ Vehicle"); int pgroupe = Game.Player.Character.RelationshipGroup; escape_ped1.RelationshipGroup = pgroupe; GiveAllWeapons(escape_ped1); escape_ped1.CanSwitchWeapons = true; escape_ped2.RelationshipGroup = pgroupe; GiveAllWeapons(escape_ped2); escape_ped2.CanSwitchWeapons = true; original_ped.RelationshipGroup = pgroupe; GiveAllWeapons(original_ped); original_ped.CanSwitchWeapons = true; escape_ped2.Task.EnterVehicle(escape_veh2, VehicleSeat.Passenger, 5000); steps = 2; } } if (steps == 2) { escape_veh1.MarkAsNoLongerNeeded(); if (Game.Player.Character.IsInVehicle(escape_veh2) && escape_ped2.IsInVehicle(escape_veh2)) { vehb.Remove(); escape_veh3.Position = new Vector3(-1179.25f, -2845.386f, 13.5665f); escape_veh3.Heading = 325.6199f; vehb = escape_veh3.AddBlip(); vehb.Color = BlipColor.Blue; UI.ShowSubtitle("Steel the ~b~ Valkyrie ~w~ from ~r~ Airport", 3000); steps = 3; } } if (steps == 3) { if (Game.Player.Character.IsInVehicle(escape_veh3)) { vehb.Remove(); escape_ped2.Task.EnterVehicle(escape_veh3, VehicleSeat.RightRear, 5000); steps = 4; } } if (steps == 4) { if (Game.Player.Character.IsInVehicle(escape_veh3)) { if (escape_ped2.IsInVehicle(escape_veh3)) { UI.ShowSubtitle(""); vehb = World.CreateBlip(new Vector3(1649.463f, 2619.634f, 45.56486f)); vehb.Color = BlipColor.Yellow; vehb.ShowRoute = true; UI.Notify("You can change between you and your partner with ~g~ [E] ~w~ do not use the game Character switche"); original_ped.Task.GoTo(new Vector3(1649.463f, 2619.634f, 45.56486f)); escape_veh2.MarkAsNoLongerNeeded(); steps = 5; } else UI.ShowSubtitle("Wait for the you partner to enter the Valkyrie"); } else { UI.ShowSubtitle("Enter to the Valkyrie"); } } if(steps == 5) { if (Game.Player.Character.Position.DistanceTo(new Vector3(1649.463f, 2619.634f, 45.56486f))<50f) { if (current_ped == 2) { Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped1, 1, 0); steps = 6; } } } if (steps == 6) { if (escape_veh3.IsOnAllWheels && Game.Player.Character.Position.DistanceTo(new Vector3(1649.463f, 2619.634f, 45.56486f)) < 50f) { vehb.Remove(); original_ped.Task.EnterVehicle(escape_veh3, VehicleSeat.LeftRear, 1000); UI.ShowSubtitle("wait for the prisonier"); steps = 7; } } if (steps == 7) { if (original_ped.IsInVehicle(escape_veh3)) { UI.ShowSubtitle("escape the police",5000); vehb.Remove(); steps = 8; } } if (Game.Player.WantedLevel == 0 && steps == 8) { UI.ShowSubtitle("you have escaped"); player_status = status.Off; escape = false; arrested = false; inprison = false; bail.Remove(); roit.Remove(); vehb.Remove(); } }
public bool Process() { ExistingVehicles = 0; foreach (Vehicle v in LivelyWorld.AllVehicles) { if (v.Model == SourceVehicle) { ExistingVehicles++; } } if (ExistingVehicles > 4) { if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Too many vehicles of " + SourceVehicle + " already exist, spawn attempt aborted"); } return(false); } if (Terrain == TerrainType.Water && !LivelyWorld.IsPlayerNearWater(200f)) { return(false); } if (!LivelyWorld.CanWeUse(veh)) { if (Cooldown < Game.GameTime) { Vector3 PlayerPos = Game.Player.Character.Position; if (AreaOrZone == "all" || LivelyWorld.IsInNamedArea(Game.Player.Character, AreaOrZone)) { if (Time == "all" || (LivelyWorld.IsNightTime() && Time == "night") || (!LivelyWorld.IsNightTime() && Time == "day")) { if (LivelyWorld.RandomInt(0, 100) > Prob) { Cooldown = Game.GameTime + CooldownTime; if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Probability check for " + SourceVehicle + " too low, resetting cooldown without spawning."); } return(false); } else { if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Spawning a " + SourceVehicle + ""); } } Vector3 spawnpos = Vector3.Zero; int patience = 0; if (patience < 3) // while (Game.GameTime > patience+3000 && (spawnpos==Vector3.Zero || LivelyWorld.WouldPlayerNoticeChangesHere(spawnpos))) //WOULD_ENTITY_BE_OCCLUDED(Hash entityModelHash, float x, float y, float z, BOOL p4) { patience++; switch (Terrain) { case TerrainType.Road: { int p = 1; spawnpos = Vector3.Zero; while (p < 50 && (spawnpos == Vector3.Zero || LivelyWorld.WouldPlayerNoticeChangesHere(spawnpos))) { p++; spawnpos = LivelyWorld.GenerateSpawnPos(Game.Player.Character.Position.Around(100 + (p * 10)), LivelyWorld.Nodetype.Road, false); Script.Yield(); } break; } case TerrainType.Offroad: { int p = 1; while (p < 50 && (spawnpos == Vector3.Zero || LivelyWorld.WouldPlayerNoticeChangesHere(spawnpos))) { p++; spawnpos = LivelyWorld.GenerateSpawnPos(Game.Player.Character.Position.Around(100 + (p * 10)), LivelyWorld.Nodetype.Offroad, false); Script.Yield(); } break; } case TerrainType.Air: { int traffic = 0; foreach (Vehicle v in LivelyWorld.AllVehicles) { if (v.HeightAboveGround > 20 && (v.Model.IsHelicopter || v.Model.IsPlane)) { traffic++; } } if (traffic > 10) { if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - too much air traffic (>5) to spawn more."); } return(false); } if (new Model(SourceVehicle).IsHelicopter) { spawnpos = Game.Player.Character.Position.Around(LivelyWorld.RandomInt(300, 600)); } else { spawnpos = Game.Player.Character.Position.Around(LivelyWorld.RandomInt(500, 800)); } spawnpos = spawnpos + new Vector3(0, 0, LivelyWorld.RandomInt(50, 100)); break; } case TerrainType.Water: { int traffic = 0; foreach (Vehicle v in LivelyWorld.AllVehicles) { if (v.Model.IsBoat) { traffic++; } } if (traffic > 10) { if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - too much boat traffic (> 5) to spawn more."); } return(false); } if (World.GetZoneNameLabel(Game.Player.Character.Position) == "OCEANA") { foreach (Vector3 v in LivelyWorld.OceanSpawns) { if (Game.Player.Character.IsInRangeOf(v, despawnRange - 100f) && !LivelyWorld.AnyVehicleNear(v, 100f) && !LivelyWorld.WouldPlayerNoticeChangesHere(v)) { spawnpos = v; break; } } } else { spawnpos = LivelyWorld.GenerateSpawnPos(Game.Player.Character.Position.Around(200), LivelyWorld.Nodetype.Water, false); } break; } } } if (spawnpos == Vector3.Zero) { if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - adequate spawn position not found, aborting traffic spawn."); } return(false); } float angle = LivelyWorld.AngleBetweenVectors(Game.Player.Character.Position, spawnpos); if (Terrain != TerrainType.Road) { angle = +LivelyWorld.RandomInt(-90, 90); } veh = World.CreateVehicle(SourceVehicle, spawnpos, angle); if (LivelyWorld.CanWeUse(veh)) { veh.Position = veh.Position + (veh.RightVector * 2); //Make sure it spawns on the right side of the road, not the left (oncoming) string model = null; if (model == null || new Model(model).IsValid == false) { ped = veh.CreateRandomPedOnSeat(VehicleSeat.Driver); } else { ped = World.CreatePed(model, veh.Position.Around(5)); ped.SetIntoVehicle(veh, VehicleSeat.Driver); } if (veh.Model.IsHelicopter || veh.Model.Hash == Game.GenerateHash("osprey")) { veh.Position = veh.Position + new Vector3(0, 0, LivelyWorld.RandomInt(50, 100)); foreach (Vector3 takeoff in LivelyWorld.AmbientHeliLanding) { if (Game.Player.Character.IsInRangeOf(takeoff, 1000f)) { veh.Position = takeoff; break; } } Function.Call(Hash.SET_HELI_BLADES_FULL_SPEED, veh); Function.Call(Hash.SET_VEHICLE_FORWARD_SPEED, veh, 30f); veh.LandingGear = VehicleLandingGear.Retracted; } else if (veh.Model.IsPlane) { veh.Position = LivelyWorld.LerpByDistance(Game.Player.Character.Position, veh.Position, 500); if (veh.Model.GetDimensions().Y > 20f) { veh.Position = veh.Position + new Vector3(0, 0, 200); } if (veh.Model.GetDimensions().Y > 40f) { veh.Position = veh.Position + new Vector3(0, 0, 200); despawnRange = 2000f; } veh.LandingGear = VehicleLandingGear.Retracted; Function.Call(Hash.SET_VEHICLE_FORWARD_SPEED, veh, 30f); } else if (!veh.Model.IsBoat) { LivelyWorld.MoveEntitytoNearestRoad(veh, true, true); } if (LivelyWorld.DebugBlips) { veh.AddBlip(); if (veh.Model.IsPlane) { veh.CurrentBlip.Sprite = BlipSprite.Plane; } if (veh.Model.IsBike) { veh.CurrentBlip.Sprite = BlipSprite.PersonalVehicleBike; } if (veh.Model.IsBoat) { veh.CurrentBlip.Sprite = BlipSprite.Boat; } if (veh.Model.IsCar) { veh.CurrentBlip.Sprite = BlipSprite.PersonalVehicleCar; } if (veh.Model.IsHelicopter) { veh.CurrentBlip.Sprite = BlipSprite.Helicopter; } veh.CurrentBlip.Color = BlipColor.White; veh.CurrentBlip.IsShortRange = true; veh.CurrentBlip.Name = veh.FriendlyName; } AmbientDrive(); veh.Alpha = 0; veh.Driver.Alpha = 0; LivelyWorld.FadeIn.Add(veh); LivelyWorld.FadeIn.Add(veh.Driver); if (LivelyWorld.CarrierVehicles.Contains(veh.Model)) { Model vehicle = LivelyWorld.RandomNormalVehicle(); Vehicle cargo = World.CreateVehicle(vehicle, veh.Position + (veh.UpVector * 5f)); if (LivelyWorld.CanWeUse(cargo)) { LivelyWorld.Attach(veh, cargo); } LivelyWorld.TemporalPersistence.Add(cargo); } if (LivelyWorld.Debug >= DebugLevel.EventsAndScenarios) { UI.Notify("~o~" + SourceVehicle + " spawned (and entered cooldown)"); // if(LivelyWorld.Debug >= DebugLevel.EventsAndScenarios) } if (!veh.SirenActive) { veh.Driver.IsPersistent = false; veh.IsPersistent = false; } } else { return(false); } return(true); } } } //else if (LivelyWorld.Debug >= DebugLevel.EventsAndScenarios) UI.Notify("~o~Spawner - " + SourceVehicle + " - " + AreaOrZone + " - " + Time + " is on cooldown"); } else if (LivelyWorld.CanWeUse(veh)) { if (!veh.IsInRangeOf(Game.Player.Character.Position, despawnRange) && !LivelyWorld.WouldPlayerNoticeChangesHere(veh.Position)) { if (veh.CurrentBlip.Exists()) { veh.CurrentBlip.Color = BlipColor.White; } veh.MarkAsNoLongerNeeded(); veh = null; if (LivelyWorld.CanWeUse(ped)) { ped.MarkAsNoLongerNeeded(); ped = null; } if (Cooldown < Game.GameTime) { Cooldown = Game.GameTime + CooldownTime; } } else { if (veh.Speed < 3f && LivelyWorld.CanWeUse(ped)) { // AmbientDrive(); } } if (Cooldown < Game.GameTime) { Cooldown = Game.GameTime + 40000; } } return(false); }
private static void SetPersonalVehicleBlip(Vehicle vehicle) { // Remove this vehicle blips RemoveVehicleBlips(vehicle); Debug.Log("Setting up blip..."); Blip blip = vehicle.AddBlip(); VehicleClass vehicleClass = CurrentPlayerVehicle.ClassType; blip.Sprite = BlipSprite.PersonalVehicleCar; if (vehicleClass == VehicleClass.Boats) { blip.Sprite = BlipSprite.Boat; } else if (vehicleClass == VehicleClass.Commercial) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Compacts) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Coupes) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Cycles) { blip.Sprite = BlipSprite.GangBike; } else if (vehicleClass == VehicleClass.Emergency) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Helicopters) { blip.Sprite = BlipSprite.Helicopter; } else if (vehicleClass == VehicleClass.Industrial) { blip.Sprite = BlipSprite.Truck; } else if (vehicleClass == VehicleClass.Military) { blip.Sprite = BlipSprite.Tank; } else if (vehicleClass == VehicleClass.Motorcycles) { blip.Sprite = BlipSprite.GangBike; } else if (vehicleClass == VehicleClass.Muscle) { blip.Sprite = BlipSprite.Deluxo; } else if (vehicleClass == VehicleClass.OffRoad) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Planes) { blip.Sprite = BlipSprite.Plane; } else if (vehicleClass == VehicleClass.Sedans) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Service) { blip.Sprite = BlipSprite.Cab; } else if (vehicleClass == VehicleClass.Sports) { blip.Sprite = BlipSprite.SportsCar; } else if (vehicleClass == VehicleClass.SportsClassics) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Super) { blip.Sprite = BlipSprite.Stromberg; } else if (vehicleClass == VehicleClass.SUVs) { blip.Sprite = BlipSprite.GetawayCar; } else if (vehicleClass == VehicleClass.Utility) { blip.Sprite = BlipSprite.ArmoredTruck; } else if (vehicleClass == VehicleClass.Vans) { blip.Sprite = BlipSprite.ArmoredTruck; } blip.Color = BlipColor.White; blip.Name = "Last Vehicle"; blip.Scale = 1; if (Game.Player.Character.IsInVehicle(vehicle)) { blip.Alpha = 0; } else { blip.Alpha = 255; } }
public static void Start(MissionType type, int labIndex, List <Vector3> coords, float vehicleHeading, int timeMs, int productAmount = 0) { if (!IsActive) { IsActive = true; _missionType = type; _missionEndTime = Game.GameTime + timeMs; _missionModel = Game.Player.Character.Model.Hash; _missionLabIdx = labIndex; _productAmount = productAmount; _objectiveCoords = coords; if (_missionBarPool == null) { _missionBarPool = new TimerBarPool(); _missionTimeBar = new TextTimerBar("TIME LEFT", "00:00"); _missionBarPool.Add(_missionTimeBar); } foreach (Vector3 pos in _objectiveCoords) { Function.Call(Hash.CLEAR_AREA, pos.X, pos.Y, pos.Z, 5f, true, false, false, false); } // spaghetti switch (_missionType) { case MissionType.Setup: { _missionVehicle = World.CreateVehicle(VehicleHash.Pounder, _objectiveCoords[0], vehicleHeading); _missionVehicle.PrimaryColor = VehicleColor.MetallicBlack; _missionVehicle.SecondaryColor = VehicleColor.MetallicBlack; _missionVehicle.IsPersistent = true; Blip vehicleBlip = _missionVehicle.AddBlip(); vehicleBlip.Sprite = BlipSprite.Package2; vehicleBlip.Color = BlipColor.Blue; vehicleBlip.IsShortRange = false; vehicleBlip.Name = "Supply Truck"; Blip deliveryBlip = World.CreateBlip(_objectiveCoords[1]); deliveryBlip.Sprite = BlipSprite.Standard; deliveryBlip.Color = BlipColor.Yellow; deliveryBlip.IsShortRange = false; deliveryBlip.Alpha = 0; deliveryBlip.Name = "Meth Lab"; _missionBlips.Add("vehicle", vehicleBlip); _missionBlips.Add("deliveryPoint", deliveryBlip); NotificationQueue.Add("LJT", $"{Util.GetCharacterFromModel(_missionModel)}, a gang member posted about their supply truck online. Go to {World.GetZoneName(_objectiveCoords[0])} and take it, they won't even know!", "CHAR_LJT", 1); break; } case MissionType.Delivery: { _missionVehicle = World.CreateVehicle(Constants.DeliveryVehicles[Constants.RandomGenerator.Next(0, Constants.DeliveryVehicles.Length)], _objectiveCoords[0], vehicleHeading); _missionVehicle.IsPersistent = true; Blip vehicleBlip = _missionVehicle.AddBlip(); vehicleBlip.Sprite = BlipSprite.Package2; vehicleBlip.Color = BlipColor.Blue; vehicleBlip.IsShortRange = false; vehicleBlip.Name = "Delivery Vehicle"; Blip deliveryBlip = World.CreateBlip(_objectiveCoords[1]); deliveryBlip.Sprite = BlipSprite.Standard; deliveryBlip.Color = BlipColor.Yellow; deliveryBlip.IsShortRange = false; deliveryBlip.Alpha = 0; deliveryBlip.Name = "Delivery Point"; _missionBlips.Add("vehicle", vehicleBlip); _missionBlips.Add("deliveryPoint", deliveryBlip); NotificationQueue.Add("LJT", $"{Util.GetCharacterFromModel(_missionModel)}, the buyer wants the product to be delivered to {World.GetZoneName(_objectiveCoords[1])}.", "CHAR_LJT", 1); break; } } foreach (Lab lab in Main.MethLabs) { lab.SetBlipVisible(false); } SetStage(MissionStage.GetInVehicle); } }
public static void timeenter() { de.IsInvincible = true; de.CanBeVisiblyDamaged = false; Variableclass.trainstart.resume(); doc.Task.ClearAll(); doc.Task.GoTo(de.GetOffsetInWorldCoords(new Vector3(0, 0, 0)), true); while (Variableclass.trainstart.gettime() < 98.6) { doc.Position = docstrain.GetOffsetInWorldCoords(trainstandingpos); tick(28); Script.Wait(10); } doc.Task.ClearAll(); doc.Task.GoTo(de.GetOffsetInWorldCoords(new Vector3(0, 0, 0)), true); World.AddExplosion(docstrain.GetOffsetInWorldCoords(new Vector3(0, -4, 0)), ExplosionType.Car, 3, 5); while (Variableclass.trainstart.gettime() < 107.5) { doc.Position = docstrain.GetOffsetInWorldCoords(trainstandingpos); if (doc.IsDead) { delete_incomplete_scene(); return; } tick(37); Script.Wait(10); } doc.Task.ClearAll(); doc.Task.GoTo(de.GetOffsetInWorldCoords(new Vector3(0, 0, 0)), true); while (Variableclass.trainstart.gettime() < 135.6) { doc.Position = docstrain.GetOffsetInWorldCoords(trainstandingpos); tick(37); Script.Wait(10); } doc.Task.ClearAll(); doc.Task.GoTo(de.GetOffsetInWorldCoords(new Vector3(0, 0, 0)), true); doc.IsInvincible = true; World.AddExplosion(docstrain.GetOffsetInWorldCoords(new Vector3(0, -4, 0)), ExplosionType.Car, 3, 10); while (Variableclass.trainstart.gettime() < 144) { doc.Position = docstrain.GetOffsetInWorldCoords(trainstandingpos); if (doc.IsDead) { delete_incomplete_scene(); return; } tick(41); Script.Wait(10); } doc.Task.ClearAll(); doc.Task.GoTo(de.GetOffsetInWorldCoords(new Vector3(0, 0, 0)), true); while (Variableclass.trainstart.gettime() < 177) { doc.Position = docstrain.GetOffsetInWorldCoords(trainstandingpos); tick(47); Script.Wait(10); } doc.HasCollision = true; doc.Task.ClearAll(); doc.Task.GoTo(de.GetOffsetInWorldCoords(new Vector3(0, 0, 0)), true); Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, doc, true, true); while (Variableclass.trainstart.gettime() < 188) { tick(52); Script.Wait(10); } docstrain.Speed = 55; while (Variableclass.trainstart.gettime() < 193) { tick(60); Script.Wait(10); } docstrain.Speed = 67; while (Variableclass.trainstart.gettime() < 198) { tick(70); Script.Wait(10); } while (Variableclass.trainstart.gettime() < 202.6) { tick(78); Script.Wait(10); } World.AddExplosion(docstrain.GetOffsetInWorldCoords(new Vector3(0, -4, 0)), ExplosionType.Car, 3, 20); while (Variableclass.trainstart.gettime() < 234) { if (doc.IsDead) { delete_incomplete_scene(); Variableclass.trainstart.Stop(); return; } tick(78); Script.Wait(10); } while (Variableclass.trainstart.gettime() < 237) { UI.ShowSubtitle("Jump NOW!"); tick(78); Script.Wait(10); } Variableclass.trainstart.pause(); doc.MaxHealth = 3000; doc.Health = 3000; while (!doc.IsTouching(de)) { if (doc.IsDead) { Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, de.GetPedOnSeat(VehicleSeat.Driver), true, true); delete_incomplete_scene(); return; } if (doc.HeightAboveGround < 1) { Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, de.GetPedOnSeat(VehicleSeat.Driver), true, true); delete_incomplete_scene(); return; } tick(82); Script.Wait(10); } Variableclass.trainstart.resume(); Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, de.GetPedOnSeat(VehicleSeat.Driver), true, true); doc.HasCollision = false; while (Variableclass.trainstart.gettime() < 240) { doc.Position = de.Position; tick(82); Script.Wait(10); } doc.Task.WarpIntoVehicle(de, VehicleSeat.Passenger); doc.HasCollision = true; while (Variableclass.trainstart.gettime() < 250) { tick(82); Script.Wait(10); } doc.Task.ClearAll(); de.CloseDoor(VehicleDoor.FrontRightDoor, false); while (Variableclass.trainstart.gettime() < 264) { tick(89); Script.Wait(10); } while (Variableclass.trainstart.gettime() < 278) { make_effect("scr_mp_house", "scr_sh_lighter_sparks", new Vector3(-0.8f, 1.1f, -0.5f), new Vector3(100, 0, 0), 2.9f, false, false, false); make_effect("scr_mp_house", "scr_sh_lighter_sparks", new Vector3(0.8f, 1.1f, -0.5f), new Vector3(100, 0, 0), 2.9f, false, false, false); make_effect("scr_mp_house", "scr_sh_lighter_sparks", new Vector3(-0.8f, -1.4f, -0.5f), new Vector3(100, 0, 0), 2.9f, false, false, false); make_effect("scr_mp_house", "scr_sh_lighter_sparks", new Vector3(0.8f, -1.4f, -0.5f), new Vector3(100, 0, 0), 2.9f, false, false, false); make_effect("scr_family4", "scr_fam4_trailer_sparks", new Vector3(0, 2.5f, 1.7f), new Vector3(100, 0, 0), 0.9f, false, false, false); tick(89); de.CloseDoor(VehicleDoor.FrontRightDoor, true); Script.Wait(10); } de.IsVisible = false; de.FreezePosition = true; de.HasCollision = false; train.Speed = 0; for (double tempcount = 0; tempcount <= 8; tempcount += 0.1) { World.DrawSpotLight(de.Position, de.Rotation, Color.SkyBlue, 80, 100, 60, 100, 5); make_effecttimetravel(1, tempcount + 3, 0); make_effecttimetravel2(-1, tempcount + 3, 0); tempcount += 0.1; make_effecttimetravel(1, tempcount + 3, 0); make_effecttimetravel2(-1, tempcount + 3, 0); tempcount += 0.1; make_effecttimetravel(1, tempcount + 3, 0); make_effecttimetravel2(-1, tempcount + 3, 0); tempcount += 0.1; make_effecttimetravel(1, tempcount + 3, 0); make_effecttimetravel2(-1, tempcount + 3, 0); Script.Wait(10); } while (Variableclass.trainstart.gettime() < 283) { Script.Wait(10); } reseteffect(); Game.FadeScreenOut(500); while (Variableclass.trainstart.gettime() < 284) { Script.Wait(10); } foreach (TimeCircuits i in TimeTravel.instantDelorean.Deloreanlist) { if (i.Deloreon == Game.Player.Character.CurrentVehicle) { Function.Call(Hash.SET_CLOCK_TIME, ((i.fh1 * 10) + i.fh2), i.getminute(), 0); i.timetravelentry(); } } while (Variableclass.trainstart.gettime() < 286) { Script.Wait(10); } Game.FadeScreenIn(500); while (Variableclass.trainstart.gettime() < 287) { Script.Wait(10); } World.DrawSpotLight(de.Position, de.Rotation, Color.DeepSkyBlue, 80, 100, 60, 100, 5); if (de.Model == new Model("BTTF3") || de.Model == new Model("BTTF3rr")) { make_effect("scr_martin1", "scr_sol1_sniper_impact"); } Script.Wait(700); if (de.Model == new Model("BTTF3") || de.Model == new Model("BTTF3rr")) { make_effect("scr_martin1", "scr_sol1_sniper_impact"); } World.DrawSpotLight(de.Position, de.Rotation, Color.DeepSkyBlue, 80, 100, 60, 100, 5); Script.Wait(700); if (de.Model == new Model("BTTF3") || de.Model == new Model("BTTF3rr")) { make_effect("scr_martin1", "scr_sol1_sniper_impact"); } World.DrawSpotLight(de.Position, de.Rotation, Color.DeepSkyBlue, 80, 100, 60, 100, 5); de.FreezePosition = false; de.HasCollision = true; de.IsVisible = true; Game.Player.WantedLevel = 0; Vector3 temppos = train.Position; train.Speed = 40; de.Speed = 40; Script.Wait(1000); Vehicle moderntrain = Function.Call <Vehicle>(Hash.CREATE_MISSION_TRAIN, 1, temppos.X, temppos.Y, temppos.Z, true); while (Variableclass.trainstart.gettime() < 236) { if (Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) < 0) { de.Heading = train.Heading + -((float)Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) - 0.7f); } if (Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) > 0) { de.Heading = train.Heading - ((float)Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) + 0.7f); } train.Speed -= 0.03f; de.Speed = train.Speed + 0.5f; Script.Wait(10); } while (Variableclass.trainstart.gettime() < 334) { if (Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) < 0) { de.Heading = train.Heading + -((float)Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) - 0.7f); } if (Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) > 0) { de.Heading = train.Heading - ((float)Math.Round(de.GetOffsetFromWorldCoords(train.Position).X, 1) + 0.7f); } train.Speed -= 0.03f; de.Speed = train.Speed + 0.5f; Script.Wait(10); } train.Speed = 0; de.Speed = 0; moderntrain.Speed = 50; moderntrain.AddBlip(); moderntrain.CurrentBlip.Color = BlipColor.Red; Game.Player.Character.IsInvincible = true; doc.IsInvincible = true; de.IsInvincible = false; de.CanBeVisiblyDamaged = true; doc.Task.ClearAll(); doc.Task.LeaveVehicle(); doc.Task.RunTo(de.GetOffsetInWorldCoords(new Vector3(10, 0, 0))); while (Variableclass.trainstart.gettime() < 336) { UI.ShowSubtitle("Get out NOW!"); Script.Wait(10); } Variableclass.trainstart.pause(); int temp = 1000; while (!moderntrain.IsTouching(de)) { if (temp <= 0) { break; } temp--; Script.Wait(10); } moderntrain.CurrentBlip.Remove(); Variableclass.trainstart.resume(); de.BreakDoor(VehicleDoor.FrontLeftDoor); de.BreakDoor(VehicleDoor.FrontRightDoor); de.BreakDoor(VehicleDoor.BackLeftDoor); de.BreakDoor(VehicleDoor.BackLeftDoor); de.BreakDoor(VehicleDoor.Trunk); de.BreakDoor(VehicleDoor.Hood); World.AddExplosion(de.Position, ExplosionType.Car, 3, 10); de.Explode(); while (Variableclass.trainstart.gettime() < 383) { Script.Wait(10); } Game.Player.Character.IsInvincible = false; doc.IsInvincible = false; moderntrain.Delete(); train.Delete(); docstrain.Delete(); istrainpresent = false; }