Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

local variables used in main.scm


piotre_94
 Share

Recommended Posts

Hi!

 

I'm wondering if it's possible to get the value of a local variable from the main.scm with a cleo mod?

 

in the main.scm I've got this varible [email protected] in mission X and want to check its value for my cleo mod

 

 

i think it's impossible, but i can't find an another solution

Link to comment
Share on other sites

 

[...The difference between local and global variable is that you use a global through the whole script. A local variable is applies only within one thread. When you assign a value to [email protected], and you want to use that number in another thread again, it won't be avaiable, you have to assign it that value again. The value of the other thread doesn't apply any more.[...]

 

But I think you can define the thing (which is defined as [email protected] in mission x) in your script....depends on what [email protected] is

 

Link to comment
Share on other sites

As I know, you can't get any values from a local variable if it's not placed in the current "thread". Use global vars instead. wink.gif

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
Share on other sites

 

As I know, you can't get any values from a local variable if it's not placed in the current "thread". Use global vars instead. wink.gif

I think he/she wants to handle an object which appears in mission x.....that could be anything....a barrel or an ammo box

so it depends on what [email protected] means:

 

if [email protected] is an object than he/she jaus has to load and define it

Link to comment
Share on other sites

Well then there should be a definition of [email protected] in the beginning of the thread

 

something like:

 

[...] handle as [email protected] or

[email protected] = [...]

 

so just search for them and find the opcode and your done smile.gif

 

 

 

EDIT://

 

I looked for the opcode and found this:

 

 

:DESERT5_272600D6: if 0039:   [email protected] == 5 004D: jump_if_false @DESERT5_2751 0006: [email protected] = 6 

 

 

[email protected] is only a counter which is designed as an other term....

 

I guess you want to give CJ a parachute when exiting a plnae/heli?

Just like if you had passed the Learning to fly mission and got your pilot license, right??

 

0004: $FREEFALL_STAGE = 0  0004: $PARACHUTE_CREATION_STAGE = 0 062A: change_stat 223 (pilot skill) to 1000.0; float

 

 

a few codes I found which might do the same....or you just write a simple script like:

 

 

  03A4: name_thread 'CLTRNR1'   :CHUTE_01 wait 0 if and 0491:   actor $PLAYER_ACTOR has_weapon 46  0256:   player $PLAYER_CHAR defined  03EE:   player $PLAYER_CHAR controllable  04AB:   actor $PLAYER_ACTOR driving_plane 04A9:   actor $PLAYER_ACTOR driving_heli 00E1:   key_pressed  0  18    // horn jf @CHUTE_01 wait 0 0247: load_model #GUN_PARA  01B2: give_actor $PLAYER_ACTOR weapon 46 ammo 1 // Load the weapon model before using this  0249: release_model #GUN_PARA  038B: load_requested_models  jump @CHUTE_01

 

 

 

thtas just a quick one....

Edited by The_Siggi
Link to comment
Share on other sites

See if this script works reliably enough. I don't understand what's going on in memory here but it seemed to work consistently during testing.

 

 

{$CLEO .cs}0000:while true wait 250 if   0AB0:   key_pressed 0x76    // F7 then                                                                              0006: [email protected] = 34               // local variable number to read   0012: [email protected] *= 4               // variable length   000A: [email protected] += 0xA48960        // start of (unknown) variable space   0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0   01E3: show_text_1number_styled GXT 'NUMBER' number [email protected] time 5000 style 1 endend

 

Link to comment
Share on other sites

it works perfectly colgate.gif .

 

Thank you so much

 

I have just one question about your technic, is it possible to "injected" an another value into a local variable in the main.scm?

 

for example:

 

in the main.scm i've got [email protected] = 42

could we change it like this [email protected] = [email protected] ([email protected] is a local value of my cleo mod)

Link to comment
Share on other sites

Mmm... Don't think so... But remember, with memory access nearly everything that is already in the game is possible biggrin.gif

 

So you just need to get the memoy of that variable.

 

I think there's a program by Seemann that allows you to view/edit local variables while the game is on. Get that program, go on the mission and see what the value is... Then, using CheatEngine (or something similar) scan for that value...

 

If there are a few results, play the mission a bit and see if the value changes. If so, do another scan wink.gif

 

Once you find the address, you can edit it in your CLEO script... I call proccesses like this "Script Hijacking" since it requires you to force interaction between 2 scripts. I used it in the Black Market mod to change the actions of all drug dealers smile.gif

 

Not sure if that's the best way of going about it, but it's what I'd try... I'm sure another modder will click the quote button or something and correct me somehow tounge2.gif

Link to comment
Share on other sites

 

Mmm... Don't think so... But remember, with memory access nearly everything that is already in the game is possible biggrin.gif

 

So you just need to get the memoy of that variable.

 

I think there's a program by Seemann that allows you to view/edit local variables while the game is on. Get that program, go on the mission and see what the value is... Then, using CheatEngine (or something similar) scan for that value...

 

If there are a few results, play the mission a bit and see if the value changes. If so, do another scan wink.gif

 

Once you find the address, you can edit it in your CLEO script... I call proccesses like this "Script Hijacking" since it requires you to force interaction between 2 scripts. I used it in the Black Market mod to change the actions of all drug dealers smile.gif

 

Not sure if that's the best way of going about it, but it's what I'd try... I'm sure another modder will click the quote button or something and correct me somehow tounge2.gif

 

I find the program by seamann but i don't know how to instal it

can someone help me please

Link to comment
Share on other sites

I have just one question about your technic, is it possible to "injected" an another value into a local variable in the main.scm?

Maybe. For starters, as I mentioned before, I'm not at all sure what's going on in memory here. Also, I've got no idea how the standard "mission" will react to having it's variables changed while it's running. The results may not be as expected. I suppose it's worth a try.

 

Driving School is a mission. Missions have many more local variables available than scripts. Usually only 1 mission is running at a time, although it is possible for more than one mission to be active. The memory region I was accessing appears to be used by whichever mission is running first. I was unable to find where a custom CLEO mission that was launched after starting driving school was storing it's variables. In the few tests I conducted the mission always used the same memory region for it's local variables, but I've got no idea if that will always be the case.

 

Clarification: main.scm is the filename of the script. MAIN is the name of the thread that controls all the action and I suspect it has it's own set of local variables. You mentioned that you were making a trainer for driving school (DSKOOL). So, if I understand correctly, you want to "inject" values into the local variables of dskool. You should probably add a check to make sure that the thread you want to mess with is actually running before altering any information in memory.

 

 

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
 Share

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