Jump to content

[Fixed] CreateRandomDriver() - Questions and other


Deactivated Member

Recommended Posts

Hello.

 

CreateRandomDriver() - There is "RANDOM" driver so, is this possible to create not random driver? Example: CreateS_M_Y_PRISONER_01(just name of the ped file)Driver()

as everyone can know, its doesn't works, so how to make NOT random driver?

 

second question is, How to make passangers? i tried "CreateRandomPassanger()" or "CreateRandomFrontPassanger()" and i can't, every beginner (i think) will understand it like that: "there is random driver, So why random passanger does not work?" this would be a lot easier.

 

Ped ped = new Ped();
ped.IsPersistent = true;
ped.BlockPermanentEvents = true;
ped.Tasks.EnterVehicle(vehicle, 0, EnterVehicleFlags.WarpIn);

Doesn't works, i tried every way i can. My script:

 

        private Ped Suspect;
        private Vehicle SuspectVehicle;
        private Vector3 SpawnPoint;
        private Blip SuspectBlip;
        private LHandle Pursuit;
        private bool PursuitCreated = false;

If this is not it:

            SuspectVehicle = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], SpawnPoint);
            SuspectVehicle.IsPersistent = true;

            Suspect = SuspectVehicle.CreateRandomDriver(); Suspect.IsPersistent = true;
            Suspect.BlockPermanentEvents = true;
            SuspectBlip = Suspect.AttachBlip();
            SuspectBlip.IsFriendly = false;

            Suspect.Tasks.CruiseWithVehicle(20f, VehicleDrivingFlags.Emergency);
            Suspect.Inventory.GiveNewWeapon("WEAPON_PISTOL", -1, true);

So, i have tried this too:

 

        private Ped Suspect1;
        private Ped Suspect2;
        private Vehicle Suspect Vehicle;
        private Vector3 SpawnPoint;
        private Blip SuspectBlip1;
        private Blip SuspectBlip2;
        private LHandle Pursuit;
        private bool PursuitCreated = false;

,

Suspect1 = Truck1.CreateRandomDriver();           // Truck1 was name of the suspect's vehicle
            Suspect1.IsPersistent = true;
            Suspect1.BlockPermanentEvents = true;
            Suspect1.RelationshipGroup = "Friends1";

            Suspect2 = Truck1.CreateRandomDriver();
            Suspect2.IsPersistent = true;
            Suspect2.BlockPermanentEvents = true;
            Suspect2.RelationshipGroup = "Friends2";
            Game.SetRelationshipBetweenRelationshipGroups("Friends1", "Friends2", Relationship.Companion);

            SuspectBlip1 = Suspect1.AttachBlip();
            SuspectBlip1.IsFriendly = false;

            SuspectBlip2 = Suspect2.AttachBlip();
            SuspectBlip2.IsFriendly = false;

            Suspect1.Tasks.CruiseWithVehicle(20f, VehicleDrivingFlags.Emergency);
            Suspect2.Tasks.CruiseWithVehicle(20f, VehicleDrivingFlags.Emergency);

            Suspect1.Inventory.GiveNewWeapon("WEAPON_PISTOL", -1, true);

            Suspect1.Tasks.FightAgainst(Game.LocalPlayer.Character, -1);
            Suspect2.Tasks.FightAgainst(Game.LocalPlayer.Character, -1);

            Suspect2.Tasks.ChaseWithGroundVehicle(Suspect1);

,

 

                Pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(Pursuit, Suspect1);
                Functions.AddPedToPursuit(Pursuit, Suspect2);
                Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                PursuitCreated = true;

and

            if (Suspect1.Exists()) { Suspect1.Dismiss(); }
            if (Truck1.Exists()) { Truck1.Dismiss(); }
            if (SuspectBlip1.Exists()) { SuspectBlip1.Delete(); }

            if (Suspect2.Exists()) { Suspect2.Dismiss(); }
            if (SuspectBlip2.Exists()) { SuspectBlip2.Delete(); }

As u see, i tried every way, i know. I still have problems with making passangers. Im waiting for help.

 

Fixed! script:

 

  var ped = new Ped("A_M_Y_METHHEAD_01", Game.LocalPlayer.Character.GetOffsetPositionFront(5), Game.LocalPlayer.Character.Heading + 180);
  ped.IsPersistent = true;
  ped.BlockPermanentEvents = true;
  ped.Tasks.EnterVehicle(SuspectVehicle, 0, EnterVehicleFlags.WarpIn);

 

 now i want to know how to make him suspect/add him to pursuit and how i can make him agressive to police.

Edited by WildJam
i tried mix scripts :)
Link to comment
Share on other sites

  • Management Team

You can simply create the ped you want and then warp in the vehicle of your choice by calling WarpIntoVehicle on the ped.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Link to comment
Share on other sites

49 minutes ago, LMS said:

You can simply create the ped you want and then warp in the vehicle of your choice by calling WarpIntoVehicle on the ped.

Im dont understand this good, U mean, i creating:

 

        private Ped Suspect2;
        private Blip SuspectBlip2;

And adding to this

 

private Ped Suspect2.WarpIntoVehicle;

 

Link to comment
Share on other sites

  • Management Team

Try something like this:

 

var ped = new Ped("A_M_Y_METHHEAD_01", Game.LocalPlayer.Character.GetOffsetPositionFront(5), Game.LocalPlayer.Character.Heading + 180);
ped.WarpIntoVehicle(SuspectVehicle, -1);

 

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Link to comment
Share on other sites

Just now, LMS said:

Try something like this:

 


var ped = new Ped("A_M_Y_METHHEAD_01", Game.LocalPlayer.Character.GetOffsetPositionFront(5), Game.LocalPlayer.Character.Heading + 180);
ped.WarpIntoVehicle(SuspectVehicle, -1);

 

now, its explaing everything, ill try it. I will tell u if this works or no, thanks.

Link to comment
Share on other sites

1 hour ago, LMS said:

Try something like this:

 


var ped = new Ped("A_M_Y_METHHEAD_01", Game.LocalPlayer.Character.GetOffsetPositionFront(5), Game.LocalPlayer.Character.Heading + 180);
ped.WarpIntoVehicle(SuspectVehicle, -1);

 

I tried it, "var" does not work so i tried "Ped" still does not works, my vehicle has 4 places to sit, then i changed it to 4, beacuse 5 does not works too, and idk why, now if i start callout lspdfr crashes, even i this script without changes.

 

i placed it here: (under SuspectVehicle.IsPersistent = True)

 public override bool OnCalloutAccepted()
        {
            Functions.PlayScannerAudio("RESPOND_CODE_1");

            Model[] VehicleModels = new Model[]
            {
                "SPEEDO", "GBURRITO", "GBURRITO2"
            };

            SuspectVehicle = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], SpawnPoint);
            SuspectVehicle.IsPersistent = true;

            ped = new Ped("A_M_Y_METHHEAD_01", Game.LocalPlayer.Character.GetOffsetPositionFront(4), Game.LocalPlayer.Character.Heading + 180); // here
            ped.WarpIntoVehicle(SuspectVehicle, -1);

            Suspect = SuspectVehicle.CreateRandomDriver(); Suspect.IsPersistent = true;
            Suspect.BlockPermanentEvents = true;
            SuspectBlip = Suspect.AttachBlip();
            SuspectBlip.IsFriendly = false;

            Suspect.Tasks.CruiseWithVehicle(20f, VehicleDrivingFlags.Emergency);
            Suspect.Inventory.GiveNewWeapon("WEAPON_PISTOL", -1, true);

            return base.OnCalloutAccepted();

i tried place it under "suspectblip.IsFriendly = false;

 

And there is spawning ped, but next to me

Edited by WildJam
Link to comment
Share on other sites

On 2/13/2019 at 8:04 PM, LMS said:

Try something like this:

 


var ped = new Ped("A_M_Y_METHHEAD_01", Game.LocalPlayer.Character.GetOffsetPositionFront(5), Game.LocalPlayer.Character.Heading + 180);
ped.WarpIntoVehicle(SuspectVehicle, -1);

 

Spoiler


 Hello, I have very big problem, and nobody wants to help me. So i created callout, when i have to search for the ped, so a search area blip onlyappears, when i found(im close) the ped, ped's blip won't appears, but when i delete search area blipcode, blip appears.

 

 

My code:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Rage; using Rage.Native; using Rage.Attributes; using LSPD_First_Response.Mod.API; using LSPD_First_Response.Mod.Callouts; using LSPD_First_Response.Engine.Scripting; using LSPD_First_Response.Engine; using System.Drawing; using System.Windows.Forms; using LSPD_First_Response.Engine.Scripting.Entities; namespace CALLOUTPACKNAME.Callouts { [CalloutInfo("CalloutName", CalloutProbability.VeryLow)] public class CalloutNameSpace : Callout { private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Ped myPed; private Vector3 AreaBlip; private Vector3 SearchAreaLocation; private Vector3 Route; private Vector3 SpawnPoint0; private Vector3 SpawnPoint1; private Vector3 SpawnPoint2; private Vector3 SpawnPoint3; private Vector3 SpawnPoint4; private Vector3 SpawnPoint5; private Vector3 SpawnPoint6; private Vector3 SpawnPoint7; private Vector3 SpawnPoint8; private Vector3 SpawnPoint9; private Vector3 SpawnPoint10; private Vector3 SpawnPoint11; private Vector3 SpawnPoint12; private Vector3 SpawnPoint13; private Vector3 SpawnPoint14; private Vector3 SpawnPoint15; private Blip SearchAreaBlip; private Blip Waypoint; private Blip SuspectBlip; public override bool OnBeforeCalloutDisplayed() { AreaBlip = new Vector3(-427.577f, 1116.049f, 326.783f); Route = new Vector3(-427.577f, 1116.049f, 326.783f); SearchAreaLocation = new Vector3(-427.577f, 1116.049f, 326.783f); SpawnPoint0 = new Vector3(-427.577f, 1116.049f, 326.783f); SpawnPoint1 = new Vector3(-397.247f, 1127.590f, 322.724f); SpawnPoint2 = new Vector3(-428.174f, 1122.083f, 325.854f); SpawnPoint3 = new Vector3(454.413f, -740.819f, 27.358f); SpawnPoint4 = new Vector3(459.643f, -759.451f, 27.358f); SpawnPoint5 = new Vector3(452.857f, -779.992f, 27.358f); SpawnPoint6 = new Vector3(460.017f, -809.125f, 27.322f); SpawnPoint7 = new Vector3(478.739f, -700.984f, 32.051f); SpawnPoint8 = new Vector3(480.516f, -747.916f, 37.396f); SpawnPoint9 = new Vector3(476.067f, -804.597f, 42.672f); SpawnPoint10 = new Vector3(466.171f, -779.360f, 32.459f); SpawnPoint11 = new Vector3(430.765f, -711.007f, 35.727f); SpawnPoint12 = new Vector3(449.468f, -725.472f, 35.987f); SpawnPoint13 = new Vector3(447.883f, -755.353f, 38.004f); SpawnPoint14 = new Vector3(449.329f, -780.423f, 44.531f); SpawnPoint15 = new Vector3(433.665f, -806.423f, 38.013f); ShowCalloutAreaBlipBeforeAccepting(AreaBlip, 50f); AddMinimumDistanceCheck(40f, AreaBlip); CalloutMessage = "Callout Name"; CalloutPosition = AreaBlip; return base.OnBeforeCalloutDisplayed(); } public override bool OnCalloutAccepted() { Functions.PlayScannerAudio("RESPOND_CODE_3"); myPed = new Ped("a_m_m_og_boss_01", SpawnPoint0, 0f); myPed.IsPersistent = true; myPed.BlockPermanentEvents = true; Suspect = new Ped("a_m_m_og_boss_01", SpawnPoint1, 0f); Suspect.IsPersistent = true; Suspect.BlockPermanentEvents = true; Waypoint = new Blip(Route); Waypoint.Color = (Color.Yellow); Waypoint.EnableRoute(Color.Yellow); return base.OnCalloutAccepted(); } public override void Process() { base.Process(); if (Game.LocalPlayer.Character.DistanceTo(Suspect.Position) < 5f) { SuspectBlip = Suspect.AttachBlip(); SuspectBlip.IsFriendly = false; SuspectBlip.Scale = 0.75f; } if (Game.LocalPlayer.Character.DistanceTo(myPed.Position) < 80f) { SearchAreaBlip = new Blip(SearchAreaLocation, 80f); SearchAreaBlip.Color = Color.Yellow; SearchAreaBlip.Alpha = 0.5f; } if (Game.LocalPlayer.Character.DistanceTo(myPed.Position) < 80f) { Waypoint.Delete(); Waypoint.DisableRoute(); } }  public override void End() {  base.End(); } } }

Please help me, Im waiting.

 

 thanks.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...