public override bool OnBeforeCalloutDisplayed() { Game.LogTrivial("[FireyCallouts][Log] Initialising 'Campfire' callout."); int fireAmplify; float offsetx, offsety, offsetz; decision = mrRandom.Next(0, 8); int makeFire = mrRandom.Next(0, 10); int hasWeapons = mrRandom.Next(0, 4); // Check locations around 800f to the player List <Vector3> possibleLocations = new List <Vector3>(); foreach (Vector3 l in locations) { if (l.DistanceTo(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront)) < 800f) { possibleLocations.Add(l); } } if (possibleLocations.Count < 1) { return(AbortCallout()); } // Random location for the fire int chosenLocation = mrRandom.Next(0, possibleLocations.Count); spawnPoint = possibleLocations[chosenLocation]; ShowCalloutAreaBlipBeforeAccepting(spawnPoint, 30f); AddMinimumDistanceCheck(40f, spawnPoint); CalloutMessage = "Campfire"; CalloutPosition = spawnPoint; // Lower spawn point due to the wood spawning in mid air spawnPoint.Z -= 2; fireWood = new Rage.Object("prop_fncwood_16g", spawnPoint); fireWood.MakePersistent(); if (decision < 4) { // No one there nobodyThere = true; } else { // People there - spawn 2 to 4 people int maxPeds = mrRandom.Next(2, 5); int suspectWander = mrRandom.Next(0, 9); int weaponsGiven = 0; for (int ii = 0; ii < maxPeds; ii++) { suspects.Add(new Ped(spawnPoint.Around2D(5f)) { IsPersistent = true, BlockPermanentEvents = true }); if (weaponsGiven < hasWeapons) { suspects[ii].Inventory.GiveNewWeapon(new WeaponAsset(weaponList[mrRandom.Next(0, weaponList.Length)]), 8, true); weaponsGiven++; } if (suspectWander > 6) { suspects[ii].Tasks.Wander(); nobodyThere = true; } } } if (makeFire > 2) { fireBurning = true; int maxFires = 7; if (nobodyThere && mrRandom.Next(0, 10) < 7) { maxFires = mrRandom.Next(20, 40); } // Create Fire for (int f = 1; f < maxFires; f++) { // Spawn several fires with random offset positions to generate a bigger fire fireAmplify = mrRandom.Next(0, 4); offsetx = fireAmplify * (f / 50); fireAmplify = mrRandom.Next(0, 3); offsety = fireAmplify * (f / 50); fireAmplify = mrRandom.Next(0, 2); offsetz = fireAmplify * (1 / 50); fireAmplify = mrRandom.Next(0, 2); if (fireAmplify == 0) { offsetx = -offsetx; } fireAmplify = mrRandom.Next(0, 2); if (fireAmplify == 0) { offsety = -offsety; } // These fires do not extinguish by themselves. fire = NativeFunction.Natives.StartScriptFire <uint>(spawnPoint.X + offsetx, spawnPoint.Y + offsety, spawnPoint.Z + offsetz, 25, true); fireList.Add(fire); } } suspectsDead = 0; suspectsArrested = 0; dialogueChoice = mrRandom.Next(0, dialogues.Count); investigationChoiceBurning = mrRandom.Next(0, 2); investigationChoiceNotBurning = mrRandom.Next(2, 4); Functions.PlayScannerAudioUsingPosition("ASSISTANCE_REQUIRED IN_OR_ON_POSITION", spawnPoint); Functions.PlayScannerAudio("UNITS_RESPOND_CODE_03"); Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~y~FireyCallouts", "~r~Campfire", "~w~Someone called because of a campfire. Investigate the situation. Respond ~r~Code 2"); return(base.OnBeforeCalloutDisplayed()); }