Difference between revisions of "04A7"
m |
|||
Line 1: | Line 1: | ||
− | {{Icon|SA}} | + | {{OpCode |
− | + | | games = {{Icon|SA}} | |
− | + | | command = IS_CHAR_IN_ANY_BOAT | |
− | + | | description = Checks if the character is in a boat | |
− | + | | syntax1 = 04A7: actor [''char handle''] driving_boat | |
− | + | | p1t = [''char handle''] | |
− | + | | p1d = The handle of the character | |
− | + | | native = [[IS_CHAR_IN_ANY_BOAT]] | |
− | + | }} | |
− | |||
− | |||
− | This conditional opcode returns true if the character is in a boat, either as a driver or a passenger | + | This conditional opcode returns true if the character is in a boat, either as a driver or a passenger. By default the game will recognize the following list of vehicles as boats (for which the IS_BOAT model flag is set in the [[Handling.cfg#Model_Flag_Data|handling.cfg]] file): |
*Coastguard | *Coastguard | ||
*Dinghy | *Dinghy | ||
Line 33: | Line 31: | ||
03C0: 0@ = actor 0@ car | 03C0: 0@ = actor 0@ car | ||
05E7: 0@ = car 0@ struct | 05E7: 0@ = car 0@ struct | ||
− | 05E4: call_function_method 0x5BAA80 struct 0@ num_params 0 pop | + | 05E4: call_function_method 0x5BAA80 struct 0@ num_params 0 pop 0 store_to 0@ // get vehicle type |
− | |||
0@ == 4 // is type boat | 0@ == 4 // is type boat | ||
− | |||
− | |||
end | end | ||
05F6: ret 0 | 05F6: ret 0 | ||
Line 53: | Line 48: | ||
0@ += 0x284 // vehicle type offset | 0@ += 0x284 // vehicle type offset | ||
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0 // get value | 05E0: 0@ = read_memory 0@ size 1 virtual_protect 0 // get value | ||
− | |||
0@ == 1 // is type boat | 0@ == 1 // is type boat | ||
− | |||
− | |||
end | end | ||
05F6: ret 0 | 05F6: ret 0 | ||
Line 75: | Line 67: | ||
== Keywords == | == Keywords == | ||
− | actor, character, driving, any, boat | + | actor, character, driving, any, {{K|boat}} |
− | + | == See also == | |
− | [[ | + | * {{Icon|VC}} [[04A8]], checks if the player is in a boat |
Latest revision as of 02:49, 16 November 2016
- Description
- Checks if the character is in a boat
- Syntax
- 04A7: actor [char handle] driving_boat
- Parameter
- [char handle]
- The handle of the character
- Native analog
- IS_CHAR_IN_ANY_BOAT
This conditional opcode returns true if the character is in a boat, either as a driver or a passenger. By default the game will recognize the following list of vehicles as boats (for which the IS_BOAT model flag is set in the handling.cfg file):
- Coastguard
- Dinghy
- Jetmax
- Launch
- Marquis
- Predator
- Speeder
- Squalo
- Reefer
- Tropic
For GTA III and Vice City
This opcode does not exist in GTA III and Vice City but it is possible to check the type of vehicle a character is in. The following example, using Sanny Builder with CLEO for GTA III and Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file for Vice City:
:opcode_04A7
// 0@ - input param (char handle)
if
00DF: actor 0@ driving
then
03C0: 0@ = actor 0@ car
05E7: 0@ = car 0@ struct
05E4: call_function_method 0x5BAA80 struct 0@ num_params 0 pop 0 store_to 0@ // get vehicle type
0@ == 4 // is type boat
end
05F6: ret 0
or for GTA III:
:opcode_04A7
// 0@ - input param (char handle)
if
00DF: actor 0@ driving
then
03C0: 0@ = actor 0@ car
05E7: 0@ = car 0@ struct
0@ += 0x284 // vehicle type offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0 // get value
0@ == 1 // is type boat
end
05F6: ret 0
Use this line as a substitute for opcode 04A7. This can be placed anywhere within the external script as a conditional statement:
// ...
if
05F5: call_scm_func @opcode_04A7 inputs 1 char_handle [char handle]
then
// [RETURNED TRUE]
else
// [RETURNED FALSE]
end
// ...
Keywords
actor, character, driving, any, boat
See also
- 04A8, checks if the player is in a boat