Quantcast

Jump to content

» «
Photo

Pede.Task.FightAgainst(Player.Character);

7 replies to this topic
Whitemike20052
  • Whitemike20052

    Player Hater

  • Members
  • Joined: 19 Dec 2010

#1

Posted 17 March 2012 - 06:38 PM

This is a line of code in a mod that makes certain peds attack you. How would i change this so they attack the police or better yet pedestrians and everyone else.

This is also there.

Pede.Task.GoTo(Player.Character.Position, true);

Basically i want the zombies to go after everyone, consider everyone an enemy and not just me.

lamar_mustapha
  • lamar_mustapha

    Player Hater

  • BUSTED!
  • Joined: 17 Mar 2012

#2

Posted 17 March 2012 - 07:42 PM Edited by lamar_mustapha, 17 March 2012 - 07:59 PM.

http://dl.dropbox.co.....8tweaked).rar

try that

lamar_mustapha
  • lamar_mustapha

    Player Hater

  • BUSTED!
  • Joined: 17 Mar 2012

#3

Posted 17 March 2012 - 07:55 PM Edited by lamar_mustapha, 17 March 2012 - 07:59 PM.

i dont really like it since now it is not as dangerous but now they attack u and each other

hardsty1e
  • hardsty1e

    RIP Yeardley Diamond

  • Members
  • Joined: 02 May 2009
  • Philippines

#4

Posted 17 March 2012 - 08:06 PM Edited by hardsty1e, 17 March 2012 - 11:08 PM.

Grabs all cops 30f way from nikos position. You can pick any ped relationship group you want.
CODE
Ped[] pedArray = World.GetPeds(Game.LocalPlayer.Character.Position, 30.0F);

       foreach (Ped cop in pedArray)
       {
           if (cop.RelationshipGroup == RelationshipGroup.Cop)
...
cop.ChangeRelationship(RelationshipGroup.Player, Relationship.Hate);


http://www.gtamoddin...ative_functions

or look at motorsport71 http://www.gta4-mods...ction-v41-f8616 zombie source script

Whitemike20052
  • Whitemike20052

    Player Hater

  • Members
  • Joined: 19 Dec 2010

#5

Posted 19 March 2012 - 02:17 PM

QUOTE (lamar_mustapha @ Saturday, Mar 17 2012, 19:42)
http://dl.dropbox.co.....8tweaked).rar

try that

I tried your script, and it seems that they dont even come after me anymore... confused.gif

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);


}
}

}
}

}

Whitemike20052
  • Whitemike20052

    Player Hater

  • Members
  • Joined: 19 Dec 2010

#6

Posted 19 March 2012 - 02:27 PM

QUOTE (hardsty1e @ Saturday, Mar 17 2012, 20:06)
Grabs all cops 30f way from nikos position. You can pick any ped relationship group you want.
CODE
Ped[] pedArray = World.GetPeds(Game.LocalPlayer.Character.Position, 30.0F);

       foreach (Ped cop in pedArray)
       {
           if (cop.RelationshipGroup == RelationshipGroup.Cop)
...
cop.ChangeRelationship(RelationshipGroup.Player, Relationship.Hate);


http://www.gtamoddin...ative_functions

or look at motorsport71 http://www.gta4-mods...ction-v41-f8616 zombie source script

Not sure what you mean by this...if i change there relationship group to cops, will they attack everyone?

lamar_mustapha
  • lamar_mustapha

    Player Hater

  • BUSTED!
  • Joined: 17 Mar 2012

#7

Posted 19 March 2012 - 05:50 PM Edited by lamar_mustapha, 20 March 2012 - 07:21 AM.

uh.. i warned u it wasnt that good, so no need to say

anyways, go here:

CODE
if (Pede.isIdle)
{
   if (Ra(1, 100) < 70)
   {
       Pede.Task.FightAgainstHatedTargets(10);
   }
   else
   {
       Pede.Task.FightAgainst(Player.Character);
       Pede.Task.GoTo(Player.Character.Position, true);
    }
}


70% probability zombies attack each other, 30% they attack you, so adjust that, also like i said, his script makes all peds zombies? do u want to limit that, amybe leave civ males as human and civ female as human and everyone else zombie??

u need to edit more to do what u want, u should just write a new script instead of butchering a perfectly working one

also dont know if these peds are ever idle, i didnt test this so dont know if that is messing this up, maybe get rid of idle check, my intention was to let them finish their task before issuing a new one but i wouldnt know if it worked cuz i didnt test. I dont care to make other people's scripts better so much, just my own

not to mention, reading his scripts are a headache, he doesnt use proper casing, his brackets are in random places {}, his spacing is random and variables dont say what they are

hardsty1e
  • hardsty1e

    RIP Yeardley Diamond

  • Members
  • Joined: 02 May 2009
  • Philippines

#8

Posted 19 March 2012 - 11:29 PM

Maybe you could try to change the emergency personnel(or any special relationship group) into civ males then have cops hate civ males that are special ped models and have special peds hate cops then tell them to attack cops. Decision Maker is tricky and I don't anyone has really learn to control its capabilities.

CODE
DecisionMaker.LoadCombat(DecisionMaker.CombatTemplate.CopNormal);




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users