Galv's Puzzle Functions


 Puzzle Functions - Version 1.1
RPG Maker MV Plugin
Galv

​


Introduction
This plugin adds some functions to use that may help with eventing puzzles and/or quests.


Features


1. Self-switch flipping

  • Change self switches for any event from any event
  • Change self switches for events adjacent to other events
  • Specify turning these self switches off, on or flip them



2. Determine location without having to use Control Variables beforehand.

  • Test to see if an event or player is at an x,y location
  • Test to see if an event or player is at another event’s location



3. Group switch/self-switch checking

  • Test to see if a group of specified switches are on or off
  • Test to see if a group of events have a certain self switch on or off



4. Checking event activation order

  • Set a combination
  • Make events add combination values
  • Check if the player has activated the events in the right order set in the combination specified.



5. Multiple Item Checking

  • Check if there are multiple items, armors, weapons in inventory using code with only one conditional branch.




How to Use
- Copy the "GALV_PuzzleFunctions.js" file into your project's /js/plugins/ folder.
- Activate plugin using the 'Plugin Manager'
- Read the help file and examine the demo to learn how it works.


Plugin
Get it here


Credit and Thanks
- Galv


Terms
Free to use in any RPG Maker MV project including commercial. Please credit "Galv". 🙂


Updates


2016-09-28 - Version 1.1 - fixed bug with using 0 for actor
2016-08-15 - Version 1.0 - release
I do not know if this is intentional, but using isAt to check if the player and current event are at the same place using Galv.PUZ.isAt(0) results in a crash. Perhaps I am doing something wrong?

Spoiler
GalvPuzError.JPG
It appears I didn't take into account parallel processes. If you are using the script call in a parallel process, use this:


Galv.PUZ.isAt(0,this._eventId)


This will put the event's id in correctly
It works, thank you. This is a very useful plugin.
It appears I didn't take into account parallel processes. If you are using the script call in a parallel process, use this:


Galv.PUZ.isAt(0,this._eventId)


This will put the event's id in correctly

Thanks Galv,


I love this plugin, but is there another way of using Galv.PUZ.isAt([x,y],0) in a parallel process? I am trying to use your plugin to flip a switch for any tree event my character is under. And when the switch is flipped, the trees' opacities are transparent to make an effect of the player being able to see under the leaves of the trees. I've tried to flip the values to Galv.PUZ.isAt(0,[x,y]) and I get the same error as listed above. I can't use Galv.PUZ.isAt(0,this._eventId) since I am wanting to know the player's position in regards to offset x and y positions of the events in question.


Here's a sample of the code I'm using to check if the player is in a region under a tree, which tree it's under, as well as being in an offset of the tree by being under the leaves of the tree (it doesn't include yet a checker to see if the switch has already been hit and the player is not under the tree anymore for the switch to go back, but it does flip the switch for each tree I'm currently under to make the tree transparent when I make the Trigger process "Action Button"):


if ($gamePlayer.regionId() === 254) {
for (var i = 18; i < 86; i++) { // Event IDs of all trees
for (var yOffset = 1; yOffset < 3; yOffset++) { // 1st 2 rows under tree
for (var xOffset = -2; xOffset < 3; xOffset++) { // Each tile in the row
var xIndex = $gameMap.event(i).x + xOffset; var yIndex = $gameMap.event(i).y - yOffset;
if (Galv.PUZ.isAt(0,[xIndex,yIndex])) {
Galv.PUZ.switch('event','A','on',i);
};
};
};
for (var xOffset = -1; xOffset < 2; xOffset++) { // Each tile in 3rd row under tree
var xIndex = $gameMap.event(i).x + xOffset; var yIndex = $gameMap.event(i).y - 3;
if (Galv.PUZ.isAt(0,[xIndex,yIndex])) {
Galv.PUZ.switch('event','A','on',i);
};
};
};
};



Any help would be appreciated.
 
There was actually a bug with this. Grab version 1.1 and then your original command should work:


Galv.PUZ.isAt([x,y],0)
Hi Galv thanks your puzzle functions plugin but I got a problem, i just need to check the X coordinate of my event because the Y would be random so I can't check it and I can't leave the Y blank because it returns an error, what should I do? I want to Galv.PUZ.isAt([0,]) but I can't leave the Y coordinate blank
You asked this on my script site twice, my facebook messages and here? 🙁


You can use control variables to set a variable to an event's x. You don't need this plugin to do that.


Edit: Or perhaps I am misunderstanding your question

Original thread: https://forums.rpgmakerweb.com/threads/galvs-puzzle-functions.67978/