I tried your script, and it seems that they dont even come after me anymore...
Hmm, ive already modified the Script so that Regular Peds and stuff spawn with cops and ambulances and all.
With the numbers ive put i get anywhere between 10-22 zombies spawning with the script.
Ive managed to get the cops and peds from Ambient Wars to shoot at them by changing the relationship group to dealer.
Ive also removed the random exploding vehicles. Now i want the zombies that do spawn to attack the ones that rent made zombies by the script.
If you put my edited one in, you can see all the regular vehicles and emergency personnel are still in. If anyone can help me get them to attack the cops only even, i would greatly appreciate it.
Also is there anyway to change the zombies that do spawn into runners ala Liberty Infection? They use the same animations i think i just cant figure out the command to get them to run.
using System;
using System.Windows.Forms;
using GTA;
namespace Zomb
{
// ### makes ZombieZ!
public class Zomb : Script
{
public Zomb()
{
this.Tick += new EventHandler(this.ScriptCommunicationExample2_Tick);
Interval = Settings.GetValueInteger("INTERVAL", "SETTINGS", 200);
Wait(0);
}
private int Ra(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
bool Ison = false;
int r;
private void ScriptCommunicationExample2_Tick(object sender, EventArgs e)
{
// Wait(0);
if (Ison == true)
{
if (!Player.Character.isAlive)
{
Ison = false; int rand = Ra(0, 6); GTA.Native.Function.Call("FORCE_WEATHER_NOW", rand); Game.DisplayText("INFECTION STOPPED...");
GTA.Native.Function.Call("SET_MAX_WANTED_LEVEL", 6);
}
else
{
int r = Ra(0, 95);
if (r == 2)
{
Wait(0);
Vehicle x = null;
int a = Ra(0, 26);
int bb = Ra(-40, 40);
Vector3 ppp = Player.Character.GetOffsetPosition(new Vector3(bb, 30.0f, -40.0f));
if (a == 0) { x = GTA.World.CreateVehicle(0x45D56ADA, ppp); }
Wait(0);
if (x != null && x.Exists())
{
x.Health = -1000; x.PetrolTankHealth = -0.1F;
GTA.Native.Function.Call("SET_CAR_COORDINATES", x, x.Position.X, x.Position.Y, x.Position.Z + Ra(10, 350));
x.Heading = Ra(0, 359);
Wait(0);
x.ApplyForce(new Vector3(100.0F, 200.0F, -200000.58F));
Wait(0);
x.ApplyForce(new Vector3(500.0F, 200.0F, -20000.58F));
Wait(0);
x.NoLongerNeeded();
}
}
GTA.Native.Function.Call("SET_MAX_WANTED_LEVEL", 4);
GTA.Native.Function.Call("ALTER_WANTED_LEVEL", Player, 2);
GTA.Native.Function.Call("APPLY_WANTED_LEVEL_CHANGE_NOW", Player);
GTA.World.PedDensity = 3.0F;
GTA.World.CarDensity = 4.0F;
GTA.Native.Function.Call("Request_Anims", "amb@drunk");
AnimationFlags animflags = AnimationFlags.Unknown11 | AnimationFlags.Unknown09;
AnimationSet anims = new AnimationSet("amb@drunk");
GTA.Ped[] pedArray = GTA.World.GetPeds(Player.Character.Position.Around(9.0f), 9999.0F, 22);
foreach (GTA.Ped Pede in pedArray)
{
if (!Pede.Exists() || Pede == null || Pede.isRequiredForMission || !Player.Character.isAlive || GTA.Native.Function.Call<bool>("IS_PED_CLIMBING", Pede) ||
Pede.isGettingIntoAVehicle || Pede.isRagdoll ||
!Pede.isAlive || Pede == Player.Character)
{
continue;
}
if (Pede.Exists() && Pede != null)
{
GTA.Native.Function.Call("SAY_AMBIENT_SPEECH", Pede, "MOAN", 1, 1, 2);
if (Pede.isSittingInVehicle())
{
}
if (Pede.Exists() && Pede != null && GTA.Native.Function.Call<bool>("IS_CHAR_SITTING_IDLE", Pede))
{
Pede.Euphoria.BodyBalance.Start(100); Wait(0);
}
if (Pede.Exists() && Pede != null)
{
GTA.Native.Function.Call("SET_PED_DONT_DO_EVASIVE_DIVES", Pede, 1);
GTA.Native.Function.Call("SET_CHAR_SUFFERS_CRITICAL_HITS", Pede, 1);
Pede.AlwaysDiesOnLowHealth = false;
GTA.Native.Function.Call("SET_CHAR_MONEY", Pede, 0);
Pede.Health = 900;
// Pede.MakeProofTo(false, false, false, true, false);
r = Ra(0, 4);
if ((r == 1) && Pede.Exists() && Pede != null && !GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Pede, "amb@drunk", "bum_fight") && !GTA.Native.Function.Call<bool>
("IS_CHAR_GETTING_UP", Pede) && !Pede.isSittingInVehicle())
{
Pede.Task.PlayAnimation(anims, "bum_fight", 10.0F, animflags);
}
//Pede.Task.ClearAll();
Pede.DuckWhenAimedAtByGroupMember = false;
Pede.ChangeRelationship(RelationshipGroup.Dealer, Relationship.Hate);
Pede.Weapons.RemoveAll();
//Pede.CancelAmbientSpeech();
Pede.Voice = "M_ZOMBIE";
Pede.SetPathfinding(true, true, true);
Pede.RelationshipGroup = RelationshipGroup.Dealer;
Pede.Task.FightAgainst(Player.Character);
Pede.Task.GoTo(Player.Character.Position, true);
//Wait(0);
GTA.Native.Function.Call("REQUEST_ANIMS", "move_injured_lower");
}
if (Pede.Exists() && Pede != null)
{
GTA.Native.Function.Call("SET_ANIM_GROUP_FOR_CHAR", Pede, "move_injured_lower"); GTA.Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", Pede, 2.0f);
r = Ra(3, 10);
if ((r == 4) && !GTA.Native.Function.Call<bool>("IS_CHAR_IN_AIR", Pede))
{
Pede.ApplyForce(new Vector3(0.0F, -2.5F, 0.0F));
}
r = Ra(3, 10);
if ((r == 4) && !GTA.Native.Function.Call<bool>("IS_CHAR_IN_AIR", Pede))
{
Pede.ApplyForce(new Vector3(0.0F, 2.5F, 0.0F));
}
}
if (Pede.Exists() && Pede != null)
{
float vx = Pede.Velocity.X, vy = Pede.Velocity.Y;
vx = vx * vx; vy = vy * vy;
//
//
r = Ra(0, 2);
if ((r == 1) &&Pede.Exists() && Pede != null && !GTA.Native.Function.Call<bool>("IS_CHAR_GETTING_UP", Pede) && !
GTA.Native.Function.Call<bool>("IS_PED_CLIMBING", Pede) && !Pede.isSittingInVehicle() && (vx < 0.1F) && (vy < 0.1F))// && (vx > //0.00001F) && (vy > 0.00001F)
{
GTA.Native.Function.Call("TASK_CLIMB", Pede, 3);
if (Player.Character.Position.Z - Pede.Position.Z >= 1.0F)
{
Pede.ApplyForce(new Vector3(0.0F, 0.0F, 4.41F), new Vector3(0.0F, 0.0F, -4.41F));
}
// Pede.Task.ClearAll();
Wait(0);
}
}
}
if (Pede.Exists() && Pede != null && (!Pede.isRagdoll) && !GTA.Native.Function.Call<bool>("IS_CHAR_GETTING_UP", Player.Character)&& !GTA.Native.Function.Call<bool>("IS_CHAR_GETTING_UP", Pede) && Pede.isAliveAndWell && Pede.Position.DistanceTo
(Player.Character.Position) <=
1.15f)
{
if (!Player.Character.isSittingInVehicle())
{
Pede.PreventRagdoll = true;
if (Pede.Exists() && Pede != null && (!Pede.isRagdoll) && (!Player.Character.isRagdoll) && Player.Character.isAlive && !GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Pede,
"amb@drunk", "bum_fight") && !
GTA.Native.Function.Call<bool>("IS_CHAR_GETTING_UP", Pede))
Pede.Task.PlayAnimation(anims, "bum_fight", 10.0F, animflags);
Wait(400);
Player.Character.Euphoria.BodyBalance.Start(200);
if (Pede.Position.X < Player.Character.Position.X) { Player.Character.ApplyForce(new Vector3(3.45F, 0.0F, 0.0f)); }
else { Player.Character.ApplyForce(new Vector3(-3.45F, 0.0F, 0.0f)); }
if (Pede.Position.Y < Player.Character.Position.Y) { Player.Character.ApplyForce(new Vector3(0.0F, 3.45F, 0.0f)); }
else { Player.Character.ApplyForce(new Vector3(0.0F, -3.45F, 0.0f)); }
Player.Character.ApplyForce(new Vector3(0.0F, 0.0F, 0.8f), new Vector3(0.0F, 0.0F, -0.8f));
Wait(100);
Player.Character.Health -= 6;
Pede.PreventRagdoll = false;
}
}
}
}
}
// if (!GTA.Native.Function.Call<bool>("Is_Char_In_Area_2D", Player.Character, 358.4987, 437.2099, 600.0576, -115.1860))
else
{
GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", 468.7595, 391.0586, 8.2811, 250, 20, 20, 9.0F, 95.0F);
if (GTA.Native.Function.Call<bool>("Is_Char_In_Area_2D", Player.Character, 467.7190, 390.7162, 470.0016, 391.3876) || (isKeyPressed(Settings.GetValueKey("Key", Keys.F9))))
{
Ison = true;
GTA.Native.Function.Call("Do_Screen_Fade_Out", 650);
Wait(2000);
int r = Ra(6, 8);
GTA.Native.Function.Call("FORCE_WEATHER_NOW", r); GTA.Native.Function.Call("SET_TIME_OF_DAY", 0);
GTA.Native.Function.Call("Do_Screen_Fade_In", 1650);
Game.DisplayText("INFECTION STARTED!", 5000);
}
}
}
}
}