03DF

From GTAMods Wiki
Revision as of 00:31, 28 November 2016 by Spaceeinstein (talk | contribs) (highlight)
Jump to navigation Jump to search

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