Difference between revisions of "010E"

From GTAMods Wiki
Jump to navigation Jump to search
(highlight)
 
Line 1: Line 1:
{{Icon|trilogy}} '''ALTER_WANTED_LEVEL_NO_DROP'''
+
{{OpCode
<hr />
+
| games      = {{Icon|t}}
'''Description'''
+
| command    = ALTER_WANTED_LEVEL_NO_DROP
: Sets the player's minimum [[wanted level]]
+
| description = Sets the player's minimum [[wanted level]]
'''Syntax'''
+
| syntax1    = 010E: set_player [''player handle''] minimum_wanted_level_to [''int'']
: 010E: set_player [''player handle''] minimum_wanted_level_to [''int'']
+
| p1t        = [''player handle'']
'''Parameter'''
+
| p1d        = The [[0053|handle of the player]]
: [''player handle'']
+
| p2t        = [''int'']
:: The [[0053|handle of the player]]
+
| p2d        = Wanted level, range from 0 to 6
: [''int'']
+
| native      = [[ALTER_WANTED_LEVEL_NO_DROP]]
:: Wanted level, range from 0 to 6
+
}}
'''Native analog'''
 
: [[ALTER_WANTED_LEVEL_NO_DROP]]
 
  
 
This opcode sets the player's current wanted level ranging from 0 to 6, similar to opcode [[010D]]. Unlike 010D, if placed in a loop, the wanted level will not drop below the set value but a higher wanted level can be attained.
 
This opcode sets the player's current wanted level ranging from 0 to 6, similar to opcode [[010D]]. Unlike 010D, if placed in a loop, the wanted level will not drop below the set value but a higher wanted level can be attained.
  
 
== Example ==
 
== Example ==
The following example, using Sanny Builder, will spawn a ped close to the player character. If the character is hurt but not killed, the player will attain a minimum wanted level of 3. The player can only clear its wanted level after the character is killed.
+
The following example spawns a ped close to the player. While the ped is hurt but not killed, the player will attain a minimum wanted level of 3. The player can only clear its wanted level after the ped is killed.
  
<source lang="scm">
+
{{Pre|class=sb-code|1=
// set constants
+
<span class="c1">// set constants</span>
const
+
<span class="k">const</span>
CHAR_MODEL = #BFORI
+
CHAR_MODEL = <span class="nt">#BFORI</span>  <span class="c1">// set your character model</span>
SPAWNED_CHAR = 0@
+
CHAR_HANDLE = <span class="nv">0@</span>
X_POS = 1@
+
X_POS = <span class="nv">1@</span>
Y_POS = 2@
+
Y_POS = <span class="nv">2@</span>
Z_POS = 3@
+
Z_POS = <span class="nv">3@</span>
end
+
<span class="k">end</span>
 
// load model, required to prevent unnecessary crash!
 
0247: request_model CHAR_MODEL
 
// check if model is loaded
 
repeat
 
    wait 0
 
    if
 
        0248:  model CHAR_MODEL available
 
    then
 
        break
 
    end
 
until false
 
// spawn character
 
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
 
X_POS += 4.0
 
009A: SPAWNED_CHAR = create_actor 4 CHAR_MODEL at X_POS Y_POS Z_POS
 
// attain minimum wanted level
 
while 8118:  not actor SPAWNED_CHAR dead
 
    wait 10
 
    if
 
        8184:  not actor SPAWNED_CHAR health >= 95
 
    then
 
        010E: set_player $PLAYER_CHAR minimum_wanted_level_to 3
 
    end
 
end
 
// cleanup
 
0249: release_model CHAR_MODEL
 
01C2: remove_references_to_actor CHAR_MODEL
 
</source>
 
  
==Keywords==
+
<span class="c1">// spawn character</span>
set, change, alter, player, minimum, wanted, level
+
[[0247]]: request_model CHAR_MODEL
 +
[[038B]]: load_requested_models
 +
[[00A0]]: store_actor <span class="nv">$PLAYER_ACTOR</span> position_to X_POS Y_POS Z_POS
 +
X_POS += <span class="m">4.0</span>
 +
[[009A]]: CHAR_HANDLE = create_actor <span class="m">4</span> CHAR_MODEL at X_POS Y_POS Z_POS
 +
<span class="c1">// attain minimum wanted level</span>
 +
<span class="k">while</span> <span class="k">if</span> [[0118|8118]]:  <span class="k">not</span> actor CHAR_HANDLE dead
 +
    <span class="k">wait</span> <span class="m">10</span>
 +
    <span class="k">if</span>
 +
        8184:  <span class="k">not</span> actor CHAR_HANDLE health >= <span class="m">95</span>
 +
    <span class="k">then</span>
 +
        010E: set_player <span class="nv">$PLAYER_CHAR</span> minimum_wanted_level_to <span class="m">3</span>
 +
    <span class="k">end</span>
 +
<span class="k">end</span>
 +
<span class="c1">// cleanup</span>
 +
[[0249]]: release_model CHAR_MODEL
 +
[[01C2]]: mark_actor_as_no_longer_needed CHAR_HANDLE
 +
}}
  
[[Category:OpCodes]]
+
== Keywords ==
 +
set, change, alter, player, minimum, wanted, level, no, drop

Latest revision as of 05:54, 15 April 2017

GTA III Vice City San Andreas ALTER_WANTED_LEVEL_NO_DROP


Description
Sets the player's minimum wanted level
Syntax
010E: set_player [player handle] minimum_wanted_level_to [int]
Parameter
[player handle]
The handle of the player
[int]
Wanted level, range from 0 to 6
Native analog
ALTER_WANTED_LEVEL_NO_DROP

This opcode sets the player's current wanted level ranging from 0 to 6, similar to opcode 010D. Unlike 010D, if placed in a loop, the wanted level will not drop below the set value but a higher wanted level can be attained.

Example

The following example spawns a ped close to the player. While the ped is hurt but not killed, the player will attain a minimum wanted level of 3. The player can only clear its wanted level after the ped is killed.

// set constants
const
CHAR_MODEL = #BFORI  // set your character model
CHAR_HANDLE = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
end

// spawn character
0247: request_model CHAR_MODEL
038B: load_requested_models
00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS
X_POS += 4.0
009A: CHAR_HANDLE = create_actor 4 CHAR_MODEL at X_POS Y_POS Z_POS
// attain minimum wanted level
while if 8118:   not actor CHAR_HANDLE dead
    wait 10
    if
        8184:   not actor CHAR_HANDLE health >= 95
    then
        010E: set_player $PLAYER_CHAR minimum_wanted_level_to 3
    end
end
// cleanup
0249: release_model CHAR_MODEL
01C2: mark_actor_as_no_longer_needed CHAR_HANDLE

Keywords

set, change, alter, player, minimum, wanted, level, no, drop