Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      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

Happy Holidays from the GTANet team!

Save Point Creation Script trouble


gtasearcher
 Share

Recommended Posts

I wondered myself if it wouldn't be nice to be able to make your own savepoints. Of course you don't need 'em, but just for tricking your friends that finished SA: hey the f*ck that ain't in my game! tounge.gif

 

Anyway I'm facing some small problems; like moving the savepoint when creating it and saving the game by picking up; it's a cleo and I used some arrays.

 

1 bug is that the save pickup continues flashing.

 

For making the script work, hold CAPS LOCK for 2 seconds.

 

I made the script as readable as I could; with tabs and everything. If anyone can help me, please consider doing it.

 

 

{$CLEO}thread 'CYOSP'0A95: enable_thread_saving:CYOSP1var   [email protected]: array 30 of integer // pickups array   [email protected]: array 30 of float // pickup X array   [email protected]:  array 30 of float // pickup Y array   [email protected]: array 30 of float // pickup Z array   [email protected]: integer // number of created pick-ups   [email protected]: integer // "for" variable, using it as index name for the above arrays when using the "for [email protected] = 0 to [email protected]" construction   [email protected]: float // offsets X relative to player                                [email protected]: float // ofsests Y relative to player   [email protected]: float // offsets Z relative to player   [email protected]: float // joystick X offset   [email protected]: float // joystick Y offset   [email protected]: float // float that determines the Y offset for [email protected]   [email protected]: float // float that determines the X offset for [email protected]   [email protected]: pickup // dummy save pick up used for creating points   [email protected]: float // camera position X, behind player   [email protected]: float // camera position Y, behind player   [email protected]: float // camera position Z, behind playerend                                                                   [email protected] = 0while true   wait 0   for [email protected] = 0 to [email protected]           wait 0           Pickup.Destroy([email protected]([email protected],4i))       end   if or       not Player.Defined($PLAYER_CHAR)                             $ONMISSION == 1   then       continue   end   [email protected] = 0   while 0AB0: 20       wait 0       if           [email protected] > 2000       then           Player.CanMove($PLAYER_CHAR) = 0           $ONMISSION = 1           if               [email protected] > 29           then               while true                   wait 0                   00BC: show_text_highpriority GXT 'CYOSP1' time 1 flag 1 // Limit exceeded. Clear save points? ~k~~CONVERSATION_YES~/~k~~CONVERSATION_NO~                   if                       00E1: 0 11                   then                   for [email protected] = 0 to [email protected]                       wait 0                       Pickup.Destroy([email protected]([email protected],4i))                   end                   [email protected] = 0                   break                   end                   if                       00E1: 0 10                   then                   break                   end               end               [email protected] = 0               continue               end               [email protected] = 5.0               [email protected] = 0.0               while true                   wait 0                   Pickup.Destroy([email protected])                   0512: show_permanent_text_box 'CYOSP' // Welcome to ~h~Create Your Own Save Point~w~ by gtasearcher.~n~Move using the movement keys~n~Accept with ~k~~VEHICLE_ENTER_EXIT~.                   //0494: get_joystick 0 data_to [email protected] [email protected] [email protected] [email protected]                   0A4A: store_joystick_X_offset_to [email protected] Y_offset_to [email protected]                    [email protected] *= 10.0                   [email protected] *= 10.0                   [email protected] += [email protected]                   [email protected] += [email protected]                   04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset [email protected] [email protected] 0.0                    Pickup.Create([email protected], 1277, 1, [email protected], [email protected], [email protected])                   068D: get_camera_position_to [email protected] [email protected] [email protected]                   Camera.SetPosition([email protected], [email protected], [email protected], 0.0, 0.0, 0.0)                   Camera.PointAt([email protected], [email protected], [email protected], 1)                    if                    00E1: 0 15                   then break                   end               end               Pickup.Destroy([email protected])               if                   not [email protected] == 0               then                   [email protected] += 1               end               [email protected]([email protected],4f) = [email protected]               [email protected]([email protected],4f) = [email protected]               [email protected]([email protected],4f) = [email protected]               Player.CanMove($PLAYER_CHAR) = True               $ONMISSION = 0               03E6: remove_text_box               Camera.Restore()               end               end     for [email protected] = 0 to [email protected]       wait 0       [email protected]([email protected],4i) = Pickup.Create(1277, 3, [email protected]([email protected],4f), [email protected]([email protected],4f), [email protected]([email protected],4f))   end               for [email protected] = 0 to [email protected]       wait 0       if or           not Player.Defined($PLAYER_CHAR)           $ONMISSION == 1       then       for [email protected] = 0 to [email protected]           wait 0           Pickup.Destroy([email protected]([email protected],4i))       end        break   end       {if           848C:   not pickup_at [email protected]([email protected],4f) [email protected]([email protected],4f) [email protected]([email protected],4f) available_to_be_picked_up       then           continue       end}        if            Pickup.Picked_up([email protected]([email protected],4i))           //00EF: $PLAYER_ACTOR 0 [email protected]([email protected],4f) [email protected]([email protected],4f) [email protected]([email protected],4f) 1.0 1.0 1.0       then           PICKUP.Destroy([email protected],[email protected],4i)           Player.CanMove($PLAYER_CHAR) = 0           $ONMISSION = 1           03D8: show_save_screen           wait 0           while 83D9:   not save_done                wait 0           end           wait 0           Player.CanMove($PLAYER_CHAR) = 1           $ONMISSION = 0           {for [email protected] = 0 to [email protected]               wait 0               Pickup.Destroy([email protected]([email protected],4i))           end}           while true               wait 0               if or                   not Player.Defined($PLAYER_CHAR)                   $ONMISSION == 1               then                   break               end               if                   80EC: $PLAYER_ACTOR 0 [email protected]([email protected],4f) [email protected]([email protected],4f) 3.0 3.0               then            break           end           end       end   endend

 

Edited by gtasearcher
Link to comment
Share on other sites

 

I wondered myself if it wouldn't be nice to be able to make your own savepoints. Of course you don't need 'em, but just for tricking your friends that finished SA: hey the f*ck that ain't in my game! tounge.gif

 

Anyway I'm facing some small problems; like moving the savepoint when creating it and saving the game by picking up; it's a cleo and I used some arrays.

 

1 bug is that the save pickup continues flashing.

 

For making the script work, hold CAPS LOCK for 2 seconds.

 

I made the script as readable as I could; with tabs and everything. If anyone can help me, please consider doing it.

 

 

Hard stuff and seems to be totally wrong.

I pressed capslock but nothing happend

 

this shows me

 

[email protected]([email protected],4i) = Pickup.Create(1277, 3, [email protected]([email protected],4f), [email protected]([email protected],4f), [email protected]([email protected],4f))

 

that you didn't understand how to use locals as arrays

 

the available locals will be allocated by using locals as arrays

 

example

 

[email protected]([email protected],4i) = Pickup.Create(1277, 3, [email protected]([email protected],4f), [email protected]([email protected],4f), [email protected]([email protected],4f))[email protected], [email protected], [email protected], [email protected],  will be allocated for the pickup array [email protected]([email protected],4i)[email protected], [email protected], [email protected], [email protected],  will be allocated for the x coord array [email protected]([email protected],4f)[email protected], [email protected], [email protected], [email protected],  will be allocated for the y coord array [email protected]([email protected],4f)[email protected], [email protected], [email protected], [email protected],  will be allocated for the z coord array [email protected]([email protected],4f)

 

 

 

 

I recompiled the script for better understanding and saw how sanny translate you while-true-for-to loop

at first it should destroy a non existing pickup

 

:CYOSP_31wait 0 Pickup.Destroy([email protected]([email protected],4i))//--at first it should destroy a non existing [email protected] += 1 001D:   [email protected] > [email protected] // (int) jf @CYOSP_31

 

 

then the key press check,

if nothing happens it jumps to the pickup creation

 

:CYOSP_keypress0AB0:   key_pressed 20 jf @CYOSP_create1//if nothing happens it jumps to the pickup creation wait 0 if  [email protected] > 2000 jf @CYOSP_599 Player.CanMove($PLAYER_CHAR) = False$ONMISSION = 1 if  [email protected] > 29 jf @CYOSP_306

 

 

then I added text_draw opcodes to see what happens

at the beginning:

 

while true  wait 0  for [email protected] = 0 to [email protected]          wait 0          Pickup.Destroy([email protected]([email protected],4i))                 03F0: enable_text_draw 1       045A: text_draw_1number  100.0  50.0 'NUMBER' [email protected]      end  if or      not Player.Defined($PLAYER_CHAR)                            $ONMISSION == 1  then      continue  end

 

 

and at the second pickup creation

 

     for [email protected] = 0 to [email protected]      wait 0            [email protected]([email protected],4i) = Pickup.Create(1277, 3, [email protected]([email protected],4f), [email protected]([email protected],4f), [email protected]([email protected],4f))      03F0: enable_text_draw 1       045A: text_draw_1number  200.0  50.0 'NUMBER' [email protected]  end

 

 

I saw then that your script delete and create permanently pickups

I don't know if this was your intension

 

Link to comment
Share on other sites

As ZAZ already described, your handling of the arrays is completely wrong, and cripples this mod. You can only store 32 single items, either as a seperate variable or as part of an array.

 

I recompiled the script for better understanding and saw how sanny translate you while-true-for-to loop

at first it should destroy a non existing pickup

 

:CYOSP_31wait 0 Pickup.Destroy([email protected]([email protected],4i))//--at first it should destroy a non existing [email protected] += 1 001D:   [email protected] > [email protected] // (int) jf @CYOSP_31

 

 

If you want to use a for-to loop to walk an array, you should have a variable that contains the index of the last "filled" entry, not one that contains the number of entries.

In this case [email protected] should probably have been initialized to -1, meaning that none of the entries have been been filled yet. The code inside the for-to loop will than not be executed as long as [email protected] = -1.

This code:

if	not [email protected] == 0then  [email protected] += 1end

doesn't make sense either. The increment of [email protected] should be done unconditional, and before any value is stored in the entry at index [email protected] (with the current meaning of [email protected] (=number of defined points), the increment should have been done after all data has been stored)

 

 

then the key press check,

if nothing happens it jumps to the pickup creation

 

:CYOSP_keypress0AB0:   key_pressed 20 jf @CYOSP_create1//if nothing happens it jumps to the pickup creation wait 0 if  [email protected] > 2000 jf @CYOSP_599 Player.CanMove($PLAYER_CHAR) = False$ONMISSION = 1 if  [email protected] > 29 jf @CYOSP_306

 

 

then I added text_draw opcodes to see what happens

at the beginning:

<<< cut >>>

 

I saw then that your script delete and create permanently pickups

I don't know if this was your intension

This indeed looks like the intended behavior, the overall structure is:

 

while true   Destroy all pickups   If keypressed for 2 seconds   then      add savepoint   end   Create all pickups   for all pickups      if picked up      then          savescreen      end   endforendwhile

 

But I doubt that it is wise to destroy and recreate the pickups at each iteration of the outer while-loop.

Edited by PatrickW
bS8xA.png
Link to comment
Share on other sites

Yeh, that's what I intended with the structures tounge.gif

 

You're right, my bad, I'm a n00b with using local arrays, I want all arrays with constant numbers! mad.gif

 

So could you guys please post a possible working script version? Please? smile.gif

Edited by gtasearcher
Link to comment
Share on other sites

 

Yeh, that's what I intended with the structures tounge.gif

 

You're right, my bad, I'm a n00b with using local arrays, I want all arrays with constant numbers!  mad.gif

 

So could you guys please post a possible working script version? Please? smile.gif

Again hard stuff but a nice exercise.

 

At first I saw that I don't need arrays for the coords of the pickup creation but I need arrays for the coords to put_player_actor beside the pickup after savescreen

 

The most difficult part was to replace the first pickup with the fifth and the second with the sixth and so on

because the script allows only 4 savepickups

Therefore the locals [email protected] and [email protected]

I kept the text_draw opcodes in the script to show what happens

[email protected] is the array index

[email protected] counts the created pickups and submit the value to the array index

since the 5th pickup is created, [email protected] switch into the scriptpart where [email protected] define the array index to replace the first pickup

but [email protected] still do it's job in the pickup_check_array_loop to exit the loop

 

The save script worked without 0AB3: and 0AB4: as long as the game was running

save and load the save was possible.

But after shut down the game and start it up with such a savegame caused a crash because the values of the locals nevermore exist.

Storing the values with 0AB3: and submit with 0AB4: let the script work correct.

 

Maybe Patrick will convert it into highlevel construct and maybe with an for-to loop

I for myself would need 2 more day to do it, but I'm really to lazy cool.gif

 

type SAVE to create a savepickup inclusive mapicon

 

{$CLEO .cs}:MultiSavethread 'MULTISV' 0A95: enable_thread_saving [email protected] = 0 [email protected] = -1 [email protected] = 0 [email protected] = 0 :MULTISV_1wait 0 if   Player.Defined($PLAYER_CHAR)jf @MULTISV_1 03F0: enable_text_draw 1 045A: draw_text_1number 150.0 50.0 GXT 'NUMBER' number [email protected]  // ~1~045A: draw_text_1number 200.0 50.0 GXT 'NUMBER' number [email protected]  // ~1~045A: draw_text_1number 250.0 50.0 GXT 'NUMBER' number [email protected]  // ~1~0A8D: [email protected] = read_memory 9867536 size 4 virtual_protect 0 if 04A4:   [email protected] == 1396790853 // cheat == SAVE jf @MULTISV_pickcheck1 0A8C: write_memory 9867536 size 4 value 0 virtual_protect 0 if  [email protected] == 0 jf @MULTISV_pickRecreate2 if  3 > [email protected] jf @MULTISV_pickRecreate1 [email protected] += 1 0085: [email protected] = [email protected] // (int) jump @MULTISV_pickCreate1 :[email protected] = 1 [email protected] = 0 [email protected] = 3 jump @MULTISV_pickRecreate3 :[email protected] += 1 if  [email protected] > 3 jf @MULTISV_pickRecreate3 [email protected] = 0 jump @MULTISV_pickRecreate3 :MULTISV_pickRecreate30085: [email protected] = [email protected] // (int) Marker.Disable([email protected]([email protected],4i))Pickup.Destroy([email protected]([email protected],4i)) :MULTISV_pickCreate104C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 3.0 0.0 0570: [email protected]([email protected],4i) = create_asset_radar_marker_with_icon 35 at [email protected] [email protected] [email protected] 018B: set_marker [email protected]([email protected],4i) radar_mode 2 [email protected]([email protected],4i) = Pickup.Create(1277, 3, [email protected], [email protected], [email protected])04C4: store_coords_to [email protected]([email protected],4f) [email protected]([email protected],4f) [email protected]([email protected],4f) from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 :MULTISV_pickcheck1if  [email protected] > -1 jf @MULTISV_1 [email protected] = 0 :MULTISV_pickcheck2wait 0 03F0: enable_text_draw 1 045A: draw_text_1number 150.0 150.0 GXT 'NUMBER' number [email protected]  // ~1~045A: draw_text_1number 200.0 150.0 GXT 'NUMBER' number [email protected]  // ~1~045A: draw_text_1number 250.0 150.0 GXT 'NUMBER' number [email protected]  // ~1~if 002D:   [email protected] >= [email protected] // (int) jf @MULTISV_1 if   Pickup.Picked_up([email protected]([email protected],4i))jf @MULTISV_pickcheck3 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 0AB3: var 101 = [email protected] 0AB3: var 102 = [email protected] 0AB3: var 103 = [email protected] 0AB3: var 104 = [email protected] 0AB3: var 105 = [email protected] 0AB3: var 106 = [email protected] 0AB3: var 107 = [email protected] 0AB3: var 108 = [email protected] 0AB3: var 109 = [email protected] 0AB3: var 110 = [email protected] 0AB3: var 111 = [email protected] 0AB3: var 112 = [email protected] 0AB3: var 113 = [email protected] 0AB3: var 114 = [email protected] 0AB3: var 115 = [email protected] 0AB3: var 116 = [email protected] 0AB3: var 117 = [email protected] 0AB3: var 118 = [email protected] 0AB3: var 119 = [email protected] 0AB3: var 120 = [email protected] 0AB3: var 121 = [email protected] 0AB3: var 122 = [email protected] 0AB3: var 123 = [email protected] 0AB3: var 124 = [email protected] 0AB3: var 125 = [email protected] 0AB3: var 126 = [email protected] 0AB3: var 127 = [email protected] 0AB3: var 128 = [email protected] 0AB3: var 129 = [email protected] 0AB3: var 130 = [email protected] 0AB3: var 131 = [email protected] gosub @MULTISV_sub1 wait 0 [email protected]([email protected],4i) = Pickup.Create(1277, 3, [email protected], [email protected], [email protected])jump @MULTISV_1 :[email protected] += 1 jump @MULTISV_pickcheck2 :MULTISV_sub1if  $ONMISSION == 0 jf @MULTISV_sub4 $ONMISSION = 1 Player.CanMove($PLAYER_CHAR) = Falsewait 350 03D8: show_save_screen :MULTISV_sub2if 83D9:   not save_done jf @MULTISV_sub3 wait 0 jump @MULTISV_sub2 :MULTISV_sub30AB4: [email protected] = var 101 0AB4: [email protected] = var 102 0AB4: [email protected] = var 103 0AB4: [email protected] = var 104 0AB4: [email protected] = var 105 0AB4: [email protected] = var 106 0AB4: [email protected] = var 107 0AB4: [email protected] = var 108 0AB4: [email protected] = var 109 0AB4: [email protected] = var 110 0AB4: [email protected] = var 111 0AB4: [email protected] = var 112 0AB4: [email protected] = var 113 0AB4: [email protected] = var 114 0AB4: [email protected] = var 115 0AB4: [email protected] = var 116 0AB4: [email protected] = var 117 0AB4: [email protected] = var 118 0AB4: [email protected] = var 119 0AB4: [email protected] = var 120 0AB4: [email protected] = var 121 0AB4: [email protected] = var 122 0AB4: [email protected] = var 123 0AB4: [email protected] = var 124 0AB4: [email protected] = var 125 0AB4: [email protected] = var 126 0AB4: [email protected] = var 127 0AB4: [email protected] = var 128 0AB4: [email protected] = var 129 0AB4: [email protected] = var 130 0AB4: [email protected] = var 131 Actor.PutAt($PLAYER_ACTOR, [email protected]([email protected],4f), [email protected]([email protected],4f), [email protected]([email protected],4f))Player.CanMove($PLAYER_CHAR) = True$ONMISSION = 1 wait 350 $ONMISSION = 0 :MULTISV_sub4return 

 

Link to comment
Share on other sites

 

Whoa thanks a lot ZAZ, testing it now, but would it be possible to store more than 4 savepoints?

No, there are no more locals available

Also was it not possible to store the z_angle

 

_______

edit

 

Without icons will give 4 more locals

for 5 pickups you need then also 26 locals

actually [email protected] and [email protected] is unused

 

____________

edit

 

max 6 pickups is possible without mapicon

 

[email protected]([email protected],6i) = Pickup.Create(1277, 3, [email protected], [email protected], [email protected])04C4: store_coords_to [email protected]([email protected],6f) [email protected]([email protected],6f) [email protected]([email protected],6f) from_actor $PLAYER_ACTOR with_offset 0.0 0.0 [email protected] = [email protected] = recreate pickup [email protected] = pickup [email protected] = index

 

Edited by ZAZ
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.