Make If Then Statements

Discussion in 'Buildbox General Discussion' started by Logan242, Jul 25, 2019.

  1. Logan242

    Logan242 Avid Boxer

    Joined:
    Sep 28, 2018
    Messages:
    106
    Likes Received:
    15
    Hello,
    I am trying to make a power up and when the actor collides with it then it makes the actor invincible for a short period of time. I am wondering how I would be able to make an attribute and change it to true or false depending on the state of the actor. For example when the actor collides then change attribute to true and then after a certain amount of time change it to false. Any suggestions? This is with BB3 BTW.
     
  2. jens_loncke

    jens_loncke Boxer

    Joined:
    Dec 29, 2015
    Messages:
    12
    Likes Received:
    4
    I've not checked the api yet, but u can write a small node script with an if statement with a boolean in it (if collides) {boolean = true }

    something like that
     
  3. Logan242

    Logan242 Avid Boxer

    Joined:
    Sep 28, 2018
    Messages:
    106
    Likes Received:
    15
  4. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6
    I dont know how to write code and i needed to do something similar so i just used a state machine to fix the problem since it turns off one state to start another state what i did was hook up a button to the enable 2 state then leave it empty for the run side except for a delay node hook that up to the run on the state 2 then hook the end of the delay to the enable on the state 1 and have all the things that you want you actor to react to hooked up to the end of state 1 so like your if collides would be hooked up to state 1 so when the delay finishes counting it will enable state 1 and turn off state 2 allowing it to be defeated again anyway its kinda primitive and you may need to play with it but it can work
     
  5. Logan242

    Logan242 Avid Boxer

    Joined:
    Sep 28, 2018
    Messages:
    106
    Likes Received:
    15
    Thank you @Killjoy1432 for your suggestion. I appreciate it! I’ll have to try it out.
     
  6. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6
    sure no problem hope it helps
     
  7. Logan242

    Logan242 Avid Boxer

    Joined:
    Sep 28, 2018
    Messages:
    106
    Likes Received:
    15
    Hello,
    I tried out your suggestion and I can't seem to get it to work. Am I doing it wrong? Attached is a screenshot of what I did and a video showing my problem. Basically, I put a threshold on how many missiles it would fire but the threshold does not reset. Have you figured out a way to fix this? Or do I use a timer? Thanks for your help.
    https://ibb.co/0BvdQTZ
     
  8. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6
    Hey, sorry i didnt get back to you sooner ive been busy but i tried to understand what is it was exactly you wanted so i made a couple of assets up and came up with what you see in the pics i suggest taking a look and using what you think will help sorry i dont have a video or didnt send the actual assets to you as i dont really know how to do all that yet but i hope this will help you in some way to figure out how to make your game
     

    Attached Files:

  9. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6
    Oh yeah one is of course the actor and the other is the power up in this case the atom you can tell which is which by looking at the top of the pics where is says what assets is selected you will need to set both of them up for it to work you can name the send and receive nodes what ever you want also i set the delay nodes hooked up to the spawner to .3,.6,.9 and the one hooked up to the state 1 i set to .9 so the power up will of course stop in less than a second but if you want it to last longer which im sure you do just change that as you see fit if you have any ?'s just ask ill try to get back to asap
     
    Last edited: Jul 30, 2019
  10. Logan242

    Logan242 Avid Boxer

    Joined:
    Sep 28, 2018
    Messages:
    106
    Likes Received:
    15
    Thank you so much!!! @Killjoy1432 It worked. I really appreciate you helping me with this!
     
  11. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6
    no problem hope your game does great
     
  12. mattiemoreno

    mattiemoreno Boxer

    Joined:
    Jul 19, 2019
    Messages:
    7
    Likes Received:
    0
    I couldn't imagine anything better than to see a report on this including a portion of the proposed changes.:) I have to work on a project in upcoming days and i think this information will definitely help me a lot. Thanks for sharing this amazing information with us
     
  13. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6
    Yeah thanks man I just thought it can be hard to come across help on here I mean I try to answer what I can to help out but a lot of the answers I dont know but to this one question I knew the answer or at least one that might help because I had to figure out the same thing for my current project so im glad that it will be able to help you out in yours I know is sorta a crude way of doing things but thats what i get for not knowing how to code lol I have to find ways to make my game work
     

Share This Page