Change Switch when next to Event / NPC

Heya dear community!

I am a bit new to RPGMaker and I've come across a problem: I would like to interact with events once I stand next to them AND upon calling a common event. How would I best tackle this?

Here's an example: there is this blob and he should change into a dog if I call a certain event next to him. (The background idea is, my MC has the ability to create water and with it he should be able to change things in the world. But it should only work within a certain distance.)

capturegqo1y.png


I can call common events through yanfly's picture common events plugin anytime. If I click the symbol for water (the top one) in the corner, the water animation will play. I fiddled around with switches and the closest I have to working was the following:

If the common event -water- is called it will switch its "active" switch to true. Once the animation is over, it will set it to false again. Now, the blob checks through "player touch" if the water-switch is true or not and will change its own switch when true to change to the dog. Player or event touch won't be activated by just standing next to it but by walking into it. But I need to be moving into it WHILE having the animation play and that is very unpractical. 🙁

Help would be greatly appreciated!
Heya dear community!

I am a bit new to RPGMaker and I've come across a problem: I would like to interact with events once I stand next to them AND upon calling a common event. How would I best tackle this?

Here's an example: there is this blob and he should change into a dog if I call a certain event next to him. (The background idea is, my MC has the ability to create water and with it he should be able to change things in the world. But it should only work within a certain distance.)

capturegqo1y.png


I can call common events through yanfly's picture common events plugin anytime. If I click the symbol for water (the top one) in the corner, the water animation will play. I fiddled around with switches and the closest I have to working was the following:

If the common event -water- is called it will switch its "active" switch to true. Once the animation is over, it will set it to false again. Now, the blob checks through "player touch" if the water-switch is true or not and will change its own switch when true to change to the dog. Player or event touch won't be activated by just standing next to it but by walking into it. But I need to be moving into it WHILE having the animation play and that is very unpractical. 🙁

Help would be greatly appreciated!
Hello,

I haven't worked with that plugin but wouldn't you be able to make it work by creating some events around your blob that will turn switch "close enough" to ON on player touch and an outer ring of events that will set the switch to OFF and give the blob an event page that appears when your water switch and the "close enough" switch is ON?

Drawbacks:
For every transformable object you will need to make a switch.
If your blob moves around you will need to have a way to keep your events you create that serve as the radius of the transformable event to move along with them.

Hope this helps.
This might help with the touch radius.

https://forums.rpgmakerweb.com/inde...stance-fire-touch-events-at-a-distance.88311/
looks quite nice i might go and use it as well in the future.
Thanks jetboost for the idea and Frogboy for this amazing plug-in!
Now I can stand next to it with triggering the event, however I can't seem to figure out what to do next - when I enter the radius I let the blob check if the water switch has been activated. But once you enter the radius and are able to activate the water switch, the script will not check anymore if it has been activated, since the touch event already ran.

Do you maybe have any ideas to solve this? ^^
After some days of brooding, pondering and trying I finally got the solution! In case anyone else wants to attempt this, here it is, the blob event:

-On player touch (with the help of Frogboy's plug-in), it checks one tile away from him and activates its self-switch A

A (parallel):
-Check if switch "transform" is on (if I activate my common event "water" it switches "transform" on for the duration of the animation)
---- activate self-switch B
-Check if the player moves away (*script code)
---- deactivate self-switch A (at first I copied the start touch event to C and tried moving over to C and back and forth between A and C, but when turning self-switches turning them off is the way to go, I learned!)

B:
- Text (transformation complete!)

captureltqvb.png


*Apply the water

26uqoq.png



And here the script code, for when the player moves away lol. Does not seem like the prettiest one, but at least I got it working. If you know a prettier or easier way, please by my guest! (9 is my blob event ID)

!((($gamePlayer.x == $gameMap.event(9).x-1 || $gamePlayer.x == $gameMap.event(9).x+1) && $gamePlayer.y == $gameMap.event(9).y) || (($gamePlayer.y == $gameMap.event(9).y-1 || $gamePlayer.y == $gameMap.event(9).y+1) && $gamePlayer.x == $gameMap.event(9).x))


---------------------------------


Whew! Unless anybody has something more to add, I think this is done 🙂
Glad you got it working!

If you want to close this thread, just report it and tell the mods to close it and they will.

Original thread: https://forums.rpgmakerweb.com/threads/change-switch-when-next-to-event-npc.92939/