Difference between revisions of "Clothes pickup"

From GTAMods Wiki
Jump to navigation Jump to search
(highlight)
Line 1: Line 1:
 
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.
 
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>// set constants
+
{{Pre|class=sb-code|1=
const
+
<span class="k">const</span>
PICKUP_PICKED_UP = 0@
+
PICKUP_PICKED_UP = <span class="nv">0@</span>
CLOTHES_1 = 1@
+
CLOTHES_1 = <span class="nv">1@</span>
CLOTHES_1_TYPE = 13   // choose your type of clothing
+
CLOTHES_1_TYPE = <span class="m">13</span>  <span class="c1">// set your clothing, see list of clothing at [[055B]]</span>
CLOTHES_1_X = -966.0  // x position
+
CLOTHES_1_X = <span class="m">0.0</span> <span class="c1">// set your x position</span>
CLOTHES_1_Y = -855.5 // y position
+
CLOTHES_1_Y = <span class="m">0.0</span> <span class="c1">// set your y position</span>
CLOTHES_1_Z = 15.0   // z position
+
CLOTHES_1_Z = <span class="m">0.0</span>  <span class="c1">// set your z position</span>
end
+
<span class="k">end</span>
  
// create pickup
+
<span class="c1">// create pickup</span>
055B: CLOTHES_1 = create_clothes_pickup CLOTHES_1_TYPE at CLOTHES_1_X CLOTHES_1_Y CLOTHES_1_Z
+
[[055B]]: CLOTHES_1 = create_clothes_pickup CLOTHES_1_TYPE at CLOTHES_1_X CLOTHES_1_Y CLOTHES_1_Z
  
while true
+
<span class="k">while</span> <span class="k">true</span>
     wait 0 ms
+
     <span class="k">wait</span> <span class="m">0</span> ms
     if
+
     <span class="k">if</span>
         PICKUP_PICKED_UP == 0
+
         PICKUP_PICKED_UP == <span class="m">0</span>
     then
+
     <span class="k">then</span>
         if
+
         <span class="k">if</span>
 
             0214:  pickup CLOTHES_1 picked_up
 
             0214:  pickup CLOTHES_1 picked_up
         then
+
         <span class="k">then</span>
             gosub @CLOTHES_FADE
+
             <span class="k">gosub</span> <span class="nl">@CLOTHES_FADE_OUT</span>
             if
+
             <span class="k">if</span>
                 0256:  player $PLAYER_CHAR defined
+
                 [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
             then
+
             <span class="k">then</span>
                 0352: set_actor $PLAYER_ACTOR skin_to 'CSJUGGZ' // set your character, see list of special actors (023C)
+
                 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>
             end
+
             <span class="k">end</span>
             gosub @CLOTHES_CLEAR_WANTED
+
             <span class="k">gosub</span> <span class="nl">@CLOTHES_FADE_IN</span>
         end
+
         <span class="k">end</span>
     end
+
     <span class="k">end</span>
end
+
<span class="k">end</span>
  
:CLOTHES_FADE
+
<span class="nl">:CLOTHES_FADE_OUT</span>
PICKUP_PICKED_UP = 1
+
PICKUP_PICKED_UP = <span class="m">1</span>
if
+
<span class="k">if</span>
     0256:  player $PLAYER_CHAR defined
+
     [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
then
+
<span class="k">then</span>
     0169: set_fade_color 0 0 1
+
     [[0169]]: set_fade_color <span class="m">0</span> <span class="m">0</span> <span class="m">1</span>
     fade 0 500 ms
+
     <span class="k">fade</span> <span class="m">0</span> <span class="m">500</span> ms
     while if 016B:  fading
+
     <span class="k">while</span> <span class="k">if</span> [[016B]]<span class="k">fading</span>
         wait 0 ms
+
         <span class="k">wait</span> <span class="m">0</span> ms
     end
+
     <span class="k">end</span>
else
+
<span class="k">else</span>
     PICKUP_PICKED_UP = 0
+
     PICKUP_PICKED_UP = <span class="m">0</span>
end
+
<span class="k">end</span>
if
+
<span class="k">if</span>
     0256:  player $PLAYER_CHAR defined
+
     [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
then
+
<span class="k">then</span>
     03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1
+
     03BF: set_player <span class="nv">$PLAYER_CHAR</span> ignored_by_everyone_to <span class="m">1</span>
     01B4: set_player $PLAYER_CHAR frozen_state 0  
+
     [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> frozen_state <span class="m">0</span>
else
+
<span class="k">else</span>
     PICKUP_PICKED_UP = 0
+
     PICKUP_PICKED_UP = <span class="m">0</span>
end
+
<span class="k">end</span>
return
+
<span class="k">return</span>
  
:CLOTHES_CLEAR_WANTED
+
<span class="nl">:CLOTHES_FADE_IN</span>
if
+
<span class="k">if</span>
     0256:  player $PLAYER_CHAR defined
+
     [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
then
+
<span class="k">then</span>
     038B: load_requested_models
+
     [[038B]]: load_requested_models
     if
+
     <span class="k">if</span>
         0256:  player $PLAYER_CHAR defined
+
         [[0256]]:  player <span class="nv">$PLAYER_CHAR</span> defined
     then
+
     <span class="k">then</span>
         0353: refresh_actor $PLAYER_ACTOR
+
         0353: refresh_actor <span class="nv">$PLAYER_ACTOR</span>
     end
+
     <span class="k">end</span>
     03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0
+
     03BF: set_player <span class="nv">$PLAYER_CHAR</span> ignored_by_everyone_to <span class="m">0</span>
     if
+
     <span class="k">if</span>
         810F:  not player $PLAYER_CHAR wanted_level > 2
+
         [[010F|810F]]<span class="k">not</span> player <span class="nv">$PLAYER_CHAR</span> wanted_level &gt; <span class="m">2</span>
     then
+
     <span class="k">then</span>
         0110: clear_player $PLAYER_CHAR wanted_level
+
         [[0110]]: clear_player <span class="nv">$PLAYER_CHAR</span> wanted_level
     end
+
     <span class="k">end</span>
     01B4: set_player $PLAYER_CHAR frozen_state 1  
+
     [[01B4]]: set_player <span class="nv">$PLAYER_CHAR</span> frozen_state <span class="m">1</span>
     PICKUP_PICKED_UP = 0
+
     PICKUP_PICKED_UP = <span class="m">0</span>
     fade 1 500 ms
+
     <span class="k">fade</span> <span class="m">1</span> <span class="m">500</span> ms
     03E5: text_box 'CLOHELP'  // Clean Clothes!!
+
     [[03E5]]: text_box <span class="s1">'CLOHELP'</span> <span class="c1">// Clean Clothes!!</span>
else
+
<span class="k">else</span>
     PICKUP_PICKED_UP = 0
+
     PICKUP_PICKED_UP = <span class="m">0</span>
end
+
<span class="k">end</span>
return</source>
+
<span class="k">return</span>
Look [[023C#Vice City|here]] for a list of available characters. To use clothing type 13, open the [[GXT]] file and search for <code>OUTFT13</code> to edit the text of the clothing pickup.
+
}}
 +
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.
  
 
[[Category:Code Snippets]]
 
[[Category:Code Snippets]]

Revision as of 11:37, 27 November 2016

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 frozen_state 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 frozen_state 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.