Bug Catching Challenge

Hey all,


I am trying to implement a bug catching mini game. This is what I want to happen: Basically, when the player gets close to the bug (like 3 spaces away), the bug starts to flee the player and then disappears 300 frames later if the player doesn't catch it (the event erases). I am using Yanfly's event chase/flee player plug-in, however, I do not know how to get the bug to disappear after 300 frames. Have you guys got any idea how to do this?


This is what I was trying to do, but it doesn't work.

Untitled.png
You could set a switch and have the bug disappeared on another page. 🙂
make it a self switch, unless you're only going to have one bug.  That means you'd need to use a script command to turn it on.


Also, you say "it doesn't work" the way you've got it, but you don't say what actually does happen instead.  Does it not flee at all?  Does it not disappear after 300 frames?  


If you need help getting it to flee, you need to provide a link to the plugin/script.  Looking at your screenshot, it looks like you've got it in a Set Movement Route event command, on a page with an Action Button trigger.  This means the movement route won't be activated at all until the player is right beside the event and interacts with it, and that's probably not what you want.  Without seeing the plugin, I don't even know if you're meant to use a script call to set the flee range - surely the plugin would have an example or a video showing how it's meant to be set up - Yanfly's pretty good with explaining how to make the plugins work.
make it a self switch, unless you're only going to have one bug.  That means you'd need to use a script command to turn it on.


Also, you say "it doesn't work" the way you've got it, but you don't say what actually does happen instead.  Does it not flee at all?  Does it not disappear after 300 frames?  


If you need help getting it to flee, you need to provide a link to the plugin/script.  Looking at your screenshot, it looks like you've got it in a Set Movement Route event command, on a page with an Action Button trigger.  This means the movement route won't be activated at all until the player is right beside the event and interacts with it, and that's probably not what you want.  Without seeing the plugin, I don't even know if you're meant to use a script call to set the flee range - surely the plugin would have an example or a video showing how it's meant to be set up - Yanfly's pretty good with explaining how to make the plugins work.



Right. More details-sorry! The way I have it now, the bug senses you and starts to flee when you are 3 steps away. And then it continues to flee without disappearing. I have no problem with the bug catching part. I have a problem with the bug disappearing if you are too slow. For this plug-in, you are supposed to use the script call within the custom autonomous movement route area.


This is the plug-in I'm using, by the way: http://yanfly.moe/2015/10/21/yep-20-event-chase-player/


It's very straightforward, just doesn't seem to mesh well with what I'm trying to accomplish.


However, if there is another way to do this without a plug-in or with another plug-in, I'm open to it!
Love Yanfly's videos 🙂


I think putting the wait and erase in the movement route is where you've gone wrong.  Instead, create a common event, put the commands in there, and use the this._alertCommonEvent = id option that comes with the plugin (@3:09 on the video) to make it call the common event when the alert is triggered.  Hopefully using eventId() will give you the current event's id when called from that option - it may not - that might be the next hurdle to overcome.  If it's only one bug on one map you can hardcode the id.
I've been experimenting with using the common event script call, and I think I'm getting somewhere. My problem is utilizing self switches with common events. This is what I have. It works when I use Switches instead of Self-switches, obviously, but I don't want to have individual common events and switches for every single bug that will be in the game. Any ideas?

1.png

2.png

3.png

4.png
Can you get the event's id from within the common event?  If not, perhaps modify the plugin so that, at the time it calls the common event, it also sets a variable to the current event's id.


Then you can use $gameSelfSwitches.setValue([$gameMap.mapId(), $gameVariables.value(x), 'A'], true) where x is the variable id you're using to hold the event id.  I'm not sure if $gameMap.mapId() is the correct syntax - you might need to check that.


The plugin would probably have a call to $gameTemp.reserveCommonEvent...something - if you can find that, insert the variable update on a line immediately above.


In fact, I'll do it for you ... let's assume you want to set variable 15 to the current event's id, when this plugin sets up a common event alert.  Go to line 334 in the plugin:


Game_Event.prototype.playAlertCommonEvent = function() {
if (this._alertCommonEvent <= 0) return;
$gameTemp.reserveCommonEvent(this._alertCommonEvent);
};


and insert the new line:


Game_Event.prototype.playAlertCommonEvent = function() {
if (this._alertCommonEvent <= 0) return;
$gameVariables.setValue(15, this._eventId);
$gameTemp.reserveCommonEvent(this._alertCommonEvent);
};




then in your common event, to turn on self switch B:

Code:
$gameSelfSwitches.setValue([$gameMap.mapId(), $gameVariables.value(15), 'B'], true)
It works! Thank you for your help!!! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/bug-catching-challenge.61202/