Results 1 to 1 of 1

Thread: create bool variable and check if it's true at the moment but on another script

  1. #1
    ... connecting
    Join Date
    Feb 2018
    Posts
    4
    Thanks
    1
    Thanked 1 Time in 1 Post

    create bool variable and check if it's true at the moment but on another script

    I also have another question (I am very new to scripting and I am trying to learn so please be gentle), I wanted to create a bool variable and then check if it's true at the moment but on another script. I was told to make the variable global by writing "level" behind it, like "level.variable = true;", is this correct? Then on another script I wrote down an If condition to check if the variable is true and if so to execute something ("if (level.variable == true)...) but when I start the game it acts like the variable is ALWAYS true even if I initially set it to "false". What am I doing wrong?

    And sorry if I was not explicit enough, just let me know if so.

    Also if you could teach me instead of giving me the answer right away I would appreciate it.

    Thank you,
    Belz

    ##### 2nd post merged by kung (please ensure 1 thread = 1 question) #####


    Okay I got it to work by initially creating the variable and set it as false in the first thread of the script... hope that makes sense.
    The mod works by waves and by the end of certain waves bosses spawn and it plays a specific music. I wanted my custom sound to stop when bosses spawn so I set the variable as false in the thread that starts the wave and then as true in the thread that spawns the bosses, and then check if it's true or not on my map to stop or start the music.
    It's working but.. is it efficient? Should I try to make it better?

    Thank you in advance
    Belz
    Last edited by Belz; 19th February 2018 at 14:55. Reason: be more explicit about how I fixed it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •