Difference between revisions of "Save pickup"

From GTAMods Wiki
Jump to navigation Jump to search
(rewritten)
m
 
Line 62: Line 62:
 
<span class="nl">:SAVE_BEGIN</span>
 
<span class="nl">:SAVE_BEGIN</span>
 
<span class="nv">$ONMISSION</span> = <span class="m">1</span>
 
<span class="nv">$ONMISSION</span> = <span class="m">1</span>
[[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> frozen_state <span class="m">0</span>
+
[[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> can_move <span class="m">0</span>
 
03D8: show_save_screen
 
03D8: show_save_screen
 
<span class="k">wait</span> <span class="m">0</span>
 
<span class="k">wait</span> <span class="m">0</span>
Line 74: Line 74:
 
<span class="k">then</span>
 
<span class="k">then</span>
 
     0222: set_player <span class="nv">$PLAYER_CHAR</span> health_to <span class="m">200</span>
 
     0222: set_player <span class="nv">$PLAYER_CHAR</span> health_to <span class="m">200</span>
     [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> frozen_state <span class="m">0</span>
+
     [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> can_move <span class="m">0</span>
 
<span class="k">end</span>
 
<span class="k">end</span>
 
<span class="k">return</span>
 
<span class="k">return</span>
Line 89: Line 89:
 
     [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
 
     [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
 
<span class="k">then</span>
 
<span class="k">then</span>
     [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> frozen_state <span class="m">1</span>
+
     [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> can_move <span class="m">1</span>
 
     <span class="nv">$ONMISSION</span> = <span class="m">0</span>
 
     <span class="nv">$ONMISSION</span> = <span class="m">0</span>
 
<span class="k">end</span>
 
<span class="k">end</span>

Latest revision as of 17:59, 2 June 2017

This is a code snippet for a save pickup in Sanny Builder's format for Vice City and San Andreas. The code is based on the save pickup script in Vice City.

const
PICKUP_1_X = 0.0  // set your pickup x position
PICKUP_1_Y = 0.0  // set your pickup y position
PICKUP_1_Z = 0.0  // set your pickup z position
SET_PLAYER_1_X = 0.0  // set your player x position
SET_PLAYER_1_Y = 0.0  // set your player y position
SET_PLAYER_1_Z = 0.0  // set your player z position
SET_PLAYER_1_ANGLE = 0.0  // set your player angle
PICKUP_1 = 0@
PICKUP_1_CREATED = 1@
end

PICKUP_1_CREATED = false
while true
    wait 250
    if
        0256:   player $PLAYER_CHAR defined
    then
        if
            03EE:   player $PLAYER_CHAR controllable
        then
            if
                $ONMISSION == 0
            then
                if
                    PICKUP_1_CREATED == false
                then
                    0213: PICKUP_1 = create_pickup #PICKUPSAVE type 3 at PICKUP_1_X PICKUP_1_Y PICKUP_1_Z
                    PICKUP_1_CREATED = true
                end
                if
                    0214:   pickup PICKUP_1 picked_up
                then
                    gosub @SAVE_BEGIN
                    if
                        0256:   player $PLAYER_CHAR defined
                    then
                        0215: destroy_pickup PICKUP_1
                        0213: PICKUP_1 = create_pickup #PICKUPSAVE type 3 at PICKUP_1_X PICKUP_1_Y PICKUP_1_Z
                        016A: fade 1 1000 ms
                        0395: clear_area 1 at SET_PLAYER_1_X SET_PLAYER_1_Y SET_PLAYER_1_Z radius 1.0
                        00A1: put_actor $PLAYER_ACTOR at SET_PLAYER_1_X SET_PLAYER_1_Y SET_PLAYER_1_Z
                        0173: set_actor $PLAYER_ACTOR z_angle_to SET_PLAYER_1_ANGLE
                    end
                    gosub @SAVE_END
                end
            else
                if
                    PICKUP_1_CREATED == true
                then
                    0215: destroy_pickup PICKUP_1
                    PICKUP_1_CREATED = false
                end
            end
        end
    end
end

:SAVE_BEGIN
$ONMISSION = 1
01B4: set_player $PLAYER_CHAR can_move 0
03D8: show_save_screen
wait 0
while if 83D9:   not save_done
    wait 0
end
0169: set_fade_color 0 0 0
016A: fade 0 1000 ms
if
    0256:   player $PLAYER_CHAR defined
then
    0222: set_player $PLAYER_CHAR health_to 200
    01B4: set_player $PLAYER_CHAR can_move 0
end
return

:SAVE_END
if
    0256:   player $PLAYER_CHAR defined
then
    02EB: restore_camera_with_jumpcut
    0373: set_camera_directly_behind_player
end
wait 500
if
    0256:   player $PLAYER_CHAR defined
then
    01B4: set_player $PLAYER_CHAR can_move 1
    $ONMISSION = 0
end
return

If you want to add this code into the main.scm, read the tutorial on how to create a script.