Jump to content

[SA] Cleo Is it possible to create heli search using CHeli::AddHeliSearchLight ?


vladvo

Recommended Posts

Tried to create one the moment CJ enters heli - no luck. Crashes. 

0x6C45B0 ; int __cdecl CHeli::AddHeliSearchLight(CVector *startPoint, CVector *targetPoint, float targetRadius, float shadowIntensity, int coronaIndex, char bFlag_f1, char bDrawShadow)
 

{$CLEO .cs}
script_name 'HT'
0000:
:CHECK
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @CHECK
if
04A9:   actor $PLAYER_ACTOR driving_heli
jf @CHECK
00C0: set_current_time 22 05
0811: 1@ = actor $PLAYER_ACTOR used_car
0407: store_coords_to 4@ 5@ 6@ from_car 1@ with_offset 0.0 2.0 -0.5
0407: store_coords_to 14@ 15@ 16@ from_car 1@ with_offset 0.0 2.0 -10.0
//CHeli::AddHeliSearchLight(CVector *startPoint, CVector *targetPoint, float targetRadius, float shadowIntensity, int coronaIndex, char bFlag_f1, char bDrawShadow)
0AA5: call_function 0x6C45B0 num_params 7 pop 7  1 1 1 10.0 10.0 14@v 4@v  
//0AA5: call_function 0x6C45B0 num_params 7 pop 7 4@v 14@v 10.0 10.0 1 0 1 
while 04A9:   actor $PLAYER_ACTOR driving_heli
wait 0
0AD1: show_formatted_text_highpriority "Test" time 2000
end
jump @CHECK

I know there's 06C1: CREATE_SEARCHLIGHT_ON_VEHICLE that works well with heli but there is also a tHeliLight stuct with m_fPower setting that looks interesting. I can increase power on 'regular' searchlight by placing duplicate at the same coords, but this way is more fun. 

Link to comment
Share on other sites

Try pop 0.  I'm still trying to learn the rules for these things but pop 0 often works. Don't know why yet.

Link to comment
Share on other sites

10 hours ago, OrionSR said:

Try pop 0

Nope, didn't work. I suspect this AddHeliSearchLight is something hardcoded. There is no option to specify which heli you're adding a light to.
By the way, are there any "free" global vars that I can safely use in my script ? Can I use something like $20000 ?

Edited by vladvo
Link to comment
Share on other sites

1 hour ago, vladvo said:

By the way, are there any "free" global vars that I can safely use in my script ?

Short answer: No.

Long answer: No, all global variables are owned by main.scm.

Dude, now I got that little mwah-mwah you were after.

But, be careful, man, people are listening to us.

I got a little global village up in the hills, come and get it.

Whoa, man, I don't know you, I don't know you!

Prank caller, prank caller!

 

 

It really depends on what you're looking for and which rules you are willing to break. How many vars do you need? So you need consecutive vars for short or long string? Are large arrays needed? Do the vars need to be saved? What is the chance that your mod will be mixed with other mods? Will you be annoyed if your save is no longer compatible with Save Editors?

 

$20000? Definitely not. Global vars have a limited range near $16000 due to their 2 byte identifier. If you change anything above $15000 or so (iirc, 60072/4) your game will crash when you overwrite required codes in the MAIN thread.

 

Why use global variables instead of other options?

 

5 minutes ago, cjfan_ said:

It has to do with this

You might be interested in this new documentation from Seemann, the author of Sanny Builder. He wrote a tool to convert DK22pac's plugin functions to cleo. Due to inconsistencies in formatting, it's not a complete reference at this time. CHeli is one of the sections that's incomplete, unfortunately.
https://x87.github.io/cpp2cleo/

Link to comment
Share on other sites

7 hours ago, OrionSR said:

Why use global variables instead of other options?

I want to pass a cleo var to modified external script. I think it should work but I want to know the consequences of it on the long run. And how to avoid them, if possible.
Upd. It won't play out anyways.

Edited by vladvo
Link to comment
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
  • 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.