/// <summary> /// Things to do when before the message is show to the player about the callout /// </summary> /// <returns></returns> public override bool OnBeforeCalloutDisplayed() { // Spawn points spawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(1000f)); //Ped A1 = new Ped("a_c_mtlion", (Game.LocalPlayer.Character.GetOffsetPosition(new Vector3(0, 1.8f, 0))), 0f); //A1.BlockPermanentEvents = true; //Game.LocalPlayer.Character.RelationshipGroup = "BLUE"; //Game.SetRelationshipBetweenRelationshipGroups("BLUE", "RED", Relationship.Hate); //Game.SetRelationshipBetweenRelationshipGroups("RED", "BLUE", Relationship.Hate); //A1.RelationshipGroup = "RED"; //A1.Inventory.GiveNewWeapon(WeaponHash.Cougar, 1, true); //NativeFunction.CallByName<uint>("TASK_COMBAT_PED", A1, Game.LocalPlayer.Character, 0, 16); // Set our randomness int r = new Random().Next(1, 4); if (r == 1) { A1 = new Ped("a_c_cow", spawnPoint, 0f); state = EAnimalState.Cow; } else if (r == 2) { A1 = new Ped("a_c_coyote", spawnPoint, 0f); state = EAnimalState.Coyote; } else if (r == 3) { A1 = new Ped("a_c_mtlion", spawnPoint, 0f); state = EAnimalState.MtLion; } else if (r == 4) { A1 = new Ped("a_c_boar", spawnPoint, 0f); state = EAnimalState.Boar; } // Check if they spawned if (!A1.Exists()) { return(false); } // Show the stuff this.ShowCalloutAreaBlipBeforeAccepting(spawnPoint, 30f); this.AddMinimumDistanceCheck(10f, A1.Position); // Show the messages this.CalloutMessage = "Loose Animal"; this.CalloutPosition = spawnPoint; // Play the audio Functions.PlayScannerAudioUsingPosition("WE_HAVE_01 VISCIOUS_ANIMAL_ON_THE_LOOSE UNITS_RESPOND_CODE_3", spawnPoint); return(base.OnBeforeCalloutDisplayed()); }
private void GoToState(EAnimalState stateType) { if (_stateBehaviours.ContainsKey(stateType)) { _currentStateBehaviour?.OnStateExit(); _currentStateBehaviour = _stateBehaviours[stateType]; _currentStateBehaviour.OnStateEnter(); } }