Jump to content

Save Game


ogsf4life

Recommended Posts

9 hours ago, ZAZ said:

when script starts, then save game was loaded

or do you wanna separate save game from new game start?

or do you wanna know, WHICH save game was loaded?

 

yes, i wanna know if an save game was loaded .

in other words, I want to know if when the CJ appears on the screen, if the player entered the new game or if the player loaded the saved game.

 

Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071316773
Share on other sites

Examples from a script that makes save modifications only when a new game starts:

 

// Check for blue BMX marker - if there, warp W to trigger Radar message
:CG_Trigger_Start
0001: wait 250 ms

00D6: if
075C:   marker $61 enabled  // blue marker over BMX at start of game 
004D: jump_if_false @CG_Trigger_Start

00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CG_Trigger_Start

//RBR/CG37a7r: Check if it's a clean new game (gtasa.exe restarted)
// IPL pickups are placed before the SCM pickups in the pool,
// but IPL pickups only get placed on the first run of a freshly started game.
// Wang's unavailable asset pickup is the first one in the SCM, so:
//   if the 1st pickup in the pool (index 0) is Wang's, then it's a restarted game
//   if not, then it's a clean new game
00D6: if
8038:   not  $BUY_ASSET_PICKUPS[0] == 0x00020000  // Wang's unavailable asset pickup is not the 1st pickup
004D: jump_if_false @CG_Trigger_Error_Restart

00A1: put_actor $PLAYER_ACTOR at 2209.367 -1261.939 22.9375  // warp west (x -= 30) to trigger Radar message
0173: set_actor $PLAYER_ACTOR Z_angle_to 272.5814            // not really needed but kept for refernce to orig. starting location
00BA: show_text_styled GXT 'CGTWKST' time 2000 style 2       // Chain Game Tweaking
//0001: wait 250 ms
0AB3: var 1 = 0     // flag 1st tweaking mission finished
0AB3: var 2 = 0     // flag 2nd tweaking mission finished

// Start 1st tweaking mission when the original game's Mission 2 ('INTRO') has finished
:CG_Trigger_Mission1
0001: wait 250 ms 
00D6: if
0038:   $MISSION_INTRO_PASSED == 1     // the last thing to happen in Mission 2 ('INTRO')
004D: jump_if_false @CG_Trigger_Mission1
0A94: start_custom_mission "CG.Tweaks.1"

Similar strategy, check if 'INTRO' mission is active:

0AAA: 0@ = thread 'INTRO' pointer
if
  0@ == 0
then
  // save was loaded
else
  // new game created
end

This might be easier, but remember that the mission will be passed as soon as CJ moves away from the bike. I'm not exactly sure when the mission ends if CJ decides to ride the bike.

if
  $MISSION_INTRO_PASSED == 0
then
  // new game started
else
  // save loaded
end

 

Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071316882
Share on other sites

 

 

 

 

i think than the script is saving the groups in the save, and is not cleaning the groups and releasing them when i load save, that's why I asked how to check if a save game was loaded, this is bugging the behavior of the members, when I load the game, and recruit the members, they enter the group, but leave walking the other way. I have to kill CJ, and then I recruit again and they behave right.

 

ill try make an adaptation with this examples.

 

Thanks Orion,thanks ZAZ.

 

 

Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071317216
Share on other sites

hey guys, me again.
is too possible check if the player came into in the icon of memory card to save game ?
or better, put an script inside of an while checking if the player dont came into in the icon of  memory card/save game,then when to enter in the icon to save game , the script  exit of while e dont save what is inside this loop while?

 

small example :

 

while true

 

 repeat

   wait 0

0256:   player $PLAYER_CHAR defined

 

      while player not  came into in icon memory card/save game    

        0237: set_gang 1 weapons_to MINIGUN MINIGUN MINIGUN
      end

   

//after came into in the memory card/save game, the gang 1 weapon , return to normal mode: pistol and tec-9

// 0237: set_gang 1 weapons_to 24 29 4

 

end

 

 

i dont want than the script save when i to save the game.

and too dont want use external script.

 

 

 

 

 


 

Edited by ogsf4life
Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071322587
Share on other sites

I have another idea, but it seems rather hacky, improper. This is a tricky puzzle as the psave script wants to jump immediately to the save screen once the save pickup has been picked up. The idea is to modify the PSAVE script in memory to execute a gang weapon reset before continuing to the save screen.

 

Standard v1 with global offsets and custom labels:

:PSAVE1_88021
00D6: if 
0214:   pickup $Save_Pickups($Save_Pickups_Index,18i) picked_up 
004D: jump_if_false @PSAVE1_88200 
0050: gosub @sub_Show_Save_Screen 

So change @sub_Show_Save_Screen to an address with compiled codes that reset the gang weapons before jumping to the original gosub location.

 

There are still a few technical details to work out, but those can be resolved if you like the idea.

Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071323842
Share on other sites

You can't catch the moment just before the save using only opcodes, as the game pauses all scripts while the main menu is active. The best you can do is to check if the game was just saved, but this does not seem to help with the initial request.

 

You can write a code using assembler that resets gang weapons before the save and inject that in the game code. But I would think of something much simpler.

 

Initially you asked about the moment when the game starts. It's easy, this is the first line of a CLEO script (without enable_thread_saving). Now you can check what kind of weapons gangs have and reset them if necessary. So the idea is that you don't try to intervene with the saving routine, but instead you setup the game state as appropriate when your script runs.

 

 

Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071323874
Share on other sites

11 hours ago, OrionSR said:

I have another idea, but it seems rather hacky, improper. This is a tricky puzzle as the psave script wants to jump immediately to the save screen once the save pickup has been picked up. The idea is to modify the PSAVE script in memory to execute a gang weapon reset before continuing to the save screen.

 

Standard v1 with global offsets and custom labels:


:PSAVE1_88021
00D6: if 
0214:   pickup $Save_Pickups($Save_Pickups_Index,18i) picked_up 
004D: jump_if_false @PSAVE1_88200 
0050: gosub @sub_Show_Save_Screen 

So change @sub_Show_Save_Screen to an address with compiled codes that reset the gang weapons before jumping to the original gosub location.

 

There are still a few technical details to work out, but those can be resolved if you like the idea.

i liked this..

it looks like it will solve.

ill try make exactly this.

 

 

8 hours ago, Seemann said:

You can't catch the moment just before the save using only opcodes, as the game pauses all scripts while the main menu is active. The best you can do is to check if the game was just saved, but this does not seem to help with the initial request.

 

You can write a code using assembler that resets gang weapons before the save and inject that in the game code. But I would think of something much simpler.

 

Initially you asked about the moment when the game starts. It's easy, this is the first line of a CLEO script (without enable_thread_saving). Now you can check what kind of weapons gangs have and reset them if necessary. So the idea is that you don't try to intervene with the saving routine, but instead you setup the game state as appropriate when your script runs.

 

 

too is a good idea.

i already imagined it would be difficult to catch exactly the moment before the game was saved.

 

maybe it is being even more difficult because I am compiling the code inside the main.scm, I do not know how is the behavior inside the script after an game is saved and after is loaded.

 

Edited by ogsf4life
Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071324146
Share on other sites

1 hour ago, ogsf4life said:

maybe it is being even more difficult because I am compiling the code inside the main.scm

Oh... Working with main.scm should be easier. You could add the gang weapon reset just before the gosub call, or within the gosub routine.

 

It's a little trickier if your custom main is designed to be compatible with standard save games, but still manageable. If your custom main doesn't need to be save compatible, then I agree with Seemann. Don't worry about saving the modifications and simply set things the way you want as needed.

Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071324236
Share on other sites

20 minutes ago, OrionSR said:

Oh... Working with main.scm should be easier. You could add the gang weapon reset just before the gosub call, or within the gosub routine.

 

It's a little trickier if your custom main is designed to be compatible with standard save games, but still manageable. If your custom main doesn't need to be save compatible, then I agree with Seemann. Don't worry about saving the modifications and simply set things the way you want as needed.

yes, the script of gang weapon was an small example,dont is  the real script,but the idea to solver this is the a same.

ill try do like you and seeman said..

If I dont succeed, I'll come back here with the whole script.

Thanks Guys.

 

Link to comment
https://gtaforums.com/topic/960148-save-game/#findComment-1071324254
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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

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