Jump to content

Placing a vehicle at the side of the road


Recommended Posts

8 minutes ago, ScottehBoyy said:

Hello guys

So I'm just wondering how to place a vehicle at the side of the road and make sure it's lined up with the direction the road is facing too.

Thanks a lot

Scott

There's no real reliable way. 

For my Traffic Stop backup locations, for example, I collected the Vector3s and headings myself.

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

Link to comment
Share on other sites

12 minutes ago, ainesophaur said:

I'm sure you can get the heading by getting the vehicles with a driver in a sphere around your target. Chances are they'll be lined up with the heading of the road.

That's a pretty smart method. Might give it a go.

26 minutes ago, Albo1125 said:

There's no real reliable way. 

For my Traffic Stop backup locations, for example, I collected the Vector3s and headings myself.

Oh wow! All those are manually done?

ScottyTooHotty

Link to comment
Share on other sites

You can get the heading fairly easily using the GET_CLOSEST_VEHICLE_NODE_WITH_HEADING native. What I do to get spawn points for Custom Backups is I use the RAGE World.GetNextLocationOnStreet function, then I pass that exact coordinate into the GET_CLOSEST_VEHICLE_NODE_WITH_HEADING native and pull just the heading from that. If the heading is more than 90 degrees away from the direction towards me, then I add 180 degrees and normalize the result.

 However, that won't help you figure out where the edge of the road is... I'm not aware of any reliable way to do that so far. You might be able to use that with the IS_POINT_ON_ROAD native to essentially keep going further from the node until you hit the edge of the road (i.e. where it's no longer on road). You'd have to come up with a pretty complex algorithm though because if you're at an intersection or something like that, then you could go forever (down a different road) and never find the "edge" if one doesn't exist. 

Edited by PNWParksFan

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

36 minutes ago, ScottehBoyy said:

Oh wow! All those are manually done?

Absolutely. Doesn't take too much time to do it, you just need a good tool to use that provides output to copy paste into your code.

44 minutes ago, ainesophaur said:

I'm sure you can get the heading by getting the vehicles with a driver in a sphere around your target. Chances are they'll be lined up with the heading of the road.

I did try this however it's hardly as reliable as I hoped.

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

Link to comment
Share on other sites

1 hour ago, PNWParksFan said:

You can get the heading fairly easily using the GET_CLOSEST_VEHICLE_NODE_WITH_HEADING native. What I do to get spawn points for Custom Backups is I use the RAGE World.GetNextLocationOnStreet function, then I pass that exact coordinate into the GET_CLOSEST_VEHICLE_NODE_WITH_HEADING native and pull just the heading from that. If the heading is more than 90 degrees away from the direction towards me, then I add 180 degrees and normalize the result.

 However, that won't help you figure out where the edge of the road is... I'm not aware of any reliable way to do that so far. You might be able to use that with the IS_POINT_ON_ROAD native to essentially keep going further from the node until you hit the edge of the road (i.e. where it's no longer on road). You'd have to come up with a pretty complex algorithm though because if you're at an intersection or something like that, then you could go forever (down a different road) and never find the "edge" if one doesn't exist. 

I saw somewhere else that someone used 3f to the right of the original spawn and that was pretty accurate apparently?

Also, rather than starting a new topic I'll just ask here. Do you know of a way to make a ped that I've spawned in attack a vehicle? If I give him a bat, nightstick then do you know of any way that I can make them then start smashing up a vehicle? Thanks. @Albo1125 @PNWParksFan @ainesophaur

ScottyTooHotty

Link to comment
Share on other sites

Nothing I could find in directly attacking a vehicle.. But I did find a task to throw a projectile at a coord which could be the vehicle.

 

http://www.dev-c.com/nativedb/func/info/7285951dbf6b5a51

 

Optionally there is a rage task to attack a ped.. If there is a driver you can target them but I doubt that's your end goal.

Link to comment
Share on other sites

myPed.Tasks.FireWeaponAt(...)

Takes an entity not specifically a ped, so can be used for peds and vehicles.

My YouTube Channel: Darkmyre Gaming (Australian LSPDFR patrols, plugins in development, and other games)

My Discord Server | AusGamer Network

 

Please do not PM me for technical support or bug reports, use the appropriate forum or plugin's comments instead.

Link to comment
Share on other sites

2 hours ago, Darkmyre said:

myPed.Tasks.FireWeaponAt(...)

Takes an entity not specifically a ped, so can be used for peds and vehicles.

Hmm I wonder if the weapon is something like a knife or a bat if they'll hit with instead of "shoot". 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

52 minutes ago, PNWParksFan said:

Hmm I wonder if the weapon is something like a knife or a bat if they'll hit with instead of "shoot". 

Hmm, I missed that bit. I had a look through the FiringPattern enum (last parameter for FireWeaponAt) and all of the firing patterns seem projectile-based, so it might not work for melee weapons.

My YouTube Channel: Darkmyre Gaming (Australian LSPDFR patrols, plugins in development, and other games)

My Discord Server | AusGamer Network

 

Please do not PM me for technical support or bug reports, use the appropriate forum or plugin's comments instead.

Link to comment
Share on other sites

8 hours ago, ainesophaur said:

Nothing I could find in directly attacking a vehicle.. But I did find a task to throw a projectile at a coord which could be the vehicle.

 

http://www.dev-c.com/nativedb/func/info/7285951dbf6b5a51

 

Optionally there is a rage task to attack a ped.. If there is a driver you can target them but I doubt that's your end goal.

Considered doing that but I would guess my Ped inside the vehicle would then be pulled out and beaten lol

 

4 hours ago, Darkmyre said:

Hmm, I missed that bit. I had a look through the FiringPattern enum (last parameter for FireWeaponAt) and all of the firing patterns seem projectile-based, so it might not work for melee weapons.

Hmm, I'll give it a shot and see what happens.

ScottyTooHotty

Link to comment
Share on other sites

On 23/04/2016 at 4:17 PM, PNWParksFan said:

You can get the heading fairly easily using the GET_CLOSEST_VEHICLE_NODE_WITH_HEADING native. What I do to get spawn points for Custom Backups is I use the RAGE World.GetNextLocationOnStreet function, then I pass that exact coordinate into the GET_CLOSEST_VEHICLE_NODE_WITH_HEADING native and pull just the heading from that. If the heading is more than 90 degrees away from the direction towards me, then I add 180 degrees and normalize the result.

 However, that won't help you figure out where the edge of the road is... I'm not aware of any reliable way to do that so far. You might be able to use that with the IS_POINT_ON_ROAD native to essentially keep going further from the node until you hit the edge of the road (i.e. where it's no longer on road). You'd have to come up with a pretty complex algorithm though because if you're at an intersection or something like that, then you could go forever (down a different road) and never find the "edge" if one doesn't exist. 

This is pretty much what I do. But then I move the vehicle 20 or 30 meters to the right...its not reliable lol, but it works most of the time!

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. 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.

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...