Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (86,304 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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

    2. Red Dead Redemption

    3. 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. Forum Support

    2. Site Suggestions

Sign in to follow this  
frankandbeans

[SA] memory scripting 'INTMAN'

Recommended Posts

frankandbeans

I'm trying to alter the 2-star-wanted-level behavior at police departments when the player is armed, but I can't seem to get it working. Here's what I'm trying to use:

{$cleo}0000:while true    wait 0    0AAA: [email protected] = thread 'INTMAN' pointer    if [email protected] <> 0    jf continue           [email protected] += 16   //base ip       0A8D: [email protected] = read_memory [email protected] size 4 vp 0        [email protected] += 3094 //offset        if gosub @HasNotBeenModified    jf continue        0A8C: write_memory [email protected] size 1 value 0 vp 1      end:HasNotBeenModified0085: [email protected] = [email protected]: [email protected] = read_memory [email protected] size 1 virtual_protect 0if not [email protected] == 0return

Basically I'm trying to change the value '2' to '0' in 'Player.SetMinWantedLevel($PLAYER_CHAR, 2)' shown from the main.scm:

:INTMAN_3052if   $1260 == 1 else_jump @INTMAN_3095 if 82D8:   not actor $PLAYER_ACTOR current_weapon == 56 else_jump @INTMAN_3095 Player.SetMinWantedLevel($PLAYER_CHAR, 2)

The '[email protected] += 16' makes my game crash, but if I don't use it, no changes occur.

 

note: this is just an example, so don't tell me to use other methods please.

 

Tried this too:

{$cleo}0000:while true    wait 0    0AAA: [email protected] = thread 'MAIN' pointer    if [email protected] <> 0    jf continue            [email protected] += 16   //base ip       0A8D: [email protected] = read_memory [email protected] size 4 vp 0        [email protected] += 101988 //offset        if gosub @HasNotBeenModified    jf continue        0A8C: write_memory [email protected] size 1 value 0 vp 1      end:HasNotBeenModified0085: [email protected] = [email protected]: [email protected] = read_memory [email protected] size 1 virtual_protect 0if not [email protected] == 0return
Edited by frankandbeans

Share this post


Link to post
Share on other sites
Jack

There's no need to make an extra code since this specific change won't effect the save game.
Just replace 2 with 0 and compile. That's it.

It can be done as cleo like this:

const    globalVarsPointer = 0x44CA44    PrecinctLevel = 0end0A8D: [email protected] = read_memory globalVarsPointer size 4 virtual_protect 00A8E: [email protected] = [email protected] + 0x2690C0A8C: write_memory [email protected] size 1 value PrecinctLevel virtual_protect 00A93: end_custom_thread

Share this post


Link to post
Share on other sites
frankandbeans

 

There's no need to make an extra code since this specific change won't effect the save game.

Just replace 2 with 0 and compile. That's it.

 

It can be done as cleo like this:

 

const    globalVarsPointer = 0x44CA44    PrecinctLevel = 0end0A8D: [email protected] = read_memory globalVarsPointer size 4 virtual_protect 00A8E: [email protected] = [email protected] + 0x2690C0A8C: write_memory [email protected] size 1 value PrecinctLevel virtual_protect 00A93: end_custom_thread

 

 

Junior_Djjr helped me out and actually I wanted to do it like this because I wanted to add a police outfit check. Your script looks interesting though, so I'll study it. I had a hard time locating the exact offset.

Edited by frankandbeans

Share this post


Link to post
Share on other sites
DK22Pac

So maybe you should ask Junior_Djjr directly?

 

Also: another idea is to intercept SetMinWantedLevel command call in 'INTMAN' thread (something similar to this). With such implementation It'll work even if your main.scm was changed/recompiled.

Share this post


Link to post
Share on other sites
frankandbeans

So maybe you should ask Junior_Djjr directly?

 

Also: another idea is to intercept SetMinWantedLevel command call in 'INTMAN' thread (something similar to this). With such implementation It'll work even if your main.scm was changed/recompiled.

I've already stated that Junior_Djjr helped me out (by asking him directly).

 

Isn't that what my script was basically trying to do? Finding the 'INTMAN' thread and writing '0' over '2' in SetMinWantedLevel. Yours doesn't look like a cleo script. Is it asi/dll?

 

There's no need to make an extra code since this specific change won't effect the save game.

Just replace 2 with 0 and compile. That's it.

 

It can be done as cleo like this:

 

const    globalVarsPointer = 0x44CA44    PrecinctLevel = 0end0A8D: [email protected] = read_memory globalVarsPointer size 4 virtual_protect 00A8E: [email protected] = [email protected] + 0x2690C0A8C: write_memory [email protected] size 1 value PrecinctLevel virtual_protect 00A93: end_custom_thread

 

How did you get the global vars pointer? Through IDA? Cheat engine?

Edited by frankandbeans

Share this post


Link to post
Share on other sites
DK22Pac

Yours doesn't look like a cleo script. Is it asi/dll?

That's a C++ code, meant to be compiled and used as dll/asi library/plugin.

Share this post


Link to post
Share on other sites
Jack

How did you get the global vars pointer? Through IDA? Cheat engine?

Both. And GTA database too.

 

So maybe you should ask Junior_Djjr directly?

 

Also: another idea is to intercept SetMinWantedLevel command call in 'INTMAN' thread (something similar to this). With such implementation It'll work even if your main.scm was changed/recompiled.

I noticed that there're many opcodes (mostly CLEO4) which are not present in the database (like 010E {ALTER_WANTED_LEVEL_NO_DROP}).

How are they implemented?

For example 010E calls CWanted::SetWantedLevelNoDrop. So I searched for "call _ZN7CWanted20SetWantedLevelNoDropEi" and I got 0 results from CRunningScript::ProcessCommands. ???

 

So how to call those opcodes (in SDK) and where are they? Is there a documentation similar as in database? Or maybe I'm missing something?

Edited by Jack

Share this post


Link to post
Share on other sites
DK22Pac

I noticed that there're many opcodes (mostly CLEO4) which are not present in the database (like 010E {ALTER_WANTED_LEVEL_NO_DROP}).

How are they implemented?

1) 010E is not a CLEO4 opcode.

2) CLEO4 opcodes are not presented in gta_sa executable, they're part of CLEO.asi plugin.

 

 

For example 010E calls CWanted::SetWantedLevelNoDrop. So I searched for "call _ZN7CWanted20SetWantedLevelNoDropEi" and I got 0 results from CRunningScript::ProcessCommands. ???

 

So how to call those opcodes (in SDK) and where are they? Is there a documentation similar as in database? Or maybe I'm missing something?

All original opcodes are divided among 27 ProcessCommands functions (100 opcode IDs per each function).

So, with given 010E ID, we have this:

1) Opcode ID 010Eh (hexademical) is 270d in decimal.

2) This opcode is implemented in CRunningScript::ProcessCommands200to299 function (270 is placed between 200 and 299).

3) Decompile this function and find a desired branch in switch construction (case 0x10E/270):

 

CLyMoDg.png

 

For opcode use in plugin, check ScriptCommands example (III/VC/SA)

Edited by DK22Pac

Share this post


Link to post
Share on other sites
Jack

...

Great. Thanks.

Share this post


Link to post
Share on other sites
frankandbeans

edit: deleted post

Edited by frankandbeans

Share this post


Link to post
Share on other sites
frankandbeans

edit: deleted post

Edited by frankandbeans

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
Sign in to follow this  

×

Important Information

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