Difference between revisions of "03DF"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with "{{Icon|3}} {{Icon|VC}} '''FORCE_RANDOM_PED_TYPE''' <hr /> '''Description''' : Forces the ped type of on foot pedestrians '''Syntax''' : 03DF: all_random_peds [''int''] '''Para...")
 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Icon|3}} {{Icon|VC}} '''FORCE_RANDOM_PED_TYPE'''
+
{{OpCode
<hr />
+
| games      = {{Icon|3}} {{Icon|VC}}
'''Description'''
+
| command    = FORCE_RANDOM_PED_TYPE
: Forces the ped type of on foot pedestrians
+
| description = Forces the ped type of on foot pedestrians
'''Syntax'''
+
| syntax1    = 03DF: all_random_peds [''int'']
: 03DF: all_random_peds [''int'']
+
| p1t        = [''int'']
'''Parameter'''
+
| p1d        = [[Ped type]] or ''-1''
: [''int'']
+
}}
:: [[Ped type]] or -1
 
  
This opcode forces the game to only spawn on foot pedestrians of the specified ped type. The only ped types that work with this opcode are any valid gangs, emergency, and fireman. All other values either have no effect or crash the game. When used with gangs, you must [[0247|load]] the models of the appropriate [[gang]] or else the map will be devoid of on foot pedestrians. Emergency and fireman models do not need to be explicitly loaded. This opcode has no effect on drivers in cars. A value of -1 will revert the effects of this opcode. The original scripts called this opcode during rampages.
+
This opcode forces the game to only spawn on foot pedestrians of the specified ped type. The only ped types that work with this opcode are any valid gangs, emergency, and fireman. All other values either have no effect or crash the game. When used with gangs, you must [[0247|load]] the models of the appropriate [[gang]] or else the map will be devoid of on foot pedestrians. Emergency and fireman models do not need to be explicitly loaded. This opcode has no effect on drivers in cars. A value of ''-1'' reverts the effects of this opcode. The original scripts called this opcode during rampages.
  
 
== Example ==
 
== Example ==
 
The following example, for Vice City using Sanny Builder, will allow you to force the spawning of Cuban gang members after pressing the CAMERA key. The effect can be undone using the same key.
 
The following example, for Vice City using Sanny Builder, will allow you to force the spawning of Cuban gang members after pressing the CAMERA key. The effect can be undone using the same key.
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
// set constants
+
<span class="c1">// set constants</span>
const
+
<span class="k">const</span>
SET = 0@
+
FORCE_RANDOM_SET = <span class="nv">0@</span>
GANG_ID = 7  // id for Cubans
+
GANG_ID = <span class="m">7</span> <span class="c1">// id for Cubans</span>
GANG_MODELA = #CBA  // model for Cubans
+
GANG_MODELA = <span class="nt">#CBA</span> <span class="c1">// model for Cubans</span>
GANG_MODELB = #CBB  // model for Cubans
+
GANG_MODELB = <span class="nt">#CBB</span> <span class="c1">// model for Cubans</span>
end
+
<span class="k">end</span>
  
SET = false
+
FORCE_RANDOM_SET = <span class="k">false</span>
while true
+
<span class="k">while</span> <span class="k">true</span>
     wait 500
+
     <span class="k">wait</span> <span class="m">10</span>
     if
+
     <span class="k">if</span>
         00E1:  player 0 pressed_button 13  // camera key
+
         [[00E1]]:  player <span class="m">0</span> pressed_button <span class="m">13</span> <span class="c1">// camera key</span>
     then
+
     <span class="k">then</span>
         if
+
         <span class="k">while</span> [[00E1]]:  player <span class="m">0</span> pressed_button <span class="m">13</span>  <span class="c1">// camera key</span>
             SET == false
+
             <span class="k">wait</span> <span class="m">0</span>
         then
+
         <span class="k">end</span>
            SET = true
+
        [[018C]]: play_sound <span class="m">1</span> at <span class="m">0.0</span> <span class="m">0.0</span> <span class="m">0.0</span> <span class="c1">// notification sound</span>
            018C: play_sound 1 at 0.0 0.0 0.0  // notification sound
+
        <span class="k">if</span>
             // load appropriate models
+
             FORCE_RANDOM_SET == <span class="k">false</span>
             Model.Load(GANG_MODELA)
+
        <span class="k">then</span>
             Model.Load(GANG_MODELB)
+
            FORCE_RANDOM_SET = <span class="k">true</span>
             repeat
+
            <span class="c1">// load appropriate models</span>
                wait 0
+
             [[0247]]: request_model GANG_MODELA
                if and
+
             [[0247]]: request_model GANG_MODELB
                    Model.Available(GANG_MODELA)
+
             [[038B]]: load_requested_models
                    Model.Available(GANG_MODELB)
 
                then
 
                    break
 
                end
 
            until false
 
 
             03DF: all_random_peds GANG_ID
 
             03DF: all_random_peds GANG_ID
         else
+
         <span class="k">else</span>
             SET = false
+
             FORCE_RANDOM_SET = <span class="k">false</span>
            018C: play_sound 1 at 0.0 0.0 0.0  // notification sound
+
             <span class="c1">// models no longer needed</span>
             // models no longer needed
+
             [[0249]]: release_model GANG_MODELA
             Model.Destroy(GANG_MODELA)
+
             [[0249]]: release_model GANG_MODELB
             Model.Destroy(GANG_MODELB)
+
             03DF: all_random_peds -<span class="m">1</span>
             03DF: all_random_peds -1
+
         <span class="k">end</span>
         end
+
     <span class="k">end</span>
     end
+
<span class="k">end</span>
end
+
}}
</syntaxhighlight>
+
 
 +
== Keywords ==
 +
all, force, random, ped, type, peds
  
[[Category:OpCodes]]
 
 
[[Category:Code Snippets]]
 
[[Category:Code Snippets]]

Latest revision as of 05:27, 20 December 2016

GTA III Vice City FORCE_RANDOM_PED_TYPE


Description
Forces the ped type of on foot pedestrians
Syntax
03DF: all_random_peds [int]
Parameter
[int]
Ped type or -1

This opcode forces the game to only spawn on foot pedestrians of the specified ped type. The only ped types that work with this opcode are any valid gangs, emergency, and fireman. All other values either have no effect or crash the game. When used with gangs, you must load the models of the appropriate gang or else the map will be devoid of on foot pedestrians. Emergency and fireman models do not need to be explicitly loaded. This opcode has no effect on drivers in cars. A value of -1 reverts the effects of this opcode. The original scripts called this opcode during rampages.

Example

The following example, for Vice City using Sanny Builder, will allow you to force the spawning of Cuban gang members after pressing the CAMERA key. The effect can be undone using the same key.

// set constants
const
FORCE_RANDOM_SET = 0@
GANG_ID = 7  // id for Cubans
GANG_MODELA = #CBA  // model for Cubans
GANG_MODELB = #CBB  // model for Cubans
end

FORCE_RANDOM_SET = false
while true
    wait 10
    if
        00E1:   player 0 pressed_button 13  // camera key
    then
        while 00E1:   player 0 pressed_button 13  // camera key
            wait 0
        end
        018C: play_sound 1 at 0.0 0.0 0.0  // notification sound
        if
            FORCE_RANDOM_SET == false
        then
            FORCE_RANDOM_SET = true
            // load appropriate models
            0247: request_model GANG_MODELA
            0247: request_model GANG_MODELB
            038B: load_requested_models
            03DF: all_random_peds GANG_ID
        else
            FORCE_RANDOM_SET = false
            // models no longer needed
            0249: release_model GANG_MODELA
            0249: release_model GANG_MODELB
            03DF: all_random_peds -1
        end
    end
end

Keywords

all, force, random, ped, type, peds