Ahoy all. So I've watched a few different video tutorials and have been playing around inside MZ in order to try and better grasp variables and how to use them (something I had a LOT of trouble with in my previous attempts to RPGM years ago, for some reason variables were a difficult thing for me to get my head around).
I think I've mostly got it now, but there is one thing happening that's puzzling me. While playing around with different ways to set and use variables, I set up this event, with the trigger of "Action Button" (and a random crystal for a graphic, so this happens when I talk to the crystal):
and then nearby, I have another event which was set to run as a parallel process, and has this in it:
No doubt you can see what I was trying to test - I talk to the crystal, it sets variable 16 to be equal to "the number of Mithril Swords in my inventory". Then it gives me a mithril sword, which should thus mean that variable 16 is now 1. Then the other event immediately begins making the SHOCKED! music effect repeatedly since it's dependent on variable 16 being 1.
BUT... what happens when I playtest is that it DOESN'T start making the sound when I have 1 sword. I talk to the crystal and it gives me a sword, but then nothing happens, even though there is indeed 1 Mithril Sword in my inventory. Only when I talk to the crystal again, increasing the number of Mithril Swords in my inventory to 2, does the Shocked sound begin to play repeatedly.
So what am I missing here? If all variables start at 0 when the game begins, then based on the above event commands, shouldn't the sound play after I have been given 1 sword?
I think I've mostly got it now, but there is one thing happening that's puzzling me. While playing around with different ways to set and use variables, I set up this event, with the trigger of "Action Button" (and a random crystal for a graphic, so this happens when I talk to the crystal):
and then nearby, I have another event which was set to run as a parallel process, and has this in it:
No doubt you can see what I was trying to test - I talk to the crystal, it sets variable 16 to be equal to "the number of Mithril Swords in my inventory". Then it gives me a mithril sword, which should thus mean that variable 16 is now 1. Then the other event immediately begins making the SHOCKED! music effect repeatedly since it's dependent on variable 16 being 1.
BUT... what happens when I playtest is that it DOESN'T start making the sound when I have 1 sword. I talk to the crystal and it gives me a sword, but then nothing happens, even though there is indeed 1 Mithril Sword in my inventory. Only when I talk to the crystal again, increasing the number of Mithril Swords in my inventory to 2, does the Shocked sound begin to play repeatedly.
So what am I missing here? If all variables start at 0 when the game begins, then based on the above event commands, shouldn't the sound play after I have been given 1 sword?