Issue with variables

● ARCHIVED · READ-ONLY
Started by Moonveelt 5 posts View original ↗
  1. Hello everyone, I have made a few games so far but haven't implemented variables that much.
    I have a basic understanding of how they work but can't seem to make sense of how this particular thing works.

    I made a sort of "quiz" in the game, for each correct answer one variable would go +1.
    And in the end when you would have 6 as the total value, two chests and two portals would spawn.
    Which works correctly, but as soon as you enter one of the portals and then come back, the two chests and portals have disappeared.
    I can't seem to find anywhere online what the problem to that might be?

    Also, I have a quest ongoing to find a certain amount of crystals, which also is stored in variables.
    So when you find one crystal, there will be a +1 in the variable as well.
    My question to that is then: When I go to other maps (Because the crystals will be worldwide) will the variables reset?

    I have posted images to show what the eventing looks like.

    chest.png
    portal.png
    crystal.png
  2. No, the variables do not reset when you change maps unless you have an event that resets them.

    You are using switch 2 to keep track of the correct answers. Where are you initializing that to zero? Ideally, it should be at the start of the quiz event, but you only want to reset it until they actually complete the quiz.

    So maybe you're resetting it every time. Or maybe you have a plugin that uses variables, and you haven't configured it or checked what variables it uses, so you are using the same variable for two different things. Many people do this.

    MV has a search tool where you can look for events that change a variable. That would be a good place to start, to see any places where it's reset, that you might have forgotten about.
  3. Thanks for the quick reply Shaz, I worked on the problem now in the evening and it was as you said, what I did
    to fix it was:
    I put in an autorun event on that map to set "switch 2" to 0, and that did the trick, works like a charm now!

    Thread can be closed.
  4. just report your first post and ask the mods to close the thread.
  5. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.