RoosterArmament 0 Posted September 24, 2012 Share Posted September 24, 2012 Hi everyone, I'm new in modding GTA IV and so far I only made/converted weapons for the game. What I would like to do is to change the Police Officers behavior in the streets as follow: 1) I want the police officers to have AK47 instead of handgun. 2) I want the police officers to start shooting at people in the streets, all the time and targeting everyone. How can I do that, what files do I need to modify and is it hard to achieve ? Thanks a lot ! Link to post Share on other sites
ch3y3zze 0 Posted September 26, 2012 Share Posted September 26, 2012 using System;using GTA;public class CrazyCops : Script{ public CrazyCops() { Tick += CrazyCops_Tick; } void CrazyCops_Tick(object sender, EventArgs e) { foreach (Ped ped in World.GetAllPeds()) { if (ped.isAliveAndWell && ped.PedType == PedType.Cop && ped.Weapons.AssaultRifle_AK47.Ammo == 0) { ped.Weapons.RemoveAll(); ped.Weapons.AssaultRifle_AK47.Ammo = 500; } } }} ill add the killer cops later, open notepad paste the code and save as ilovechunkyfunkymonkey.cs and install to scripts Link to post Share on other sites
RoosterArmament 0 Posted September 26, 2012 Author Share Posted September 26, 2012 (edited) To install as a Script, what do I need??? Scripthook and/or ASIloader??? Thanks a lot mate, I really appreciate it !!! Take your time for the second part, I'm really grateful. EDIT: Do you think it would be possible to make the NOOSE appear after a certain time (few minutes IRL) and randomly shoot at people as well? It might be a lot of coding though... Edited September 26, 2012 by RoosterArmament Link to post Share on other sites
ch3y3zze 0 Posted September 27, 2012 Share Posted September 27, 2012 (edited) yes make sure u r using scripthook c++ 0.5.1 and scripthookdotnet 1.7.1.7 beta on gta iv 1.0.7 or eflc whatever version is newest AsiLoader: dsound.dll (asi loader by alexander blade) if u want online, but u wont be able to use other people's save files or xlive.dll (called xliveless by listener) this will let u use other people's saved games but no online then yes place in the scripts folder u created when installing the shdontnet and yes everything u said is possible, i can have hookers appear if u want or old grandmas with shotguns too lol Edited September 27, 2012 by ch3y3zze Link to post Share on other sites
RoosterArmament 0 Posted September 27, 2012 Author Share Posted September 27, 2012 It's is working perfectly, thank you !!! Exactly what I wanted, no bugs. I'll be patient for the Killer Cops and Killer Noose, in the meantime could you increase the number of police officers in the street by 2 or 3 times the original rockstar game number ? After this, I won't bother you again Link to post Share on other sites
ch3y3zze 0 Posted September 27, 2012 Share Posted September 27, 2012 Well it would be easier to increase the number of cops spawned by editing the dat file that controls that. If i spawn more cops and game reaches it's limits on peds, then they wont spawn. Increasing number of cops running around would probably lead to stability issues, but go ahead and check out the popcyc.dat, i think that is where u can set number of peds spawned by the game Link to post Share on other sites
ch3y3zze 0 Posted September 28, 2012 Share Posted September 28, 2012 using System;using System.Collections.Generic;using GTA;public class CrazyCops : Script{ GTA.Timer nooseSpawnTimer; List<Vehicle> vehiclesSpawned; List<Ped> pedsSpawned; public CrazyCops() { vehiclesSpawned = new List<Vehicle>(); pedsSpawned = new List<Ped>(); nooseSpawnTimer = new Timer(120000); nooseSpawnTimer.Tick += new EventHandler(nooseSpawnTimer_Tick); nooseSpawnTimer.Start(); Tick += CrazyCops_Tick; Interval = 1000; } void Cleanup() { for (int i = pedsSpawned.Count - 1; i >= 0; i--) { if (!Game.Exists(pedsSpawned[i])) pedsSpawned.RemoveAt(i); } foreach (Ped ped in pedsSpawned) { try { if (!ped.isAliveAndWell && !ped.isOnScreen && Game.LocalPlayer.Character.Position.DistanceTo(ped.Position) > 25) { ped.Delete(); } } catch (Exception) { } } for (int i = vehiclesSpawned.Count - 1; i >= 0; i--) { if (!Game.Exists(vehiclesSpawned[i])) vehiclesSpawned.RemoveAt(i); } foreach (Vehicle vehicle in vehiclesSpawned) { if ((!vehicle.isAlive || !vehicle.isDriveable) && !vehicle.isOnScreen && Game.LocalPlayer.Character.Position.DistanceTo(vehicle.Position) > 25) { vehicle.Delete(); } } } void nooseSpawnTimer_Tick(object sender, EventArgs e) { Vehicle swatVan; try { Vector3 vehPos = World.GetNextPositionOnStreet(World.GetPositionAround(Game.LocalPlayer.Character.Position, 50)); swatVan = World.CreateVehicle(new Model("NSTOCKADE"), vehPos); swatVan.isRequiredForMission = true; vehiclesSpawned.Add(swatVan); } catch (Exception ex) { Game.Console.Print("Crazy Cops Error: " + ex.ToString()); Game.DisplayText("Noose Spawn Failed, Check Console >_<"); return; } VehicleSeat[] seats = new VehicleSeat[] { VehicleSeat.Driver, VehicleSeat.RightFront, VehicleSeat.LeftRear, VehicleSeat.RightRear }; Model swatPedModel = new Model("M_Y_SWAT"); Ped[] cops = new Ped[4]; try { for (int i = 0; i < 4; i++) { cops[i] = swatVan.CreatePedOnSeat(seats[i], swatPedModel); cops[i].RelationshipGroup = RelationshipGroup.Cop; cops[i].BecomeMissionCharacter(); pedsSpawned.Add(cops[i]); } } catch (Exception ex) { Game.Console.Print("Crazy Cops Error: " + ex.ToString()); Game.DisplayText("Noose Spawn Failed, Check Console >_<"); if (Game.Exists(swatVan)) { swatVan.Delete(); } return; } } void CrazyCops_Tick(object sender, EventArgs e) { Cleanup(); foreach (Ped ped in World.GetAllPeds()) { if (Game.Exists(ped) && ped.isAliveAndWell && ped.PedType == PedType.Cop) { if (ped.Weapons.AssaultRifle_AK47.Ammo == 0) { ped.ChangeRelationship(RelationshipGroup.Bum, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Civillian_Female, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Civillian_Male, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Criminal, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Dealer, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Fireman, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_AfricanAmerican, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Albanian, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Biker1, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_ChineseJapanese, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Irish, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Jamaican, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Korean, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_PuertoRican, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Russian1, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Russian2, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Medic, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Prostitute, Relationship.Hate); ped.Weapons.RemoveAll(); ped.Weapons.AssaultRifle_AK47.Ammo = 500; } if (ped.isIdle && !ped.isInCombat && !ped.isShooting) { ped.Task.FightAgainstHatedTargets(20f); } } } }} Ok this is untested so I suppose I expect some bugs, let me know Link to post Share on other sites
RoosterArmament 0 Posted September 28, 2012 Author Share Posted September 28, 2012 OMG!!! Ch3y3zze this coding is SO GREAT thank you a lot, man!!! Tested it for about 15min, no "bugs" whatsoever. Here are some requests/suggestion: 1) Could you make the Noose to have M4 ???(they have AK47 as well, dont change the Police though) 2) Could you spawn more Noose (like 2 or 3 trucks at the same time) ? 3) Could you make Police and Noose to IGNORE the player (engage him only if there are police stars level) Otherwise this is exactly what I wanted, this is so fun!!! The Police doesn't kill people but arrest them, the Noose kill them but I guess I'll keep it that way it's really cool. Thank you !!! Link to post Share on other sites
ch3y3zze 0 Posted September 28, 2012 Share Posted September 28, 2012 (edited) oh nice, glad it's working the way it is supposed to, yeah just check back later, ill give noose M4's and try to spawn a 2nd and 3rd vehicle, the one problem i usually have with gta is spawning stuff, sometimes causes instabilty but it's worth giving it a shot, ill make a setting at the top of the script where u can write, spawnNoose = 1 or 2 or 3 and then u test how many u can spawn with out issues and ill make them ignore player unless u have wanted level ok just check back later, maybe i can edit today Edited September 28, 2012 by ch3y3zze Link to post Share on other sites
RoosterArmament 0 Posted September 28, 2012 Author Share Posted September 28, 2012 Take your time, I can enjoy what you already done at the moment, it is already cool enough! Link to post Share on other sites
ch3y3zze 0 Posted September 29, 2012 Share Posted September 29, 2012 (edited) using System;using System.Collections.Generic;using GTA;public class CrazyCops : Script{ const int NOOSE_SPAWN_COUNT = 3; GTA.Timer nooseSpawnTimer; List<Vehicle> vehiclesSpawned; List<Ped> pedsSpawned; Model swatPedModel = new Model("M_Y_SWAT"); public CrazyCops() { vehiclesSpawned = new List<Vehicle>(); pedsSpawned = new List<Ped>(); nooseSpawnTimer = new Timer(120000); nooseSpawnTimer.Tick += new EventHandler(nooseSpawnTimer_Tick); nooseSpawnTimer.Start(); Tick += CrazyCops_Tick; Interval = 1000; } void Cleanup() { for (int i = pedsSpawned.Count - 1; i >= 0; i--) { if (!Game.Exists(pedsSpawned[i])) pedsSpawned.RemoveAt(i); } foreach (Ped ped in pedsSpawned) { try { if (!ped.isAliveAndWell && !ped.isOnScreen && Game.LocalPlayer.Character.Position.DistanceTo(ped.Position) > 25) { ped.Delete(); } } catch (Exception) { } } for (int i = vehiclesSpawned.Count - 1; i >= 0; i--) { if (!Game.Exists(vehiclesSpawned[i])) vehiclesSpawned.RemoveAt(i); } foreach (Vehicle vehicle in vehiclesSpawned) { if ((!vehicle.isAlive || !vehicle.isDriveable) && !vehicle.isOnScreen && Game.LocalPlayer.Character.Position.DistanceTo(vehicle.Position) > 25) { vehicle.Delete(); } } } void nooseSpawnTimer_Tick(object sender, EventArgs e) { for (int i = 0; i < NOOSE_SPAWN_COUNT; i++) { Vehicle swatVan; try { Vector3 vehPos = World.GetNextPositionOnStreet(World.GetPositionAround(Game.LocalPlayer.Character.Position, i * 10 + 50)); swatVan = World.CreateVehicle(new Model("NSTOCKADE"), vehPos); swatVan.isRequiredForMission = true; vehiclesSpawned.Add(swatVan); } catch (Exception ex) { Game.Console.Print("Crazy Cops Error: " + ex.ToString()); Game.DisplayText("Noose Spawn Failed, Check Console >_<"); return; } VehicleSeat[] seats = new VehicleSeat[] { VehicleSeat.Driver, VehicleSeat.RightFront, VehicleSeat.LeftRear, VehicleSeat.RightRear }; Ped[] cops = new Ped[4]; try { for (int i2 = 0; i2 < 4; i2++) { cops[i2] = swatVan.CreatePedOnSeat(seats[i2], swatPedModel); cops[i2].RelationshipGroup = RelationshipGroup.Cop; cops[i2].BecomeMissionCharacter(); pedsSpawned.Add(cops[i2]); } } catch (Exception ex) { Game.Console.Print("Crazy Cops Error: " + ex.ToString()); Game.DisplayText("Noose Spawn Failed, Check Console >_<"); if (Game.Exists(swatVan)) { swatVan.Delete(); } return; } } } void CrazyCops_Tick(object sender, EventArgs e) { Cleanup(); foreach (Ped ped in World.GetAllPeds()) { if (Game.Exists(ped) && ped.isAliveAndWell && ped.PedType == PedType.Cop) { if (ped.Weapons.AssaultRifle_AK47.Ammo == 0 && ped.Weapons.AssaultRifle_M4.Ammo == 0) { ped.ChangeRelationship(RelationshipGroup.Bum, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Civillian_Female, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Civillian_Male, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Criminal, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Dealer, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Fireman, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_AfricanAmerican, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Albanian, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Biker1, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_ChineseJapanese, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Irish, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Jamaican, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Korean, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_PuertoRican, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Russian1, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Gang_Russian2, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Medic, Relationship.Hate); //ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Hate); ped.ChangeRelationship(RelationshipGroup.Prostitute, Relationship.Hate); ped.Weapons.RemoveAll(); if (ped.Model == swatPedModel) { ped.Weapons.AssaultRifle_M4.Ammo = 500; } else { ped.Weapons.AssaultRifle_AK47.Ammo = 500; } } if (ped.isIdle && !ped.isInCombat && !ped.isShooting) { ped.Task.FightAgainstHatedTargets(20f); } } } }} ok that will give M4s to Noose now, and set the number of noose vans to spawn at top, also now, they wont go after the player until u have a wanted level, if u notice where i wrote the "//" where it says to hate the player, just delete the "//" if u want them to go after the player again Edited September 30, 2012 by ch3y3zze Link to post Share on other sites
gpcguy1 337 Posted September 30, 2012 Share Posted September 30, 2012 This is cool. What would you put if you want the cops using shotguns or smgs? Link to post Share on other sites
ch3y3zze 0 Posted September 30, 2012 Share Posted September 30, 2012 This is cool. What would you put if you want the cops using shotguns or smgs? just replace where its says "AssaultRifle_AK47" with any of these: public Weapon RocketLauncher public Weapon SniperRifle_M40A1 public Weapon BasicSniperRifle public Weapon AssaultRifle_M4 public Weapon AssaultRifle_AK47 public Weapon MP5 public Weapon Uzi public Weapon BarettaShotgun public Weapon BasicShotgun public Weapon DesertEagle public Weapon Glock public Weapon MolotovCocktails public Weapon Grenades public Weapon Knife public Weapon BaseballBat public Weapon Unarmed this is from the WeaponCollection clss in shdn Link to post Share on other sites
gpcguy1 337 Posted September 30, 2012 Share Posted September 30, 2012 Thanks man! Link to post Share on other sites
gpcguy1 337 Posted September 30, 2012 Share Posted September 30, 2012 is there a character selection to make other peds like this? Link to post Share on other sites
ch3y3zze 0 Posted September 30, 2012 Share Posted September 30, 2012 (edited) This script is affecting Cop PedType's so u can change the ped type for other peds to be affected edit: just tested the multiple noose trucks and my game was swarming with noose, it was awesome lol Edited September 30, 2012 by ch3y3zze Link to post Share on other sites
gpcguy1 337 Posted September 30, 2012 Share Posted September 30, 2012 I changed the ped type but none of them work except the cops. Link to post Share on other sites
ch3y3zze 0 Posted September 30, 2012 Share Posted September 30, 2012 well if ur changing the pedtype u wont want that pedtype to hate itself, so remove the line of code that sets the ped to hate that relationshipgroup for whatever ur adding, PedTypes and Rel groups pretty much lineup, and u will want to add cops to one of the relationship group's being hated not sure it will work but at least test with those changes Link to post Share on other sites
gpcguy1 337 Posted September 30, 2012 Share Posted September 30, 2012 I have done that before you told me and it didn't work. Link to post Share on other sites
ch3y3zze 0 Posted September 30, 2012 Share Posted September 30, 2012 ah cool ur smarter than the average bear yeah something to do with other ped types being less aggressive or something Link to post Share on other sites
gpcguy1 337 Posted September 30, 2012 Share Posted September 30, 2012 (edited) ah cool ur smarter than the average bear yeah something to do with other ped types being less aggressive or something Im checking ways to make the ped group more aggressive Edit: Couldn't make anything work Civilians are too coward Edited September 30, 2012 by gpcguy1 Link to post Share on other sites
gpcguy1 337 Posted September 30, 2012 Share Posted September 30, 2012 No pedtype worked besides cops. But when I spawned a Gang_AfricanAmerican via trainer it had them attack everyone like the the script told. But the ones that are on the street don't. Seems to be the relationship for peds. Link to post Share on other sites
RoosterArmament 0 Posted October 1, 2012 Author Share Posted October 1, 2012 @Ch3y3zze: I didn't get the time to THANK YOU. This is just PERFECT. Now I can have alot of fun!!! I do have the feeling that the script is preventing "normal / unscripted" Noose trucks to appear, but I dont really care. No other bugs noticed. Thank you so much !!! Link to post Share on other sites
ch3y3zze 0 Posted October 2, 2012 Share Posted October 2, 2012 No problem , I'm glad u enjoy it Link to post Share on other sites
lemonwire 0 Posted February 13, 2013 Share Posted February 13, 2013 This script is amazing, would it be possible to enable gang wars with similar scripting as well? Link to post Share on other sites
JokersWild 0 Posted February 14, 2013 Share Posted February 14, 2013 (edited) oh that ch3y3zze he is such a character xD ch3y3zze wrote an awesome drugwars mod with gang battles already, maybe ill ask him to upload it if people want to download it Edited February 14, 2013 by JokersWild Link to post Share on other sites
lemonwire 0 Posted February 17, 2013 Share Posted February 17, 2013 oh that ch3y3zze he is such a character xD ch3y3zze wrote an awesome drugwars mod with gang battles already, maybe ill ask him to upload it if people want to download it Thanks for the reply, Yes, I'd like to download it, thanks! Link to post Share on other sites