Difference between revisions of "0228"
Jump to navigation
Jump to search
m (→For Vice City) |
|||
Line 13: | Line 13: | ||
:: [[#Bomb types|Bomb type]] | :: [[#Bomb types|Bomb type]] | ||
− | This conditional opcode returns true if the vehicle | + | This conditional opcode returns true if the vehicle is armed with the specified type of bomb. |
}}</onlyinclude> | }}</onlyinclude> | ||
== Bomb types == | == Bomb types == | ||
{| class="wikitable" | {| class="wikitable" | ||
− | ! Type || Enum || Description | + | ! Type || [[SCM language III/VC definitions#CARBOMB|Enum]] || Description |
|- | |- | ||
| 0 || CARBOMB_NONE || No bomb | | 0 || CARBOMB_NONE || No bomb | ||
Line 34: | Line 34: | ||
== For Vice City == | == For Vice City == | ||
− | This opcode does not exist in Vice City but the | + | This opcode does not exist in Vice City but the type of the car bomb armed in a vehicle can still be retrieved. The following example, using Sanny Builder with [[CLEO]] for 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: |
<syntaxhighlight lang="scm"> | <syntaxhighlight lang="scm"> | ||
:opcode_0228 | :opcode_0228 | ||
Line 46: | Line 46: | ||
05F6: ret 0 | 05F6: ret 0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Use this line as a substitute for opcode 0228. This can be placed anywhere within the external script as a [[conditional statement]] | + | |
+ | Use this line as a substitute for opcode 0228. This can be placed anywhere within the external script as a [[conditional statement]]: | ||
<syntaxhighlight lang="scm"> | <syntaxhighlight lang="scm"> | ||
+ | // ... | ||
if | if | ||
− | 05F5: call_scm_func @opcode_0228 inputs 2 car_handle [car handle] bomb_type [int] | + | 05F5: call_scm_func @opcode_0228 inputs 2 car_handle [car handle] bomb_type [int] |
then | then | ||
− | + | // [RETURNED TRUE] | |
+ | else | ||
+ | // [RETURNED FALSE] | ||
end | end | ||
+ | // ... | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 59: | Line 64: | ||
== See also == | == See also == | ||
+ | * [[0220]], checks if the car is armed with any bomb | ||
* [[0242]], arms the car with the type of bomb | * [[0242]], arms the car with the type of bomb | ||
[[Category:OpCodes]] | [[Category:OpCodes]] | ||
[[Category:Code Snippets]] | [[Category:Code Snippets]] |
Revision as of 21:08, 26 July 2015
Description
- Checks current type of bomb armed in the vehicle
Syntax
- 0228: car [car handle] bomb_status == [int]
Parameter
- [car handle]
- The handle of the vehicle
- [int]
This conditional opcode returns true if the vehicle is armed with the specified type of bomb.
Bomb types
Type | Enum | Description |
---|---|---|
0 | CARBOMB_NONE | No bomb |
1 | CARBOMB_TIMED | Inactive timed bomb, can be obtained from garage type 2 |
2 | CARBOMB_ONIGNITION | Inactive ignition bomb, can be obtained from garage type 3 |
3 | CARBOMB_REMOTE | Remote detonation bomb, can be obtained from garage type 4 |
4 | CARBOMB_TIMEDACTIVE | Active timed bomb, activated from bomb type 1 |
5 | CARBOMB_ONIGNITIONACTIVE | Active ignition bomb, activated from bomb type 2 |
For Vice City
This opcode does not exist in Vice City but the type of the car bomb armed in a vehicle can still be retrieved. The following example, using Sanny Builder with CLEO for 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:
:opcode_0228
// 0@ - input param (car handle)
// 1@ - input param (bomb type)
05E7: 0@ = car 0@ struct
0@ += 0x1FE // car bomb offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
0@ -= 8 // subtract to reflect bomb type used in script
003B: 0@ == 1@ // check bomb type in car against input
05F6: ret 0
Use this line as a substitute for opcode 0228. This can be placed anywhere within the external script as a conditional statement:
// ...
if
05F5: call_scm_func @opcode_0228 inputs 2 car_handle [car handle] bomb_type [int]
then
// [RETURNED TRUE]
else
// [RETURNED FALSE]
end
// ...
Keywords
check, car, vehicle, bomb, status