Use My Own Variables

Discussion in 'How Can I...?' started by billcephus, Dec 11, 2020.

  1. billcephus

    billcephus Boxer

    Joined:
    May 31, 2020
    Messages:
    4
    Likes Received:
    0
    Hello ..

    In Buildbox am I able to create two variables and compare them?

    For example, the first variable "shots_fired" is set to 0 and can change while a second variable "shots_recommended" is set to 10 and does not change. During the level each shot fired will increment "shots_fired" by +1.

    For this example, let's say the players used 11 shots to complete the level which means "shots_fired" is now set to 11. "shots_recommended" was set to 10 before the level started.

    Now I want to compare the variables and indicate to the player they used 1 too many shots.

    If this is possible, please point me in the direction of a video or documentation, I have not found any so far.

    Thanks!
     
  2. iblicense principal

    iblicense principal Boxer

    Joined:
    Aug 26, 2020
    Messages:
    38
    Likes Received:
    11
    how do I put a hidden message on the official Buildbox forum or is it just the Microsoft Edge translator who is trolling?
    :)kkkkkkkkkkkk
     
  3. Josh (Nology Games)

    Josh (Nology Games) Avid Boxer

    Joined:
    Nov 27, 2017
    Messages:
    200
    Likes Received:
    155
    Hello, so this is easy enough to do, but the way it would work would depend on the exact way you wish for things to compare. however, you could use the Variable Save/Load nodes to help you out.

    First step is for when you shoot. in the node that you are using to fire a bullet, at the top type "Let shots_fired = 0;"
    Second step is to fire the bullet, and in the same function, add "shots_fired++;"
    Then you just connect it to the "Variable Save" node
    Now, without knowing the exact process you wish to use, this information may not be enough for you. However, if you join discord: "https://discord.gg/buildbox" and ask for help in Help Desk: Node design, we will be able to help you.
     
    billcephus likes this.
  4. billcephus

    billcephus Boxer

    Joined:
    May 31, 2020
    Messages:
    4
    Likes Received:
    0
    I'll check that out, thank you.
     

Share This Page