Difference between revisions of "0180"
Jump to navigation
Jump to search
m |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{OpCode | |
− | + | | games = {{Icon|t}} | |
− | ''' | + | | command = DECLARE_MISSION_FLAG |
− | + | | description = Links a global variable to the onmission [[wikipedia:Flag field|flag]] | |
+ | | syntax1 = 0180: set_on_mission_flag_to [''global var''] | ||
+ | | p1t = [''global var''] | ||
+ | | p1d = Global variable | ||
+ | }} | ||
− | This opcode links a global variable to the specific [[hardcoded]] flag that defines is there an active mission or not. Common name for that variable is $ONMISSION and it isn't recommended to change this name to prevent | + | This opcode links a global variable to the specific [[hardcoded]] flag that defines is there an active mission or not. Common name for that variable is <span style="color: blue;">$ONMISSION</span> in [[Sanny Builder]] and it isn't recommended to change this name to prevent incompatibilities with already released scripts using <span style="color: blue;">$ONMISSION</span> variable (Mission Builder uses <span style="color: blue;">$ON_MISSION</span> and Rockstar's original script uses <code>flag_player_on_mission</code>). |
A scripter can use the ONMISSION variable in two cases: | A scripter can use the ONMISSION variable in two cases: | ||
− | * [[00D6|Check]] if there's an active mission and do or not to do some actions. Commonly this check is placed at the beginning of a [[ | + | * [[00D6|Check]] if there's an active mission and do or not to do some actions. Commonly this check is placed at the beginning of a [[script]]. |
− | + | {{Pre|class=sb-code|1= | |
+ | [[0038]]: <span class="nv">$ONMISSION</span> == <span class="m">0</span> | ||
+ | }} | ||
The original main.scm by Rockstar Games contains these checks as well. | The original main.scm by Rockstar Games contains these checks as well. | ||
− | * Notify the game that there's a running mission. When you [[0417| | + | * Notify the game that there's a running mission. When you [[0417|start a mission]], you have to set the ONMISSION variable to 1. If you don't do this, your mission will work incorrectly. At the end of the mission you have to set the ONMISSION variable to 0. |
− | |||
− | + | : Story missions can be cancelled at any point of time if the player is dead or caught by the police. The game developers used a specific [[Create_a_mission#Insert your mission|mission structure]] to avoid the need to repeatedly check the player's state in the script. The entire mission body runs as a [[0050|subroutine]]. When the player is dead or caught by the police and the ONMISSION flag is set to 1, the game automatically [[0051|unrolls]] all active subroutines. The next command in the given mission structure to be executed is [[0112|wasted_or_busted]]. As this condition returns true, so the script continues to the MissionFailed block, and the mission ends. | |
− | + | There are some hardcoded features that depend on this variable. It can affect the behavior of [[Pickup|property pickups]] and the visibility of [[Blip|contact point blips]]. | |
− | |||
− | [[ | + | == Keywords == |
+ | set, declare, on, mission, flag | ||
+ | |||
+ | == See also == | ||
+ | * {{Icon|3}} [[0181]], used to declare on mission flag for individual contacts |
Latest revision as of 15:06, 1 July 2021
- Description
- Links a global variable to the onmission flag
- Syntax
- 0180: set_on_mission_flag_to [global var]
- Parameter
- [global var]
- Global variable
This opcode links a global variable to the specific hardcoded flag that defines is there an active mission or not. Common name for that variable is $ONMISSION in Sanny Builder and it isn't recommended to change this name to prevent incompatibilities with already released scripts using $ONMISSION variable (Mission Builder uses $ON_MISSION and Rockstar's original script uses flag_player_on_mission
).
A scripter can use the ONMISSION variable in two cases:
- Check if there's an active mission and do or not to do some actions. Commonly this check is placed at the beginning of a script.
0038: $ONMISSION == 0
The original main.scm by Rockstar Games contains these checks as well.
- Notify the game that there's a running mission. When you start a mission, you have to set the ONMISSION variable to 1. If you don't do this, your mission will work incorrectly. At the end of the mission you have to set the ONMISSION variable to 0.
- Story missions can be cancelled at any point of time if the player is dead or caught by the police. The game developers used a specific mission structure to avoid the need to repeatedly check the player's state in the script. The entire mission body runs as a subroutine. When the player is dead or caught by the police and the ONMISSION flag is set to 1, the game automatically unrolls all active subroutines. The next command in the given mission structure to be executed is wasted_or_busted. As this condition returns true, so the script continues to the MissionFailed block, and the mission ends.
There are some hardcoded features that depend on this variable. It can affect the behavior of property pickups and the visibility of contact point blips.
Keywords
set, declare, on, mission, flag
See also
- 0181, used to declare on mission flag for individual contacts