Jump to content
download500

My misc. question thread :)

Recommended Posts

Starting a thread as advised to put all miscellaneous questions in.

 

Is there a way to reference peds spawned by someone elses callouts? I wanted to make a mod where other cops have a chance to get to the scene faster than me, aka a chance for other units to spawn at (the peds) location.

How can I get the ped from someone elses callout once its spawned (but before it has a blip) so that I can refer to it in my script like it's a ped I made?

Share this post


Link to post
Share on other sites

How do I get a ped to come to my position? GoStraightToPosition demands that I use heading and distance to slide to, which I don't know what to put for. Can someone give me an example?

Share this post


Link to post
Share on other sites
13 hours ago, download500 said:

How do I get a ped to come to my position? GoStraightToPosition demands that I use heading and distance to slide to, which I don't know what to put for. Can someone give me an example?

You can use FollowNavigationMeshToPosition:
ped.Tasks.FollowNavigationMeshToPosition(position, heading, speed, distanceThreshold);

position: the position to go(Vector3)
heading: the heading the ped should achieve when the position is reached(float)
speed: if set to 1.0f the ped will walk, if set to 2.0f the ped will run(float)
distanceThreshold: the distance from the position where the ped can stop(float)

 

You could use GoStraightToPosition too, but if the ped have some wall/vehicle/object in front of it he will get stuck. In GoStraightToPosition the heading is the same as FollowNavigationMeshToPosition and distanceToSlideAt is the distance the ped moves without doing an animation like if he were sliding, you can leave it at 0f

Edited by alexguirre

Share this post


Link to post
Share on other sites
On 25.01.2016 at 0:19 AM, download500 said:

Starting a thread as advised to put all miscellaneous questions in.

 

Is there a way to reference peds spawned by someone elses callouts? I wanted to make a mod where other cops have a chance to get to the scene faster than me, aka a chance for other units to spawn at (the peds) location.

How can I get the ped from someone elses callout once its spawned (but before it has a blip) so that I can refer to it in my script like it's a ped I made?

It depends on access modifier given to ped object by given plugin creator. Good programming practice is to set private all objects (methods, fields) that do not need to be public. Also you have to reference dynamically somebodys plugin in your code using reflection namespace (System.Reflection) after checking that given plugin exists, to call its public methods or access public fields of its classes.  This is done in similar way as code in third post in my thread about RageShowMyLocation, where I show how to use small API of my plugin :

 

Edited by w35

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×