Numbers Miscellaneous

Jul 14, 2020
Numbers Miscellaneous
  • Here's a collection of notes, functional description, gotchas, etc to help with possibly the most complicated part of Halo 5 scripting: Numbers. This is only a slightly organized dump of all kinds of Number scripting info, provided in the hopes that some disorganized info provides more help than confusion. Also in hopes that we/you/anyone will get back to this effort and make Forgehub ma and pa proud.





    General Number Info(top)

    • The Number Check condition is used to trigger scripts when Scoped Numbers (Player, Team, Object) change and so are "dirtied".
    • Number Check runs the tick after the number it is checking for has been dirtied. "Dirtied" means changed to anything other than the same number, unless the Action that changed it has Dirty set to ON, which forces it to dirty anyway.
    • The Number Change, Score Change, and Spawn Order Change actions can directly use (read) numbers
    • Other actions generally can't read numbers to use as inputs like XYZ coordinates, health amounts, etc
    • The 4 scoped number categories (Player, Team, Global, Object) are the ones set/manipulated with Number Change and tested with Number Check
    • The Global and Team scope numbers are not associated with objects that spawn into the map and won't return objects using the EXTRA filter + Number Check condition
    • Number Change is used to change the Scoped Numbers (Player, Team, Global, Object) and uses the Set, Increment, Decrement, Multiply, Divide, Remainder, and Random Operations
    • The VARIABLE group in Number Change lets you specify which scoped number to change
    • Source There are 4 types of number sources that can be read from and used in the Number Change, Score Change, or Spawn Order Change actions:
      • Constants: Specify a constant value between -32,768 to 32,767
      • Numbers: Specify a Global, Player, Object, or Team scope number
      • Object Count: count the number of objects returned by mod filters
      • Game Values: scores, health, shields, rounds, score to win, etc
    Tips
    • Numbers can be written to several times by actions during the same game tick and the Number action target filters can immediately return different results, so the order is important for scripts that change and/or test numbers
    • The Remainder Operation in Number Change is a good way to have a repeating sequence of numbers like Remainder(Constant 4) gives you 0, 1, 2, 3, 0, 1, 2...
    • Single script action number toggle method to switch between 0 and 1 each time. Number Change... Object Count... add Number [include] 0 to your filter. You can toggle between any 2 consecutive numbers by adding the lower number with the Value option.


    Number Check Condition(top)


    Number Check can't filter the Players or Objects whose NumVars pass their check to get put into the EXTRA[add] mod... Mod filtering is for Actions only. This doesn't matter for Global and Team NumVars since they never populate EXTRA. It also doesn't matter for Object Numbers since the only object whose number can be NumCheck'd is THIS object.

    Number Check triggers when the 4 types of Scoped Numbers pass the condition's parameters:
    • Global Scope: 26 channels (alpha to Zulu)
    • Team Scope: 26 channels (alpha to Zulu) for each team
    • Player Scope: 26 channels (alpha to Zulu) for each player
    • Object Scope: each object (excluding players) has 1 object number

    These numbers can be compared to other scoped numbers or constants. The available comparison operations are: Equal, Not Equal, Greater Than, Greater Than Equal To, Less Than, Less Than Equal To

    The specific team can be selected or Neutral can be selected to trigger when any team's selected number channel passes the condition.


    Number Checking Player Numbers(top)


    The ONLY way to filter a single player with Number Check is to make sure that only that 1 player's NumVar passes the NumCheck! If multiple Players have their Number {channel} pass a NumCheck at the same time, ALL of them are placed into the EXTRA[add] mod list by Number Check

    This makes it a pain to READ a Player Number {channel} or Game Value... see the next section if you don't believe it!

    You MUST Make 1 (and only 1) Player's Number {channel} Pass A Number Check To READ That Player's Numbers Or Game Values!

    This is because only these Actions can read Player Number {channels} or Game Values:
    • Number Change
    • Score Change
    • Spawn Order Change

    Numbers or Game Values are only read in the CHANGE section at the bottom of these Actions by choosing

    Source=Number
    Scope=Object
    Object=ACTIVATOR
    Number=Player + Channel={channel}
    Source=Game Value
    Game Value={list}... player game values are: Score[player], Shields<3 types>, Health<3 types>, and Spawn Order
    Object=ACTIVATOR

    Only 1 object (meaning Player) can be this Object=ACTIVATOR because the only other option is Object=THIS, which is the object the script was added to!

    Plus, no further filtering options are available after Object=ACTIVATOR, so if Number Check passes along more than 1 Player to this Object=ACTIVATOR, we have no way to choose which Player gets selected!


    Notes
    • Conditions seem to all be checked to see if they need to be evaluated and only the ones that do get sent to the "Action Phase" to be evaluated and execute if the condition passes and their Actions are then run
    • For Number: Check as long as the Number being checked has changed or is marked Dirty, it will get sent to the "Action Phase" to be evaluated in the order of older script first (lowest number). Each script is fully evaluated and its actions executed before moving to the next one. This means that if a Number is Dirty but wouldn't pass a script's condition at first, but an earlier script changes that Number so that it now would pass the later script's Number: Check condition, that later script (which seems like it wouldn't trigger) does trigger and the Actions are executed.
    • Technique: We can target any players & dirty a number channel using Number Change: Force Dirty=ON, Operation=Increment, Constant=0 and next tick all the Number Checks for that player channel will activate & perform their test to see if the script should trigger



    Number Change Action(top)


    Number: Change can perform 7 mathematical operations on the 4 types of scoped numbers.
    - When selecting the VARIABLE number to change, there's a NUMBER button for choosing action target filters to choose a specific object, player, or team

    Operations
    • Set: Assign the Source to the VARIABLE, then add the Value setting
    • Increment: Add the Source to the VARIABLE's current value, then add the Value setting
    • Decrement: Subtract the Source from the VARIABLE's current value, then add the Value setting
    • Multiply: Multiply the Source with the VARIABLE's current value, then add the Value setting
    • Divide: Divide the Source by the VARIABLE's current value, then add the Value setting
    • Remainder: Divide the Source by the VARIABLE's current value but return the remainder (Note: if the number is negative, then its remainder will be negative. The sign of the divisor is ignored.)
    • Random: Assign a random number in a range to the VARIABLE
    Source Setting
    • The numbers or values used (in the Source property) for the math operation to change the VARIABLE do NOT have an action target filter option (except Object Count), so the only options are the THIS or ACTIVATOR (if available) object's number
    • Global & Team scope numbers can be directly specified under Source
    • For Source setting's Number or Game Value options, the THIS object (which the script is attached to) is the default
    • When the Message Received, Power Check, Interacted, Number Check, or Boundary Check conditions are selected, the Object setting becomes available under Source which has the ACTIVATOR options as well as the THIS option
      • ACTIVATOR can be powerful since it can return a Number or Game Value for objects/players that the script isn't attached to (remote object selection)
      • Note that players can't have scripts attached so this is the only way to read their Numbers or Game Values
    • Source: Number: Object has the Object, Player and Team scope options which lets you select a number for the THIS (or sometimes ACTIVATOR) object, so a number can be read and used for a specific object, player, or the team setting of the object (the channel option appears for player or team)
    Tips
    • The Remainder Operation in Number Change is a good way to have a repeating sequence of numbers like Remainder(Constant 4) gives you 0, 1, 2, 3, 0, 1, 2... Use Number Change Increment Constant 1 followed by Number Change Remainder 4



    What is Dirty On/Off in Number Change?(top)

    When the Dirty setting is selected, a Number Change Action will trigger any Number Check Condition listening for that number even if that time the Action doesn't change the number. If Dirty is not selected, and when the Action runs the number remains the same, it will not trigger any Condition listening for that number to change.

    An exception is the following Gotcha!: If you change a number several times in Actions that all trigger in the same Condition, only the last number change will trigger subsequent Number Check Conditions that check for that number. However, even if that last number has dirty off, the number was dirtied because of the other number changes.


    Numbers & Action Target Filtering(top)

    • Most scripting actions have action target filters so being able to filter spawned objects (and players) in different ways is very useful and numbers might be the most useful since they can be changed and mathematically manipulated
    • Global and Team numbers don't have any spawnable objects associated with them, so they can't be used within action target filters (only objects spawned on the map get returned by the filters)
    • Global and Team are readable by Number Check and Number/Score/Spawn Order Change
    • Team numbers seem to be available even when that team isn't present so those numbers can be used like global numbers, especially Teams 5-8
    • The Number mod filters don't have a channel setting, but the player {alpha} channel is the one that filters work with. This means in order to use, for example, Number[include] for players, players must have that number on the alpha channel. We cannot filter barvo-zulu player channels.
    • For objects, they only have 1 number so no channels to select.

    Number Mod Filters(top)


    • The Number [include/exclude] filters seem to only accept numbers from 0 to 64, so the other Number filters will generally be more useful
    • Number THIS/ACTIVATOR [include/exclude] filters for objects that have numbers that match the THIS or ACTIVATOR object number.
    • Order THIS/ACTIVATOR Number [include/exclude] filters for objects that have a Spawn Order that match the THIS or ACTIVATOR object number.
    • There is no filter to search for objects with a number that matches the THIS/ACTIVATOR spawn order

    Conditions With ACTIVATORS(top)


    • Message: ACTIVATOR returns either the object that was the last one to execute the message or the ACTIVATOR of the script that executed the message (user selects THIS or ACTIVATOR when the condition produces an ACTIVATOR object)
    • Power State: Same as Message
    • NOTE: Message Send/Power Set only seem to pass along an object when the THIS/ACTIVATOR option is available for certain conditions. The THIS object is not sent by default. If you want an object to send a message without having to use Boundary Check or Interacted, try using Power=ON and have the object check for Power=ON and then have it use Power=OFF and send THIS with it.
    • NOTE: The 1st Message Send or Power Set in a series that starts with Message/Power does not send THIS/ACTIVATOR with it, but later ones do.
    • Interacted: ACTIVATOR returns the player that interacted with the switch or power up
    • Boundary Check: ACTIVATOR returns the object only when it enters or exits the boundary (no longer continuously returns objects inside a Continuous Boundary), EXTRA returns all the qualifying objects (based on the Filter and object's Team settings) within the boundary. Both ACTIVATOR & EXTRA seem accessible as ACTIVATOR in actions that let us get number or game value info from objects.
    • Number Check: EXTRA returns the object (or players) that passed the check requirement (which is a good way to filter a player)
    • Number Check does not have an ACTIVATOR object, but the Object setting with the ACTIVATOR option does appear when Number/Object or Game Value is selected for the Source property, and ACTIVATOR represents the EXTRA object for this case (this is how to get player/object scope numbers, health, shields, scores, etc)



    Game Values(top)


    Can only retrieve Game Values for the THIS object or the ACTIVATOR object (when available).

    • Team (score): the score of the THIS or ACTIVATOR object
    • Player (score): the score of the player, but only for ACTIVATOR
    • Health (current), Health (max), Health (ratio)
    • Shields (current), Shields (max), Sheilds (ratio)
    • Players (current): total count of players in the game (spectators?)
    • Players: Team (current): count of players on the THIS or ACTIVATOR object's team (Neutral returns 0)
    • Teams (current): count of teams that have been in the game (in Forge it counts the teams you can see scores for)
    • Spawn: Order
    • Rounds (max)
    • Score To Win



    Accessing Player Game Values (Health, Shields, Score)(top)


    Reading player numbers for any channel can be done in the Number Change, Score Change, and Spawn Order Change actions.

    Game Values can only be retrieved with the THIS or ACTIVATOR objects. Can't add scripts to players so they can never be THIS.

    But one secret is that even though the Number Check "help" text says that EXTRA gets you the object/player whose number changed, for Game Values (and for Object Numbers) we can choose Object=ACTIVATOR to get the object/player's Game Values.

    Since only 1 player's number can be read at a time + we don't control which player is selected as Object=ACTIVATOR, to read a specific player's number, we need to isolate that player by making sure they're the only one in Boundary Check's ACTIVATOR, Number Check's EXTRA, etc. The same thing applies to reading player Game Values


    Ex: Add Nav Marker To Last Man Standing
    First, make all the Team 1 players constantly have their {ALIVE} player number channel set to the number of teammates alive.

    Code:
    Timer Check 0.00 0.10
    A1: Number Change Player{ALIVE} [NUMBER] Dirty=ON Set Object Count [OBJECTS]
    [NUMBER] Team[add]: Team 1 + Players[include] + Dead[exclude]
    [OBJECTS] Team[add] Team 1 + Players[include] + Dead[exclude]
    Next Number Check for when a player number gets {ALIVE} set to 1. Use the EXTRA[add] mod filter with Number Change to select the player to edit the their {SHIELDS} number & use Object=ACTIVATOR under Game Value to access the player's current shields value.

    Code:
    Number Check Player{ALIVE} Equals Constant 1
    A1: Number Change Player{SHIELDS} (EXTRA[add]) Dirty=ON Set Game Value=Shields[ratio] Object=ACTIVATOR
    Since the {SHIELDS} player number only gets updated for the Last Man Standing, you can react to that with Number Check. It should get updated every 0.10 seconds while there's a LMS so A3-A4 happen once there's not a LMS.

    Code:
    Number Check Player {SHIELDS} Less Than Constant {75}?
    A1: Nav Marker Change (Players[add]) Add (EXTRA[add]) ...
    A2: Wait 0.20
    A3: Nav Marker Change (Players[add]) Remove (EXTRA[add])
    A4: ... whatever else is needed...
    Condition Interrupt=ON


    Object Scope Numbers(top)


    Object Numbers can be easily used with the Number mods, which makes them very useful and powerful

    Amount of Number Variables and Channels
    • There is only 1 Number Variable per forge object
    • There are no channel names for them (alpha-barvo)
    • The Total amount of Object Numbers = amount of objects!
    • Players and Teams do not have an Object Number
    • Number Check can only check an object's number if the script is added to that object, i.e. we can't use Number Check from an object's script to remotely check another object's number

    Reading Object Numbers(top)

    • Object Number changes can only be heard/triggered by Number Check: Scope=Object scripts on that object itself
    • Number Check Scripts with Always Runs=OFF when object is despawned are never heard/triggered

    Object Number Mods(top)

    • Number mods always work with each object's one and only Number Variable... this is incredibly useful!
    • Number Check does populate the EXTRA[add] mod... but that's always the same as the THIS mod... this is pretty much useless!
    • The object's NumVar works with the Number THIS[inc/exc] and Order THIS Number[inc/exc] mods, which are always available
    • So an object's NumVar can be set and then the object's action mods can include/exclude other players and/or objects based on matching either their Number OR Spawn Order!
    • NOTE: There's no Number THIS Order[inc/exc] mods, so we can't filter other objects by comparing their Numbers to the script owner's Spawn Order (basically, an object's Number is more useful than its Spawn Order)

    Object Number Gotchas(top)

    • When objects are despawned, you can't change their number (likely because action target filters generally don't return objects that aren't on the map)
    • Number Check scripts for the object number will trigger while the object is despawned, usually on the game tick after the object is despawned
    • Message, Power, Multi, and Global/Player/Team Number Check scripts will be triggered while an object is despawned, assuming Always Run is ON (Note: Team Number Checks don't seem to trigger if the script owner is despawned)
    • Object numbers are saved while the object is despawned, so when it's respawned the number will be the same as before
    • Object numbers are saved between rounds
    • Most, if not all, properties that are set in the Properties Window are reset to their original values when the object is respawned
    • An object's Number is available for reading and writing after calling Spawn, but Despawn makes it inaccessible again. This works even during the same game tick.
    • Basically, for a despawned object, you can call Spawn, use its Number, and then call Despawn during the same game tick and the object won't spawn or trigger its Spawned condition, but the Despawned condition will trigger



    Player Scope Numbers(top)


    Player Numbers are the most unique type of Numbers. They're powerful but a bit harder to use. Player {alpha} is the only Number Variable that can use every Number function. Player Numbers can trigger Number Check while players are on the map, alive or in the dying animation.


    Amount of Number Variables and Channels

    • 26 Player Number Channels, {alpha} thru {zulu}
    • There's an instance of every {channel} for every player, so up to 416 (26 channels x 16 players) unique Player Number Variables
    • For each player, there's 1 instance/variable for each {channel}, 26 NumVars per player
    • For Number Check, there's no way to select specific players, so each {channel} is effectively shared for all players, meaning that a from Number Check's view, each Player {channel} can have up to 16 unique values at a time
    • For Number[inc/exc] mods, there's 1 NumVar for each player, the {alpha} channel, so up to 16 filterable player NumVars

    Reading Player Numbers(top)


    Reading player numbers for any channel can be done in the Number Change, Score Change, and Spawn Order Change actions. These options must be used: Source=Number, Scope=Object, Object=ACTIVATOR, Number=Player and finally pick a specific channel. Since Object=ACTIVATOR, the only options (conditions) that make players available as this ACTIVATOR are Boundary Check + Number Check (EXTRA qualifies as this ACTIVATOR, undocumented )

    Since only 1 player's number can be read at a time + we don't control which player is selected as Object=ACTIVATOR, to read a specific player's number, we need to isolate that player by making sure they're the only one in Boundary Check's ACTIVATOR or Number Check's EXTRA.

    All objects can hear Player Number Checks trigger for all situations, except the usual: Number Check Scripts with Always Runs=OFF when object is despawned are never heard/triggered.

    If you use Number Check to check a player number against that same player number, for example when Player alpha 1 is equal to Player alpha 1, it compares every player to his own number and will change when that number is dirtied. "Less Than" and "Mor Than" do nothing. This is different from Team Numbers, which will compare against all other teams.


    Player Number Mods(top)


    • Each Player Number Variable is associated with 1, and only 1, player... For example, one player's {barvo} is separate from any other player's {barvo}... However, Number Check conditions can specify a {channel}, but has no setting to let us choose a player
    • Only the {alpha} channel is filterable with the Number mods... the Number[inc/exc] mods have no way to choose a {channel}
    • Number Check populates the EXTRA[add] mod with all players whose NumChan passed the test

    Player Numbers and Game Values(top)

    (the difficult/annoying part)

    • The Number Change action can change multiple Player Numbers
    • Number Change, Score Change, and Spawn Order Change actions are able to read only 1 Player Number or Game Value
    • The script's condition must populate the ACTIVATOR or EXTRA mods so that the Object setting becomes available, allowing ACTIVATOR (1 player) to be chosen instead of THIS (object with the script)
    • Interacted, Message Received, Power Check, Number Check, and Boundary Check make Object=ACTIVATOR available
    • Boundary Check's ACTIVATOR mod is used for Object=ACTIVATOR, the EXTRA mod is not
    • Message Received and Power Check simply pass along the ACTIVATOR (player) passed to them... They can't make the player available as ACTIVATOR on their own

    Learn more in the Accessing Player Game Values section.


    Player ID Mechanisms(top)


    Assigning players IDs might not be necessary for many cases as we can easily select players with EXTRA[add] after dirtying any player number.

    2-Script Increasing Number Player ID Assigner
    General Explanation
    The Brain's # is the next ID assigned. This uses Force Dirty on a player's {alpha} # (which is 0) to activate Script 1's Number Check: Player {alpha} = 0 condition. When there are no players with ID still 0, Script 1 doesn't trigger.

    Script 2 initializes THIS Brain's # to 1, which will be used for the first ID. Every second, it also checks if any players don't have an ID yet ({alpha} = 0), which starts the process of assigning a player ID. It marks any 1 player's {alpha} # that's 0 as dirty to trigger Script 1.

    Script 1 does the assignment with THIS Brain's current #, increments that #, and then checks if any players still don't have an ID, which creates a loop that assigns one player ID each game tick until there are no players without an ID.

    Script 1 Description
    When Player {alpha} changes to = 0 (or set dirty)
    A1: Change 1 player's (with ID still 0) {alpha} # to THIS Brain's #
    A2: Increment THIS Brain's # by 1
    A3: Mark 1 player's (with ID still 0) {alpha} # as dirty, but don't change it

    Script 2 Description
    Every 1.00 second (Use whatever timings you need)
    A1: Mark 1 player's (with ID still 0) {alpha} # as dirty, but don't change it
    A2: Initialize THIS Brain's # to 1 if its number is 0

    Script 1

    Code:
    Number Check: Player {alpha} = 0
    A1: Number Change: Player [NUMBER] {alpha} = THIS Number
    [NUMBER] Players [add], Number [include] 0, First 1
    A2: Number Change: Object [THIS] Increment 1
    A3: Number Change: Player [NUMBER] {alpha} Increment Force Dirty 0
    [NUMBER] Players [add], Number [include] 0, First 1
    Script 2

    Code:
    Timer Check: 1.00 1.00
    A1: Number Change: Player [NUMBER] {alpha} Increment Force Dirty 0
    [NUMBER] Players [add], Number [include] 0, First 1
    A2: Number Change: Object [NUMBER] Set 1
    [NUMBER] THIS [add], Number [include] 0

    More Information on EXTRA and ACTIVATOR(top)


    Check the discord Player Tracking etc channel for the most current info
    • When using Number Check's EXTRA mods & Number/Score/Spawn-Order Change's Object=ACTIVATOR with player numbers, they return all players whose number changed in one clump
    • The EXTRA mods give us all players in one chunk and Object=ACTIVATOR only returns one player number, so using Number Change Set to assign Object=ACTIVATOR to EXTRA [add] won't copy the players' numbers individually, they all just get one random player's number
    • Number Check triggers when a player is dead, but the EXTRA mods and Object=ACTIVATOR don't give you the player, even if you Wait until they respawn... the EXTRA/ACTIVATOR references are always invalid
    • Numbers can be assigned or changed for dead players and that will trigger Number Check
    • EXTRA and ACTIVATOR don't seem to work once a players body is gone... the action target mods generally need objects/players on the map (dead or alive) to work (verified when using Number Check, need to test when using Boundary Check and Message Send/Power Set)



    Team Scope Numbers(top)


    Team Numbers largely work the same way as Global, but there are many more available to be used

    Amount of Number Variables and Channels
    • 26 Team Number Channels, {alpha} thru {zulu}
    • 8 Teams = 8 instances of each {channel}, 1 for each Team
    • Only 1 instance of a {channel} for each Team. For example, there's (1) Number Variable for Team 3 {zulu}, (1) Team 6 {barvo}, etc
    • Total of 208 unique Number Variables, which are available to use even when the Team is not present
    • NOTE: 1 object on the map must have its Team set to a specific Team to make that team's 26 NumVars usable

    Reading Team Numbers(top)

    • All objects can hear it for most situations
    • Number Check Scripts with Always Runs=OFF when object is despawned are never heard/triggered
    • For some reason, despawned objects will not hear/trigger Number Check conditions for Team Numbers
    • Number Check condition has a Team=Neutral option that functions 2 ways
    • If the object has Team property set to Neutral, NumChk Team=Neutral triggers for any Team when that channel is dirtied
    • If the object has Team property set to a specific team, NumChk Team=Neutral triggers for only for that Team's NumChan

    Team Number Mods(top)

    • Not associated with any objects
    • Not filterable with any Number mods
    • Number Check does not populate the EXTRA[add] mod for Team Numbers

    Team Numbers Gotchas(top)

    • Team Numbers for teams that aren't in the game still seem to work, but be sure to have an object spawned on the map set to that team to use action targeting mods like Team [add] Team 6
    • An object set to Team Neutral with a Number Check script set to check Team=Neutral totally responds when any team's number for the specified channel is dirty...
    • ...But an object set to a specific Team has its Number Check Team=Neutral scripts only check for its Team's number
    • When using Number Check for Team Numbers, the EXTRA [add] mod does NOT add any objects to the target list :(
    • There doesn't seem to be any way to specify a team number channel using only mod filters when a Team Number change triggers Number Check
    • Despawned objects seem to ignore Number Checks for Team Numbers. Setting the team to Neutral didn't work. Setting the despawned object to the same team didn't work. So we can't use Team Numbers to signal objects to spawn themselves.



    Global Scope Numbers(top)


    There's a single set of 26 Global Number {channels} for the entire map, available to all objects/scripts. They are useful as broadcasts (AKA script-controlled events) and for sharing numeric info.

    Amount of Number Variables and Channels
    • 26 map-wide Global Number Channels, {alpha} thru {zulu}
    • Only 1 instance/variable of each {channel}

    Reading Global Numbers(top)

    • All objects can hear it for all situations, except:
    • Number Check Scripts with Always Runs=OFF when an object is despawned are never heard/triggered

    Global Number Mods(top)

    • Not associated with any objects
    • Not filterable with any Number mods
    • Number Check does not populate the EXTRA[add] mod for Global Numbers



    This might be the most advanced scripting happening of all(top)


    When a Number is changed or dirtied, or Force Dirty is on (dirtied even if it changes to the same number it already was), it triggers a Number Check for each script that includes that number. Each Number Check uses the number's *current* value, and that can change during the game tick.

    So it depends on what order the scripts run (which secret slot number the script occupies).

    If scripts with number slots 5, 6, and 7 each have a Number Check for constant values 5, 6, and 7... And script 5 changes the NumVar to 6, them script 6 changes the NumVar to 7... They all run within 1 game tick.

    Number Checks Run In 1 Tick: 5-6-7
    Map Script Slot 5
    Number Check: NumVar = 5
    A1) Number Change: NumVar Set 6

    Map Script Slot 6
    Number Check: NumVar = 6
    A1) Number Change: NumVar Set 7

    Map Script Slot 7
    Number Check: NumVar = 7
    A1) ...

    But if it's reversed cuz script 7 changes the NumVar to 6, then script 6 changes it to 5... The scripts execute 7 on one tick, 6 on the next, and then script 5.

    Number Checks Run In 3 Ticks: 7...6...5
    Map Script Slot 5
    Number Check: NumVar = 5
    A1) ...

    Map Script Slot 6
    Number Check: NumVar = 6
    A1) Number Change: NumVar Set 5

    Map Script Slot 7
    Number Check: NumVar = 7
    A1) Number Change: NumVar Set 6



    Number Gotchas(top)


    • If you change a number several times in Actions that all trigger in the same Condition, only the last number change will trigger subsequent Number Check Conditions that check for that number.
    • Be careful: even if that last number has dirty off, the number was dirtied because of the other number changes.
    • If the Number Change Decrement is done inside one of the Number Check scripts of the same NumVar then it'll change it before later scripts can check the NumVar's original value So if the value was changed to 0 last tick, all Number Checks looking for 0 will trigger up until the one that decrements it, then the rest see -1 as the value If multiple Number Check scripts (like > 0) decrement the NumVar, then it's possible to skip over specific number values
    • Comparison Number Checks such as those using Greater Than/Less Than may not work if one of the numbers being compared hasn't had a number change yet
    • Actions generally can't read numbers to use as inputs like XYZ coordinates, health amounts, etc
    • Object scope Number Check conditions can only be triggered for scripts that belong to the object whose number changes
    • Numbers can be written to several times by actions during the same game tick and the Number action target filters can immediately return different results, so the order is important for scripts that change and/or test numbers
    • Conditions seem to all be checked to see if they need to be evaluated and only the ones that do get sent to the "Action Phase" to be evaluated and execute if the condition passes and their Actions are then run
    • For Number: Check as long as the Number being checked has changed or is marked Dirty, it will get sent to the "Action Phase" to be evaluated in the order of older script first (lowest number). Each script is fully evaluated and its actions executed before moving to the next one. This means that if a Number is Dirty but wouldn't pass a script's condition at first, but an earlier script changes that Number so that it now would pass the later script's Number: Check condition, that later script (which seems like it wouldn't trigger) does trigger and the Actions are executed.
    • Global and Team numbers don't have any spawnable objects associated with them, so they can't be used within action target filters (only objects spawned on the map get returned by the filters)
    • The Number mod filters don't have a channel setting, so the player {alpha} channel is the one that filters work with (objects only have 1 number so no channels to select)
    • The Number [include/exclude] filters seem to only accept numbers from 0 to 64, so the other Number filters will generally be more useful
    • Boundary Check: ACTIVATOR returns the object only when it enters or exits the boundary (no longer continuously returns objects inside a Continuous Boundary), EXTRA returns all the qualifying objects (based on the Filter and object's Team settings) within the boundary
    • Number Check does not have an ACTIVATOR object, but the Object setting with the ACTIVATOR option does appear when Number/Object or Game Value is selected for the Source property, and ACTIVATOR represents the EXTRA object for this case (this is how to get player/object scope numbers, health, shields, scores, etc)
    • When objects are despawned, you can't change their number (likely because action target filters don't return despawned objects)
    • Number Check scripts for the object number won't trigger when despawned, unless the number is compared to another number that has changed
    • Object numbers are saved while the object is despawned, so when it's respawned the number will be the same as before
    • Object numbers are saved between rounds
    • Most, if not all, properties that are set in the Properties Window are reset to their original values when the object is respawned
    • An object's Number is available for reading and writing after calling Spawn, but Despawn makes it inaccessible again. This works even during the same game tick.
    • Player Numbers can trigger Number Check while players are on the map, alive or dead
    • Despawned objects seem to ignore Number Checks for Team Numbers. Setting the team to Neutral didn't work. Setting the despawned object to the same team didn't work. So we can't use Team Numbers to signal objects to spawn themselves.
    • Team Numbers for teams that aren't in the game still seem to work in general, so there's plenty of global-like numbers available in those (be sure to have an object spawned on the map set to that team if you specify the team with action targeting - like Team [add] Team 6)
Yumudas Beegbut likes this.