Are Global Variables active only for particular eventsheet

0 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi

    I am Making a quiz game with construct 2..., i added a lifeline for user and i want that user can use it only once in a game....,

    NOW THIS IS WHAT I HAD DONE..., PLEASE LET ME KNOW IF I HAVE DONE ANYTHING WRONG

    On my main Layout's event sheet i added a global variable "HELP"

    My every question have different Layouts and different event sheets., I added various groups to my eventsheets for eg:- GROUP"1" to 1st eventsheet , GROUP"2" to 2nd eventsheet , GROUP "3" to 3rd eventsheet and so on.....

    {now i will give you example of my 1st eventsheet}

    in GROUP"1":-

    System - On start of layout == System - Wait 1 sec.

    System - Create object "lifeline" on Layer__________

    after that

    Mouse - On left click on "lifeline" == System - Add "1" to "HELP"

    (this is not included in Group)

    {same way i done in all other eventsheets}

    Now in main eventsheet

    System -"HELP" is equal to "1" == System - set GROUP"1" deactivated

    System - set GROUP"2" deactivated

    System - set GROUP"3" deactivated

    and so on......

    [it is done so that the object"lifeline" could not be created in any other layout., once it is clicked.]

    THIS ALL I HAD DONE...... But i am not getting the result..., the object"lifeline" gets created in 2nd layout., even when i clicked on it in 1st layout.....the group do not gets deactivated....... I also tried by adding Instance Variable to object"lifeline" with different settings....... But still HELPLESS ...

    Are Global Variables active only for particular eventsheet., dont they react on whole project....????

    Please HELP ME.... I provided so much detail so that you can properly understand my issue.....

    i would be really thankful to you... If you sot out my this issue......

  • I just read this in the manual which (to me anyway) suggests that they stay active once initiated even when you load a new event sheet..

    [quote:5xe5kid7]

    Global variables store their values between layouts. Events in any layout can access any global variable, even if it was created in a different event sheet that is not included.

    https://www.scirra.com/manual/83/variables

  • Maybe test this by putting a textfield in every layout and set it to textfield>set text>HELP so you can see if it actually changes the variable to 1 or not?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • globalvariables are global that means are usable in all event sheets, however if you don't include the right code for it they wont update, its a matter how you link the events inside your event sheets don't you think so? the same way goes for global objects

    for example i can have 1 scene with 10 event sheets and 5 scenes with 1 event sheet, the only thing i have to do is right click and include event sheet, or clone the event sheet for N times for each scene which is tedious and messy, that's why people tends to use as a general system the function object.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)