Difference between revisions of "0180"

From GTAMods Wiki
Jump to navigation Jump to search
m
(page updates)
Line 1: Line 1:
<code>0180=1,set_on_mission_flag_to %1d%<br></code>
+
{{Icon|trilogy}} '''DECLARE_MISSION_FLAG'''
'''Description''': Links a global variable to the onmission <span class="plainlinks">[http://en.wikipedia.org/wiki/Flag_(computing) flag]</span><br>
+
<hr />
'''Parameter 1''': A global variable<br>
+
'''Description'''
'''Supports''': GTA3, Vice City, San Andreas<br>
+
: Links a global variable to the onmission [[wikipedia:Flag field|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 and it isn't recommended to change this name to prevent incompatibilies with already released scripts using $ONMISSION 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 <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 [[thread]].
 
* [[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 [[thread]].
 
   [[0038]]:  $ONMISSION == 0
 
   [[0038]]:  $ONMISSION == 0
 
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|starts 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.
+
* 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.
 
The reason of setting the ONMISSION variable to 1 is that, the game, when it set to 1, constantly checks the player's state and if he's dead or busted, it automatically cancels the active mission (you fails the mission in that case). To cancel the mission correctly, Rockstar Games uses a specific mission structure as [[Create_a_mission#Insert your mission|covered there]]. Note that the mission body is placed in the [[0050|gosub]] subroutine. If the player is dead or busted, the game automatically makes returning for all gosubs in the mission, so the execution point returns to the next opcode after gosub @MissionBegin, which is the check [[0112|wasted_or_busted]]. This condition is true, so the script execution proceeds to the MissionFailed block.
 
The reason of setting the ONMISSION variable to 1 is that, the game, when it set to 1, constantly checks the player's state and if he's dead or busted, it automatically cancels the active mission (you fails the mission in that case). To cancel the mission correctly, Rockstar Games uses a specific mission structure as [[Create_a_mission#Insert your mission|covered there]]. Note that the mission body is placed in the [[0050|gosub]] subroutine. If the player is dead or busted, the game automatically makes returning for all gosubs in the mission, so the execution point returns to the next opcode after gosub @MissionBegin, which is the check [[0112|wasted_or_busted]]. This condition is true, so the script execution proceeds to the MissionFailed block.
  
 
In short, if the ONMISSION variable isn't set to 1 at the beginning of the mission, the mission couldn't be cancelled in case of player being dead or busted. Note that this only works for missions, so you can't cancel the threads in that way.
 
In short, if the ONMISSION variable isn't set to 1 at the beginning of the mission, the mission couldn't be cancelled in case of player being dead or busted. Note that this only works for missions, so you can't cancel the threads in that way.
  
==Keywords==
+
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]].
mission, flag
+
 
 +
== Keywords ==
 +
set, declare, on, mission, flag
 +
 
 +
== See also ==
 +
* [[0182]], used to declare on mission flag for individual contacts in GTA III
  
 
[[Category:OpCodes]]
 
[[Category:OpCodes]]

Revision as of 19:22, 3 February 2015

GTA III Vice City San Andreas DECLARE_MISSION_FLAG


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 thread.
 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.

The reason of setting the ONMISSION variable to 1 is that, the game, when it set to 1, constantly checks the player's state and if he's dead or busted, it automatically cancels the active mission (you fails the mission in that case). To cancel the mission correctly, Rockstar Games uses a specific mission structure as covered there. Note that the mission body is placed in the gosub subroutine. If the player is dead or busted, the game automatically makes returning for all gosubs in the mission, so the execution point returns to the next opcode after gosub @MissionBegin, which is the check wasted_or_busted. This condition is true, so the script execution proceeds to the MissionFailed block.

In short, if the ONMISSION variable isn't set to 1 at the beginning of the mission, the mission couldn't be cancelled in case of player being dead or busted. Note that this only works for missions, so you can't cancel the threads in that way.

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

  • 0182, used to declare on mission flag for individual contacts in GTA III