Can anyone explain how to use Number: change/check on scripts?

Discussion in 'Halo and Forge Discussion' started by ChainsawSquirel, Sep 2, 2017.

  1. ChainsawSquirel

    ChainsawSquirel Legendary

    Messages:
    55
    Likes Received:
    59
    This has been bugging me for a while. I've heard it's used as a counting system, like an and gate for counting how many inputs until an output is given which would be pretty damn useful. I know there are possibly other ways of doing that, but I nonetheless want to know how to use this. Can't find anything anywhere that explains it.
     
  2. ACTIVATE HALO

    ACTIVATE HALO Legendary

    Messages:
    166
    Likes Received:
    254
    IKR Someone should write a book on halo 5 scripting. It's so hard to learn.
     
  3. CaptainDireWolf

    CaptainDireWolf Forger of the Wild
    Staff Member Forge Critic Senior Member

    Messages:
    732
    Likes Received:
    1,323
    @Lost Pinecone and @JonesSeries are pros of this. Maybe they could help.
     
  4. ACTIVATE HALO

    ACTIVATE HALO Legendary

    Messages:
    166
    Likes Received:
    254
    T
    True
     
  5. KeeLoker

    KeeLoker Legendary
    Wiki Contributor

    Messages:
    277
    Likes Received:
    375
    I understand the basics of it but I only ever really use some of the functions of the script. If you need help on a random number generator or an increment-over-time counter I can help.
     
  6. ChainsawSquirel

    ChainsawSquirel Legendary

    Messages:
    55
    Likes Received:
    59
    if you can tell me how to use any of it that'd be great. like, what the object scope is, what constant, equal and global all are and why they have channels etc
     
    ExTerrestr1al likes this.
  7. ExTerrestr1al

    ExTerrestr1al Forerunner
    Senior Member

    Messages:
    2,387
    Likes Received:
    2,515
    Number change & check are complementary, first of all.

    You change the number based on some event, and then you are checking what that number is on another script, to force something else to happen.

    For instance, CWRF (linked below) uses the 1 script to count how many alive players are in the game, and then many other items have scripts which despawn based on when that number is over the threshold high enough to release certain vehicles for play.

    But, it can be used for much more than merely counting or based off of some value in the game.

    YOu can also use number changes/checks for the purpose of creating complex sequences for the behavior of items that you'd like to have more than two settings (On/Off). I do not know what the upper or lower limit is for a number variable, but I assume it's very high, as I've had it up to 1000 for one test.

    As an exmaple, here is a freshly recorded video of something I've been working on for a long time, the (almost) perfected, Star Trek style auto-door!

    Pre-fab for checking your number variables between 0-9.
    (uses global channel Alpha by default - change by selecting all and collectively changing channel)

    Number Change: When A happens, do B (C,D,E)
    Channel: (Which number you are changing) - For global variables, meaning they can be referenced by anything in your map, any script, there are 26 different variables you can store numbers in. That means, the game can keep track of 26 GLOBAL vars at once.

    Scope: Global, Object, etc. - means, is it a global variable or is it the number associated with an object. (Each object or player gets just one number assigned to itself. However, this can be checked by outside objects) Global again, meaning it is independent of an object, and exists everywhere.

    Operation: Set, Increment, Divide, etc. Whether you are specifying the number you want it to be (Set) or if you are changing the number based on some sort of scheme.

    Most of the time you'll use "Set" because you know what you want the number to be.

    Source: Constant - input the precise number you know you want to change it to. Number, object count, game value, are all non-constants, as in they could change at any time. Number allows you to define which number channel (for global), or from which object.

    Value: For a constant, what number are you changing/setting it to?

    Then, there are different options for each other type of operation you choose, so the above will change slightly depending on what you are using.


    Number Check: When a number is changed to meet your condition, do (Up to four actions like all scripts).

    Variable Scope and Channel are the same as in Number Change. The context here, is what type of number are you trying to check, and the specific one?

    Offset: not usually used, but utilize if you need this script to see the number differently than it is. Think of it like getting a kid onto a rollercoaster by giving them bigger shoes.

    Operator: Equals, Greater Than, etc. - How to compare the number we're checking, to the Value we are checking it against. Is it okay that this number is merely higher than another number, or does it need to be exactly this number in order to meet the condition?

    Check Scope: Scope of the value you are checking the number against. Here is where you have an opportunity to compare a number to something else in the game, whether it be a global variable being altered by some other script, or the score of the game changing, etc. etc.

    Value: If a constant, what is the number (integer) our first number is being compared to?


    Example: Number Check, Global Charlie, Not Equal, to 0, Despawn
    • Script 2: Equal to 0, Spawn
    That gives you the ability to create any multitude of reasons/conditions why a thing should despawn, rather than just having On/Off for a condition such as what is available from the Power Channels.

    Summary: The amazing usefulness of the numbers in scripting with Forge is that you have so many channels available to you, so if you want to, say, have dozens upon dozens of unique, independent, dynamic items in your map, you can do so. None of them would have to share any channels or overlap in any way, scripting-wise.

    To demonstrate the sheer magnitude of the change to include Variables in addition to Message Sends and Power Channels, which is all we had before Montor's Bounty udpate, see the following tally.

    All are A through Z (26 channels)
    Message Send: Gives us one condition per channel. (26)

    Power Channel: Gives us 1 state that can be on off, per channel (26), but can be used as two conditions (one On, one Off) per channel (52).

    Global Variables: Gives us 1 number per channel (26), but where each number can have, presumably, a nearly limitless number of states. Global Variable Alpha can, in theory, trigger one thing to occur if it is at 0, another at 1, 2, and so on, all the way up to... who knows how high? It should also be pointed out that we can use negative integers too! It can often be useful to allow or make a number be less than 0, or it may simply be the remainder from subtracting or dividing one value from another.

    Objects of course, have their own (1) number as well. So, just as many objects as you can place, you can also check a number for. (other limits notwithstanding)

    So that puts our tally at 26+52+(26*1,000,???)

    ...yyyyeah. If you can think of it, you can probably make it when you have this many options for the logic of how it will all be woven together.
     
    #7 ExTerrestr1al, Sep 3, 2017
    Last edited: Sep 4, 2017
    a Chunk and ACTIVATE HALO like this.
  8. ACTIVATE HALO

    ACTIVATE HALO Legendary

    Messages:
    166
    Likes Received:
    254
    OMG...

    'Screenshots'
     
  9. ExTerrestr1al

    ExTerrestr1al Forerunner
    Senior Member

    Messages:
    2,387
    Likes Received:
    2,515
    what do you want screenshots of?
     
  10. ACTIVATE HALO

    ACTIVATE HALO Legendary

    Messages:
    166
    Likes Received:
    254
    Im signifying that I took screenshots of your post.
     
    ExTerrestr1al likes this.

Share This Page