Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Cyron43

How to make the police chopper searchlight track a target?

Recommended Posts

Cyron43

Hi there,

I am currently working on moving target chasing for my VAutodrive mod. I would like to have the searchlight of the police chopper automatically track the target but I can't find anything in the Native DB (maybe I'm searching the wrong keywords though). Can anybody give me some help with this please?

Edited by Cyron43

Share this post


Link to post
Share on other sites
iDontKnowHowToCode

This forum doesn't support 'online' modding so it shouldn't be an issue, but these are the natives most search light related mods on gta5-mods use but of course other players wouldn't see it. As for yourself this is what they use,

 

void DRAW_SPOT_LIGHT(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, int colorR, int colorG, int colorB, float distance, float brightness, float roundness, float radius, float falloff) //0xD0F64B265C8C8B33 0xBDBC410C

 

void _DRAW_SPOT_LIGHT_WITH_SHADOW(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, int colorR, int colorG, int colorB, float distance, float brightness, float roundness, float radius, float falloff, float shadow) //0x5BCA583A583194DB 0x32BF9598

 

You could fill out those parameters, by first filling out the first 3 with an offset from your helicopter, which you could probably find a perfect one within decompiled scripts or with GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS till it's where you want it. Then the next 3 I'm not good with working on getting vectors to face an entity all though I've never needed to know it until now, but I'm sure you may be or could figure it out and use GET_ENTITY_COORDS for the target and such to get the dirX, dirY, and dirZ facing the target as for the rest of the parameters are self-explanitory or in retrospect are explained on dev-c under the 'GRAPHICS' namespace. Hope I could help some since noone else has seemed to of replied with all the views this has gotten lol. Have a good one.

Edited by iDontKnowHowToCode

Share this post


Link to post
Share on other sites
Cyron43

This forum doesn't support 'online' modding so it shouldn't be an issue, but these are the natives most search light related mods on gta5-mods use but of course other players wouldn't see it. As for yourself this is what they use,

 

void DRAW_SPOT_LIGHT(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, int colorR, int colorG, int colorB, float distance, float brightness, float roundness, float radius, float falloff) //0xD0F64B265C8C8B33 0xBDBC410C[/size]

 

void _DRAW_SPOT_LIGHT_WITH_SHADOW(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, int colorR, int colorG, int colorB, float distance, float brightness, float roundness, float radius, float falloff, float shadow) //0x5BCA583A583194DB 0x32BF9598[/size]

 

You could fill out those parameters, by first filling out the first 3 with an offset from your helicopter, which you could probably find a perfect one within decompiled scripts or with GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS till it's where you want it. Then the next 3 I'm not good with working on getting vectors to face an entity all though I've never needed to know it until now, but I'm sure you may be or could figure it out and use GET_ENTITY_COORDS for the target and such to get the dirX, dirY, and dirZ facing the target as for the rest of the parameters are self-explanitory or in retrospect are explained on dev-c under the 'GRAPHICS' namespace. Hope I could help some since noone else has seemed to of replied with all the views this has gotten lol. Have a good one.

Thank you for the reply. However, I am confused about some of your statements. First of, I never said I want to mod Online and of course that's NOT my intention. Second, what do you mean with "... but of course other players wouldn't see it"? No one (besides R* maybe but you're talking about other players anyway) has a patent on these natives.

Edited by Cyron43

Share this post


Link to post
Share on other sites
J_D_M

 

This forum doesn't support 'online' modding so it shouldn't be an issue, but these are the natives most search light related mods on gta5-mods use but of course other players wouldn't see it. As for yourself this is what they use,

 

void DRAW_SPOT_LIGHT(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, int colorR, int colorG, int colorB, float distance, float brightness, float roundness, float radius, float falloff) //0xD0F64B265C8C8B33 0xBDBC410C[/size]

 

void _DRAW_SPOT_LIGHT_WITH_SHADOW(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, int colorR, int colorG, int colorB, float distance, float brightness, float roundness, float radius, float falloff, float shadow) //0x5BCA583A583194DB 0x32BF9598[/size]

 

You could fill out those parameters, by first filling out the first 3 with an offset from your helicopter, which you could probably find a perfect one within decompiled scripts or with GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS till it's where you want it. Then the next 3 I'm not good with working on getting vectors to face an entity all though I've never needed to know it until now, but I'm sure you may be or could figure it out and use GET_ENTITY_COORDS for the target and such to get the dirX, dirY, and dirZ facing the target as for the rest of the parameters are self-explanitory or in retrospect are explained on dev-c under the 'GRAPHICS' namespace. Hope I could help some since noone else has seemed to of replied with all the views this has gotten lol. Have a good one.

Thank you for the reply. However, I am confused about some of your statements. First of, I never said I want to mod Online and of course that's NOT my intention. Second, what do you mean with "these are the natives most search light related mods on gta5-mods use but of course other players wouldn't see it"? No one (besides R* maybe but you're talking about other players anyway) has a patent on these natives.

 

I think he means:

 

"This is how it's usually done", but if the code is obfuscated, "player" could refer to the people who would want to find that particular code and can't OR he means that players in the game wouldn't be able to see the spotlight.

Share this post


Link to post
Share on other sites
iDontKnowHowToCode

I meant* that if you were online (which of course you wouldn't be) other online players would see the spot light on, but not it being aimed around. As for the gta-5 bit I meant on the website with most the PC mods gta5-mods.com there is some spot light mods that use this.

Example, https://www.gta5-mods.com/scripts/spotlight

 

I know this isn't right and if an admin or mod wants to remove it or me to remove it I will, the mod link I posted isn't obfuscated. I understand it, but if you can this is how he makes it aim at them setting the dir to the Vector3 rot based on

 

vector = (closestVeh.get_Position() - item.get_Position()) - ((Vector3) (item.get_ForwardVector() * 1.2f));

 

item being an object he creates and attaches to the heli where he has the spotlight.

closestVeh can be anything that was just based on if the var in his mod was set to true to track the closest vehicle.

 

The model he attaches is, Model invisibleObjModel = new Model("prop_amb_phone");

 

He attaches it at, "X", -0.8f, "Y", 1.17f, "Z", 0.52f , but he also bases the pos he attaches it based on a 'Compatible Vehicle Models List'.

 

As for the native he uses, _DRAW_SPOT_LIGHT_WITH_SHADOW

 

What he sets for the ending params of that native based on what you're in,

 

 

[Radius]
//Change the spotlight radius
Helicopter=12
Car=10
Boat=10
[brightness]
//Change the spotlight brightness
Helicopter=35
Car=20
Boat=30
[Distance]
//Change the distance the spotlight can reach
Helicopter=230
Car=60
Boat=79
[FadeOut]
Helicopter=50
Car=40
Boat=45

 

The attachment positions for that object based on the vehicle,

 

[POLICE]
X = -0.8
Y = 1.17
Z = 0.52
[POLICE2]
X = -0.84
Y = 0.85
Z = 0.43
[POLICE3]
X = -0.84
Y = 0.85
Z = 0.59
[POLICE4]
X = -0.8
Y = 1.17
Z = 0.52
[POLICET]
X = -1.05
Y = 1.42
Z = 0.95
[RIOT]
X = -1.18
Y = 1.75
Z = 1.55
[FBI]
X = -0.84
Y = 0.85
Z = 0.43
[FBI2]
X = -0.9
Y = 1.2
Z = 1.0
[POLICEOLD1]
X = -0.85
Y = 0.89
Z = 0.78
[POLICEOLD2]
X = -0.88
Y = 0.8
Z = 0.6
[sHERIFF]
X = -0.8
Y = 1.17
Z = 0.52
[sHERIFF2]
X = -0.9
Y = 1.2
Z = 1.0
[PRANGER]
X = -0.9
Y = 1.2
Z = 1.0
[LGUARD]
X = -0.9
Y = 1.2
Z = 1.0
[POLMAV]
X = -0.78
Y = 2.4
Z = -1.0
[CHINO]
X= -0.8
Y= 1.17
Z= 0.52
[bUZZARD]
X= -0.1000004
Y= 2.369999
Z= -0.4799996
[bUZZARD2]
X= -0.1000004
Y= 2.369999
Z= -0.4799996
[PREDATOR]
X= -0.03000049
Y= -0.4299991
Z= 1.679999

 



Edited  by iDontKnowHowToCode

Share this post


Link to post
Share on other sites
alexguirre

But the DRAW_SPOT_LIGHT natives just draw the light, not the light cone or the origin corona, and it doesn't rotate the spotlight turret.

If you want it to work like the police helicopter spotlight during pursuits, which I guess is what you want, you need SET_VEHICLE_SEARCHLIGHT and SET_MOUNTED_WEAPON_TARGET.

 

For example, turn on the spotlight:

SET_VEHICLE_SEARCHLIGHT(heli, true, true);

and then set the target, it can be a Ped, a Vehicle or a position:

SET_MOUNTED_WEAPON_TARGET(ped, targetPed, 0, 0f, 0f, 0f); // "ped" is the helicopter pilotSET_MOUNTED_WEAPON_TARGET(ped, 0, targetVehicle, 0f, 0f, 0f);SET_MOUNTED_WEAPON_TARGET(ped, 0, 0, targetPosition.X, targetPosition.Y, targetPosition.Z);

Share this post


Link to post
Share on other sites
Cyron43

Wow thanks for the detailed information, guys. :^:
@iDontKnowHowToCode it's a matter of honor for me to NOT copy&paste the code of others. I don't want others to do it with my code either and I would feel stupid if I wouldn't be able to solve programming issues on my own. Asking for help is okay and educates but copy&paste teaches nothing and is just plain plagiarism. :)

Edited by Cyron43

Share this post


Link to post
Share on other sites
Duced

Did you get the script working? Im working on my own but I just started coding or editing. If you still have it could you send it to me? 

 

-greetings from germany

Share this post


Link to post
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.
Note: Your post will require moderator approval before it will be visible.

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.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.