Jump to content

[Fixed]Ped won't spawn at callout location.


Faya

Recommended Posts

When i accept the callout, it just ignores me and acts like i never got a callout.

 

I tried:

Spawnpoint = Suspect.Position;

Also tried:

Suspect.Position = SpawnPoint;

I also tried without it but still the same.

 

What it looks like:

public override bool OnCalloutAccepted()
        {
            Ped Suspect = new Ped("a_m_o_tramp_01", SpawnPoint, 10f);

            SpawnPoint = Suspect.Position;

 

I need the suspect to be in the callout area but i can't find anything else in object browser.

RagePluginHook.log

Edited by Faya
fixed

🇳🇱

Link to comment
Share on other sites

It looks like you're trying to create your suspect ped at spawn point but spawn point is defined as suspects position after you've attempted to spawn the ped.

 

You need to get the coordinates for SpawnPoint before using it.

 

// Define what your Spawn Point coordinates are. This will grab a random position on the street around your player.
Vector3 SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(190, 500));

// Now you can spawn your ped at the specified coordinates held in SpawnPoint
Ped Suspect = new Ped("a_m_o_tramp_01", SpawnPoint, 10f);

// You can then reuse SpawnPoint to get the ped coordinates or assign it to a new Vector3
Vector3 SpawnPoint2 = Suspect.Position;

 

Just be sure to define the SpawnPoint BEFORE trying to create your ped or you'll have issues. If you have a specific location you want to spawn your ped at then just define SpawnPoint as the x, y, z and use it the same way.

 

lspdfrsig.png.9270aca86574b7a164a861f72ccd502d.png

Find all of my LEGACY projects (GTA: SA) plus more in-depth support of current projects on my modding index.

(ONLY my personal work is available and supported on the index)

Link to comment
Share on other sites

1 hour ago, Adam DeLuca said:

It looks like you're trying to create your suspect ped at spawn point but spawn point is defined as suspects position after you've attempted to spawn the ped.

 

You need to get the coordinates for SpawnPoint before using it.

 


// Define what your Spawn Point coordinates are. This will grab a random position on the street around your player.
Vector3 SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(190, 500));

// Now you can spawn your ped at the specified coordinates held in SpawnPoint
Ped Suspect = new Ped("a_m_o_tramp_01", SpawnPoint, 10f);

// You can then reuse SpawnPoint to get the ped coordinates or assign it to a new Vector3
Vector3 SpawnPoint2 = Suspect.Position;

 

Just be sure to define the SpawnPoint BEFORE trying to create your ped or you'll have issues. If you have a specific location you want to spawn your ped at then just define SpawnPoint as the x, y, z and use it the same way.

It still doesn't work, but i thought it's useful if i provide some extra information: (just does the same as first)

Spoiler

1. at " private Ped Suspect; " it says CS0649: Field 'Gun.Suspect' is never assigned to, and will always have its default value null. (in error log it's a message, not an error or caution.)

 

2. The callout does work(before and after advice) but it just spawns it at 1 location, and I don't have a specific X Y Z position set.

 

3. I put the Vector3 SpawnPoint(the line you gave me) in OnBeforeCalloutDisplayed() , under that, i put the Ped Suspect line.

 

4. public override void Process() is empty, since i don't know what to put there yet.

 

 

🇳🇱

Link to comment
Share on other sites

Seeing your actual code is more helpful than you telling us what it looks like.  The Process function is where you put the "meat" of your callout - it's where everything happens after the callout is accepted.

Released plugins

Automatic Siren Cutout | Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired - No more updates

Link to comment
Share on other sites

7 hours ago, Rich said:

Seeing your actual code is more helpful than you telling us what it looks like.  The Process function is where you put the "meat" of your callout - it's where everything happens after the callout is accepted.

I fixed it, couldn't reply because i went straight to bed after i fixed it, thanks alot for the help everyone.

(I put Ped Suspect line in OnBeforeCallouts() because i was trying to figure out if that was it, but i forgot to move it again.)

🇳🇱

Link to comment
Share on other sites

  • The title was changed to [Fixed]Ped won't spawn at callout location.

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...