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

    1. GTANet.com

    1. GTA Online

      1. Los Santos Summer Special
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Red Dead Redemption 2

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

    1. Grand Theft Auto Series

    2. GTA 6

      1. St Andrews Cathedral
    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

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

    1. Announcements

    2. Support

    3. Suggestions

OrionSR

Launching Threads with CLEO

Recommended Posts

OrionSR

I would like to launch the threads for Bike School, Boat School, and the Street Races at the beginning of the game. This worked nicely in a custom main with the codes placed before the end of Mission 2. However, we are trying to convert the Chain Game modifications to a custom CLEO mission, and these features are posing a major problem. Is there a method to create these threads with a cleo script or mission so they will run independently when the save is loaded without cleo and using default scripts?

 

I would like to apply a custom save name if a custom mission is completed successfully. The current strategy is to read the GXT key for the last mission passed and create a file with a line than includes the current GXT key and a custom filename string. The basic strategy is working, sort of. The main problem is that changes to the files and their content does not appear to get reloaded by the GXThook plugin unless the game is restarted. Is there a method to give the GXThook a kick in the pants so it will read the string from a file that is created at the end of the mission?

 

Thanks to anyone who can help.

 

Share this post


Link to post
Share on other sites
Seemann

1) Sure, you can start these threads from a CLEO thread/mission. The only issue is that you need to provide correct labels offsets in opcode 004F.

 

If you write

 

create_thread @BSCHOO 

 

this won't work, as the compiler knows nothing about this thread when compiling a CLEO file. You need to use an ordinary number then. Say, in the default unmodded main.scm, the mentioned thread has an offset 76138 (76138 bytes from the beginning of the main.scm).

 

So, if you will write

 

create_thread 76138

 

in a CLEO script, this will create the Bike School thread correctly.

 

I only afraid of one thing: when you pass the mission after which the Bike School trigger is activated you may get a duplicate thread (two 'BSCHOO' threads), so you probably need to set some global variables to prevent it.

 

How do I know that number (76138)? Go to Sanny Builder options, "Formats" page, option "Labels Format", select "Thread+Global Offset". Decompile the original main.scm with this option. All labels will have a format of . This number is the thread offset you need.

 

2) You can't reset the GXT Hook (it's possible, I guess, but is not as easy). But you probably may use another way of changing GXT strings I developed much before the hook. The idea is, to change default text for the gxt entry, say, for the ITBEG instead of "In the beginning..." set "Custom Text":

 

 

{$CLEO}0A9F: [email protected] = [email protected] += 0x100A8D: [email protected] = read_memory [email protected] size 4 virtual_protect [email protected] -= @[email protected] += 0x30AA8: call_function_method 0x6A0050 struct 0xC1B340 num_params 1 pop 0 [email protected] [email protected] // [email protected] += 0xC0AA5: call 0x718600 num_params 2 pop 2 [email protected] [email protected] // cpystr0A93: end_custom_thread:GxtLabel0900: 'ITBEG'              // any gxt entry, should be '':NewName0900: "Custom Save Name"   // any name shorter than "In the beginning...", should be ""0000: null_terminator

 

 

 

 

 

Share this post


Link to post
Share on other sites
OrionSR

Thanks Seemann, this helps a great deal. The global offset addresses are working as described. Fortunately, pdescobar's original code has already taken steps to prevent thread duping (comments added).

 

 

$1397 = 1 // Flag TRACE, BSCHOO, and BIKES threads as launched.$1398 = 1 // Flag race markers as created.

 

 

The only drawback to this strategy is that the player must know to visit driving school because he will not receive the call from Jethro. However, we've been playing with this limitation for many rounds and it doesn't cause any confusion for experienced players.

___

 

The codes for changing the gxt string look very interesting. This strategy is likely to provide a conditional file naming strategy for our starter saves; a goal I had not tried to implement just yet. However, it doesn't appear to have the flexibility I was hoping to achieve for a custom rally mission. This is a different project than the Chain Game starter saves I'm usually working on. I'll explain a little more.

 

Skipping Palomino is a custom Rally mission with coding based on the Kickstart mission. The goal is to start at Palomino Creek and jump across the river many times to collect coronas and finish at Santa Maria Beach before time expires. The player is awarded a medal standard based on the number of points collected. I would like to provide suitable rewards for completing the mission, but I don't want to make significant changes to the save file. So, creating new vehicle generators or pickups, and altering the gxt key for the last mission passed are not options under consideration. I also don't want to cause problems with the GXThook so if this can't be accomplished politely then I'll look for other reward strategies.

 

The problem with changing the GXT string in memory is that the change is limited to the length of the current string and the custom rally mission is always active when running. It could be that the last mission passed is "Lure", far too short for a custom save name like "Palomino Gold". Again, if this can't be accomplished politely then I won't use the strategy, but I like the idea enough that I'm not quite willing to give up hope for finding a suitable solution.

Share this post


Link to post
Share on other sites
Seemann

 

It could be that the last mission passed is "Lure", far too short for a custom save name like "Palomino Gold".

What if clear the last mission name record to force the game use the "ITBEG" entry

 

[email protected] = 310312&0([email protected],1i) = 0

 

and change the ITBEG accordingly to a custom text using the method I've previously described?

Share this post


Link to post
Share on other sites
OrionSR

If I clear the last mission completed gxt key then the next time the player saves that file it will have In the beginning as the displayed name. I would not be happy if my favorite End of the Line save got renamed back to In the beginning so I wouldn't want to make this change to the saves of people who try my mission. A similar option I've decided not to use is to include an fxt file with my custom save names and then change the last mission gxt key as required. But then if the file is resaved without the fxt key active the save won't have any name at all - which displays as file not present and a file date.

 

Is it possible to temporarily change where SA will look for the gxt key? The idea is to write an fxt key someplace that references a line in the fxt file I'm using for the mission.

Update: I think I've got this working. The process is currently using some unused globals that PD had already reserved for file naming, but I might look for another temporary location to store this information. The change will persist if a save is reloaded, but I can probably clear that up with the trigger script. The change reverts to the normal gxt key if the game is reloaded, even if my scripts are not running. Let me know if you see any flaws with this plan.

 

 

{$CLEO .cm}:CG_Testing thread "Testing"//[email protected] = 310312         // Seemann's clear //&0([email protected],1i) = 0       // gxt key codes// SP_GOLD Palomino Gold! <-- Line included in cleo\CLEO_TEXT\*.fxtconstCG_SAVENAME = "SP_GOLD"endv$76 = CG_SAVENAMEwait 0//Change last mission passed gxt key pointer to address of global variable $760A8C: write_memory 0x5d1b92  size 4 value 0xa49a90 virtual_protect 1wait 25000BB: show_text_lowpriority GXT 'FESZ_LS' time 2000 flag 1  // Load Successful.004E: end_thread 

 

I'm a little worried about using that virtual protect flag. I'm not sure what it does other than prevent this mission from crashing the game. Also, I'm still completely baffled by the addresses that you use for your & codes.

 

Update 2: Trigger Script with line to reset the gxt key pointer back to normal if a save is loaded.

 

{$CLEO .cs}0000://Reset last mission passed gxt key pointer to address of default location0A8C: write_memory 0x5d1b92  size 4 value 0xb78a00 virtual_protect 1  while true wait 250 if   0AB0:   key_pressed 0x76    // F7 then                                                                              0A94: start_custom_mission "Testing" endend

 

Edited by OrionSR

Share this post


Link to post
Share on other sites
Seemann

 

0A8C: write_memory 0x5d1b92  size 4 value 0xa49a90 virtual_protect 1

 

be aware that this code only works with the 1.0 version, not with the higher ones.

 

the virtual_protect parameter allows to change the exe code (.code) that is read-only or execute-only by default. Ordinary memory addresses for the data (.data) are changeable without virtual_parameter being set.

Share this post


Link to post
Share on other sites
OrionSR
0A8C: write_memory 0x5d1b92  size 4 value 0xa49a90 virtual_protect 1

 

be aware that this code only works with the 1.0 version, not with the higher ones.

 

I was afraid of that. My experience with the PS2 cheat was that memory writes are terribly version dependent. Am I correct in assuming that the address and pointer will be different on other versions? I'm hoping I can avoid conflicts by reading the data and making sure it matches expectations, or perhaps include other versions if more data becomes available.

Share this post


Link to post
Share on other sites
Seemann

Yes, you are. You have to use different memory addresses in each versions (1.0 and 1.1, as these are the only CLEO supported versions).

 

Use

0AA9: is_game_version_original

to check if the current game version is 1.0 and use proper addresses.

Share this post


Link to post
Share on other sites
OrionSR

Update: The one line code isn't working. I guess I need to remember to restart completely in order to clear old changes from memory. Anyway, I'm not really sure what I'm messing with, but both of these pointers need to be adjusted for the trick to work properly.

 

 

//Change last mission passed gxt key pointer to address of global variable $760A8C: write_memory 0x5d1b92  size 4 value 0xa49a90 virtual_protect 1  0A8C: write_memory 0x5d1b81  size 4 value 0xa49a90 virtual_protect 1//OSR/use these commands early in the trigger scipt to reset the gxt pointer to normal when a save is loaded{//Reset last mission passed gxt key pointers to address of default location0A8C: write_memory 0x5d1b92  size 4 value 0xb78a00 virtual_protect 1 // point to default address of gxt key 0A8C: write_memory 0x5d1b81  size 4 value 0xb78a00 virtual_protect 1}

 

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.

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.