prismspecs Posted August 1, 2019 Share Posted August 1, 2019 I've followed so many guides and can't for the life of me make 2 peds fight one another. if (e.KeyCode == Keys.NumPad3) { UI.ShowSubtitle("test 3"); Ped player = Game.Player.Character; GTA.Math.Vector3 spawnLoc = player.Position + (player.ForwardVector * 5f); int RELATIONSHIP_PROTESTERS = World.AddRelationshipGroup("PROTESTERS"); //Thanks to SHDNV, it converts the string to an int hash automatically int RELATIONSHIP_COP = Function.Call<int>(Hash.GET_HASH_KEY, "COP"); World.SetRelationshipBetweenGroups(Relationship.Hate, RELATIONSHIP_COP, RELATIONSHIP_PROTESTERS); World.SetRelationshipBetweenGroups(Relationship.Hate, RELATIONSHIP_PROTESTERS, RELATIONSHIP_COP);//somewhere in your code ped.RelationshipGroup = RELATIONSHIP_PROTESTERS; string model_name = "s_m_y_cop_01"; Ped cop1 = GTA.World.CreatePed(model_name, spawnLoc); Ped cop2 = GTA.World.CreatePed(model_name, spawnLoc); cop1.RelationshipGroup = RELATIONSHIP_PROTESTERS; cop2.RelationshipGroup = RELATIONSHIP_COP; cop1.Task.FightAgainstHatedTargets(5); cop2.Task.FightAgainstHatedTargets(5); } Link to comment Share on other sites More sharing options...
Tanjitsu Posted October 18, 2019 Share Posted October 18, 2019 This is not working because you are using 2 cops. GTA seems to has some overriding behaviors. using System.Windows.Forms; using GTA; using GTA.Math; using GTA.Native; namespace ScriptTest { public class PedFight : Script { Ped cop1; Ped cop2; public PedFight() { KeyDown += OnKeyDown; Interval = 1000; } private void OnKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Vector3 spawnLoc = Vector3.Zero; Ped player = Game.Player.Character; if (player != null) { spawnLoc = player.Position + (player.ForwardVector * 5f); } else return; cop1 = World.CreatePed(new Model(PedHash.Famca01GMY), spawnLoc); cop2 = World.CreatePed(new Model(PedHash.Cop01SFY), spawnLoc); if (cop1 != null && cop2 != null) { cop1.Task.FightAgainst(cop2); cop2.Task.FightAgainst(cop1); UI.Notify("Cop Fight !"); } } } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now