I Need Help With The Switch Node Please..

Discussion in 'Buildbox 3.0' started by FST, Jun 11, 2020.

  1. FST

    FST Boxer

    Joined:
    May 28, 2020
    Messages:
    8
    Likes Received:
    0
    Hi everyone,

    I am new to BB and i need help in making the switch node have 4 outputs.
    I know how to increase the output points but i guess i still need to modify the code of that node to make it functional with 4 outputs.
    I have no experience at all in coding (That's why i am using BB :), so maybe you can help me find a ready made script?

    Thank you
     
  2. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
  3. FST

    FST Boxer

    Joined:
    May 28, 2020
    Messages:
    8
    Likes Received:
    0
    Hi Mohamed and thank you for your quick reply.

    I've tried the script that you mentioned (copied and pasted it in the Switch Node) as it is and added 2 additional outputs (C and D) to the node, but unfortunately it didn't work.
    Should it work as follows?
    Each time i trigger the input, the switch should jump from A to B to C to D sequentially? Am i right or am i skipping something here?

    Many Thanks
     
  4. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    does "emit on start" true?
     
  5. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    it works fine here, just if "emit on start" equal true A will be true and the first trigger will be A too, after that everything will be fine
    screenshot for node connection
     
  6. FST

    FST Boxer

    Joined:
    May 28, 2020
    Messages:
    8
    Likes Received:
    0
    Yes "Emit on start" is enabled because i want it to start on A.
    Here is a screenshot.
    What i want is, each time the player hits this object the switch should flip to the next output until it reaches the "Output D" and plays a sound and trigger the "Send node" as you can see in the screenshot.
    When i connect the "Sound node" directly to the "collide" as a test, it plays the sound each time the object hits the player. So i am sure the collide setup is working fine but not sure about the switch.

    Thanks,
    1.PNG
     
  7. FST

    FST Boxer

    Joined:
    May 28, 2020
    Messages:
    8
    Likes Received:
    0
    I also placed those different sounds (A, B, C, D) on each output to identify which output is being triggered each time the player hits that object, and found out that the "Output A" is always triggered and it's not jumping to B, C, and D... 2.PNG
     
  8. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    inside start function - if(_emitonstart){}
    add this line
    Code:
    _switched = 1;
    I think when you test it, there are logs on right corner
    0
    1
    2
    3
    right ?
     
  9. FST

    FST Boxer

    Joined:
    May 28, 2020
    Messages:
    8
    Likes Received:
    0
    Hi Again,

    I guess the problem is in my project.
    I've placed the 4 ways switch in a new project and it worked great.
    I will have to figure out what went wrong in my initial project.
    Thank you so much for your help
     
  10. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    good
    but you have to add this line to work normally
    _switched = 1;

    and YW.
     
  11. FST

    FST Boxer

    Joined:
    May 28, 2020
    Messages:
    8
    Likes Received:
    0
    Yes sure, thank you for your great help Mohamed
     

Share This Page