Difference between revisions of "Clothes pickup"

From GTAMods Wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
This is a code snippet for a clothes pickup in [[Sanny Builder]]'s format for [[Vice City]]. This code is based on the clothes pickups in Vice City. Even the "no fall off bike" glitch works.
+
This is a code snippet of a '''clothes pickup''' in [[Sanny Builder]]'s format for [[Vice City]]. This code is based on the clothes pickup script in Vice City. Even the "no fall off bike" glitch works.
<source lang="scm" line>
+
{{Pre|class=sb-code|1=
:CLOTHES
+
<span class="k">const</span>
03A4: name_thread 'CLOTHES'
+
PICKUP_PICKED_UP = <span class="nv">0@</span>
055B: 0@ = create_clothes_pickup 13 at 0.0 0.0 0.0 // set your pickup location
+
CLOTHES_1 = <span class="nv">1@</span>
 +
CLOTHES_1_TYPE = <span class="m">13</span>  <span class="c1">// set your clothing, see list of clothing at [[055B]]</span>
 +
CLOTHES_1_X = <span class="m">0.0</span>  <span class="c1">// set your x position</span>
 +
CLOTHES_1_Y = <span class="m">0.0</span>  <span class="c1">// set your y position</span>
 +
CLOTHES_1_Z = <span class="m">0.0</span>  <span class="c1">// set your z position</span>
 +
<span class="k">end</span>
  
:CLOTHES_34
+
<span class="c1">// create pickup</span>
0001: wait 0 ms
+
[[055B]]: CLOTHES_1 = create_clothes_pickup CLOTHES_1_TYPE at CLOTHES_1_X CLOTHES_1_Y CLOTHES_1_Z
00D6: if
 
0038:  $1180 == 0
 
004D: jump_if_false @CLOTHES_34
 
00D6: if
 
0214:  pickup 0@ picked_up
 
004D: jump_if_false @CLOTHES_115
 
0050: gosub @CLOTHES_122
 
00D6: if
 
0256:  player $PLAYER_CHAR defined
 
004D: jump_if_false @CLOTHES_108
 
0352: set_actor $PLAYER_ACTOR skin_to 'PLAYER' // set your character, see list of special actors (023C)
 
  
:CLOTHES_108
+
<span class="k">while</span> <span class="k">true</span>
0050: gosub @CLOTHES_244
+
    <span class="k">wait</span> <span class="m">0</span> ms
 +
    <span class="k">if</span>
 +
        PICKUP_PICKED_UP == <span class="m">0</span>
 +
    <span class="k">then</span>
 +
        <span class="k">if</span>
 +
            0214:   pickup CLOTHES_1 picked_up
 +
        <span class="k">then</span>
 +
            <span class="k">gosub</span> <span class="nl">@CLOTHES_FADE_OUT</span>
 +
            <span class="k">if</span>
 +
                [[0256]]:   player <span class="nv">$PLAYER_CHAR</span> defined
 +
            <span class="k">then</span>
 +
                0352: set_actor <span class="nv">$PLAYER_ACTOR</span> skin_to <span class="s1">'PLAYER'</span> <span class="c1">// set your character, see list of special characters at [[023C]]</span>
 +
            <span class="k">end</span>
 +
            <span class="k">gosub</span> <span class="nl">@CLOTHES_FADE_IN</span>
 +
        <span class="k">end</span>
 +
    <span class="k">end</span>
 +
<span class="k">end</span>
  
:CLOTHES_115
+
<span class="nl">:CLOTHES_FADE_OUT</span>
{
+
PICKUP_PICKED_UP = <span class="m">1</span>
//add more pickups by copying and pasting this section, remember to make adjustments and corrections
+
<span class="k">if</span>
00D6: if  
+
    [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
0214pickup 1@ picked_up // change pickup handle
+
<span class="k">then</span>
004D: jump_if_false @Second_Pickup_End // change jump-to-skip
+
    [[0169]]: set_fade_color <span class="m">0</span> <span class="m">0</span> <span class="m">1</span>
0050: gosub @CLOTHES_122
+
    <span class="k">fade</span> <span class="m">0</span> <span class="m">500</span> ms
00D6: if  
+
    <span class="k">while</span> <span class="k">if</span> [[016B]]<span class="k">fading</span>
0256:  player $PLAYER_CHAR defined  
+
        <span class="k">wait</span> <span class="m">0</span> ms
004D: jump_if_false @Second_Pickup_Gosub // change jump-to-gosub
+
    <span class="k">end</span>
0352: set_actor $PLAYER_ACTOR skin_to 'PLAYER' // set your character, see list of special actors (023C)
+
<span class="k">else</span>
 +
    PICKUP_PICKED_UP = <span class="m">0</span>
 +
<span class="k">end</span>
 +
<span class="k">if</span>
 +
    [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
 +
<span class="k">then</span>
 +
    03BF: set_player <span class="nv">$PLAYER_CHAR</span> ignored_by_everyone_to <span class="m">1</span>
 +
    [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> can_move <span class="m">0</span>
 +
<span class="k">else</span>
 +
    PICKUP_PICKED_UP = <span class="m">0</span>
 +
<span class="k">end</span>
 +
<span class="k">return</span>
  
:Second_Pickup_Gosub // change jump-to-gosub label
+
<span class="nl">:CLOTHES_FADE_IN</span>
0050: gosub @CLOTHES_244
+
<span class="k">if</span>
 
+
    [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
:Second_Pickup_End // change jump-to-skip label
+
<span class="k">then</span>
}
+
    [[038B]]: load_requested_models
0002: jump @CLOTHES_34
+
    <span class="k">if</span>
 
+
        [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
:CLOTHES_122
+
    <span class="k">then</span>
0004: $1180 = 1
+
        0353: refresh_actor <span class="nv">$PLAYER_ACTOR</span>
00D6: if  
+
    <span class="k">end</span>
0256:  player $PLAYER_CHAR defined
+
    03BF: set_player <span class="nv">$PLAYER_CHAR</span> ignored_by_everyone_to <span class="m">0</span>
004D: jump_if_false @CLOTHES_191
+
    <span class="k">if</span>
0169: set_fade_color 0 0 1
+
        [[010F|810F]]<span class="k">not</span> player <span class="nv">$PLAYER_CHAR</span> wanted_level &gt; <span class="m">2</span>
016A: fade 0 500 ms
+
    <span class="k">then</span>
 
+
        [[0110]]: clear_player <span class="nv">$PLAYER_CHAR</span> wanted_level
:CLOTHES_160
+
    <span class="k">end</span>
00D6: if
+
    [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> can_move <span class="m">1</span>
016B:  fading
+
    PICKUP_PICKED_UP = <span class="m">0</span>
004D: jump_if_false @CLOTHES_184
+
    <span class="k">fade</span> <span class="m">1</span> <span class="m">500</span> ms
0001: wait 0 ms
+
    [[03E5]]: text_box <span class="s1">'CLOHELP'</span> <span class="c1">// Clean Clothes!!</span>
0002: jump @CLOTHES_160
+
<span class="k">else</span>
 
+
    PICKUP_PICKED_UP = <span class="m">0</span>
:CLOTHES_184
+
<span class="k">end</span>
0002: jump @CLOTHES_198
+
<span class="k">return</span>
 
+
}}
:CLOTHES_191
+
If you want to add this code into the [[main.scm]], read the tutorial on [[Create a script|how to create a script]]. See [[023C]] for a list of available special characters. To use clothing type 13, open the [[GXT]] file and search for <code>OUTFT13</code> to edit the text of the clothing pickup.
0004: $1180 = 0
 
 
 
:CLOTHES_198
 
00D6: if
 
0256:  player $PLAYER_CHAR defined  
 
004D: jump_if_false @CLOTHES_235
 
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1
 
01B4: set_player $PLAYER_CHAR frozen_state 0
 
0002: jump @CLOTHES_242
 
 
 
:CLOTHES_235
 
0004: $1180 = 0
 
 
 
:CLOTHES_242
 
0051: return
 
 
 
:CLOTHES_244
 
00D6: if
 
0256:  player $PLAYER_CHAR defined
 
004D: jump_if_false @CLOTHES_351
 
038B: load_requested_models  
 
00D6: if  
 
0256:  player $PLAYER_CHAR defined  
 
004D: jump_if_false @CLOTHES_283
 
0353: refresh_actor $PLAYER_ACTOR  
 
 
 
:CLOTHES_283
 
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0  
 
00D6: if  
 
810F:  not player $PLAYER_CHAR wanted_level > 2  
 
004D: jump_if_false @CLOTHES_313
 
0110: clear_player $PLAYER_CHAR wanted_level  
 
 
 
:CLOTHES_313
 
01B4: set_player $PLAYER_CHAR frozen_state 1  
 
0004: $1180 = 0
 
016A: fade 1 500 ms  
 
03E5: text_box 'CLOHELP'  // Clean Clothes!!
 
0002: jump @CLOTHES_358
 
 
 
:CLOTHES_351
 
0004: $1180 = 0
 
 
 
:CLOTHES_358
 
0051: return
 
</source>
 
Look [[023C#Vice City|here]] for a list of available characters. Open the [[GXT]] file and search for <code>OUTFT13</code> to edit the name of the clothing pickup.
 
  
 
[[Category:Code Snippets]]
 
[[Category:Code Snippets]]

Latest revision as of 18:01, 2 June 2017

This is a code snippet of a clothes pickup in Sanny Builder's format for Vice City. This code is based on the clothes pickup script in Vice City. Even the "no fall off bike" glitch works.

const
PICKUP_PICKED_UP = 0@
CLOTHES_1 = 1@
CLOTHES_1_TYPE = 13  // set your clothing, see list of clothing at 055B
CLOTHES_1_X = 0.0  // set your x position
CLOTHES_1_Y = 0.0  // set your y position
CLOTHES_1_Z = 0.0  // set your z position
end

// create pickup
055B: CLOTHES_1 = create_clothes_pickup CLOTHES_1_TYPE at CLOTHES_1_X CLOTHES_1_Y CLOTHES_1_Z

while true
    wait 0 ms
    if
        PICKUP_PICKED_UP == 0
    then
        if
            0214:   pickup CLOTHES_1 picked_up
        then
            gosub @CLOTHES_FADE_OUT
            if
                0256:   player $PLAYER_CHAR defined
            then
                0352: set_actor $PLAYER_ACTOR skin_to 'PLAYER' // set your character, see list of special characters at 023C
            end
            gosub @CLOTHES_FADE_IN
        end
    end
end

:CLOTHES_FADE_OUT
PICKUP_PICKED_UP = 1
if
    0256:   player $PLAYER_CHAR defined
then
    0169: set_fade_color 0 0 1
    fade 0 500 ms
    while if 016B:   fading
        wait 0 ms
    end
else
    PICKUP_PICKED_UP = 0
end
if
    0256:   player $PLAYER_CHAR defined
then
    03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1
    01B4: set_player $PLAYER_CHAR can_move 0 
else
    PICKUP_PICKED_UP = 0
end
return

:CLOTHES_FADE_IN
if
    0256:   player $PLAYER_CHAR defined
then
    038B: load_requested_models
    if
        0256:   player $PLAYER_CHAR defined
    then
        0353: refresh_actor $PLAYER_ACTOR
    end
    03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0
    if
        810F:   not player $PLAYER_CHAR wanted_level > 2
    then
        0110: clear_player $PLAYER_CHAR wanted_level
    end
    01B4: set_player $PLAYER_CHAR can_move 1 
    PICKUP_PICKED_UP = 0
    fade 1 500 ms
    03E5: text_box 'CLOHELP'  // Clean Clothes!!
else
    PICKUP_PICKED_UP = 0
end
return

If you want to add this code into the main.scm, read the tutorial on how to create a script. See 023C for a list of available special characters. To use clothing type 13, open the GXT file and search for OUTFT13 to edit the text of the clothing pickup.