PushEvent.js (pushable events)

This is such a common thing in RPGs and it turned out so easy to do, that I know that this plugin probably already exists (maybe more than once).

Mine is special for these simple comment tags. (perhaps?)
  • <push> makes an event pushable
  • <moveIfCornered> makes event move if push up against obstacle
  • <withDirection> makes event face direction like driving it
  • <heavySpeed:number> will make the push slow down to that speed
They go in event comments and not in the note, because I wanted it to rely on pages. The events pushability is also independent of their trigger, so you can have a push by pushing and a talk by action button.

This plugin is based on some event script I wrote for @XGuarden at her request so this is really her idea.
This thread: https://forums.rpgmakerweb.com/index.php?threads/push-a-box-using-javascript.75244/

That's really all that's to this plugin.
Spoiler: Youtube Screenshot Video


I wish I could say more about it, but all it does is makes events pushable with event comments. I allow commercial use too, as I do with all my 2 scripts. Keeping myself busy, yepper!

EDIT:
I made a version 0.3, because just a slight optimization. When I rushed to correct the broken pages, I snuck the comments reader in Sprite_Character.prototype.update which turns out runs every frame, so I added some Boolean to make sure to only read the comments once per page per solo frame, and not rapidly and redundantly re-capture all the data every frame.

Update: version 0.4
I corrected a possible bug for events without pages. I'm not sure, but this might work better with events spawned with another plugin. Thanks
@Edilsonsoares

Update: version 0.5 - Cognitive impairment re-fix. Thanks to @Rhino
Nicely done, mogwai! Sometimes the most useful plugins are the ones that are simple things everyone asks about.
Thanks @Trihan ! Kudos I get, fuels my motivation to make more things.
Spoiler
What I'm curious to see in this thread if anyone gets my classic Dragon Quest reference in the example video of pushing the old man to the hot springs.
I didn't pick up on it but then again I came to that series fairly late.
That music is awesome!

Handy script\plug-in. Eventing pushable stuff is always fairly time consuming - this saves a lot of time.
@The Stranger Yep. I made about 4 different versions of the event script in the push thread, because I kept missing something in each one, but this way those four event scripts are basically a comment tag now. I picked out the music from Audioswap.

@Trihan
Spoiler

I thought it was push the old man to a hot spring, but all I could find was pushing the old man to church. Perhaps it was the Taloon chapter and the same old man at night time. I had the NES version; this is the DS version.
I just want to bump this old thread to say the first version was kinda broken!
I've made a version 0.2...

I had it take comments on setCharacterBitmap, which turns out only runs once and then when you update the bitmaps. So it wasn't reading comments on page changes. I fixed this.

I also changed my aliases to IIFE arguments so there is no chance of name collisions. @Clock Out taught me this neat trick. @LTN Games might have been on about this earlier too, but I needed an example to get it.

EDIT/EDIT:
I made a version 0.3, because just a slight optimization. When I rushed to correct the broken pages, I snuck the comments reader in Sprite_Character.prototype.update which turns out runs every frame, so I added some Boolean to make sure to only read the comments once per page per solo frame, and not rapidly and redundantly re-capture all the data every frame.
I open a title screen and when I press the new game, it appears
tumblr_ootqsdPDEX1thlkuqo1_1280.png
@Edilsonsoares
I can only read a Google translate, which is loose, but I know what that screenshot means

Ayeyeye!

I can think of a fix for this.
Though, out of curiosity, are you using an event spawning plugin?

If so, it seems to be doing it dangerously, creating an event without its pages.

Try this version 0.4 - I think it will work, but I'm not sure what other risky events might be in your game.
I've disabled all plugins,but the error persists 😅
I thought it might have been the characterBase boats, but I can't replicate this error, so I'm not sure what is wrong.

Did you get the version 0.4 attached to my last post? The download link seems to have a 0 for a download count.
I had not seen... 😅
Now it worked
Muito obrigado ou melhor, thanks
Heads-up, this plug-in for whatever reason completely breaks the "Direction Fix" check for events so it just doesn't work anymore.
@AestheticGamer
Explain.
Basically I have sprites loaded from Character sheets in the environment, with a $ symbol in front to make it a limited spritesheet. I do this for some objects in my game, such as items you pick up so they don't take up space on tilesheets/NPCs who are bigger than 48x48 tiles. In this case it was something that was 48x48 tiles, but on a 3x4 tilesheet.

So one of the sheets has different items on different directions of the sheet, like this:

0c70c32b2342dcc869586b6366335654.png


So I was trying to use the lower-left bottle. And on the event, so it would turn into the different colored keys when you observed it from different directions, I checked the lower-left Event box for "Direction Fix" in RPG Maker, since that locks the direction of an event normally.

But I noticed it wasn't doing that in the game, even with the Direction Fix set it would still turn into different objects when I observed it from different directions.

So I turned off all of my plug-ins and indeed direction fix worked again. So then I turned on each plug-in individually to see which broke the Direction Fix (and turned the others off if they didn't do it to find which one was the problem child), and it ended up being this plug-in. Even by itself it broke the Direction Fix option for Events without any other plug-ins turned on. Once I had turned all the other plug-ins on and turned this one off, it was working again too.
Turn off walking/stepping.
Turn off walking/stepping.

I'm having a problem with the directional fix too. I've turned the walking & stepping off but it hasn't helped 😢 I checked my other plugins but it does seem to be this one causing the problem.

EDIT: I just realised I have an event that needs a stepping animation anyway so this wouldn't be a viable fix for me.
That's not really the same problem. That other one had a sprite with different things on each frame.

The only thing that should break the direction fix is the <withDirection> comment. That will change the direction to the pusher's direction.
Erm, sorry for being dense. I'll try to explain the problem better. I'm making an event with Starbird's Animated Fountain. It has four different fountains on the sprite sheet.
I'm trying to use this one.
Spoiler
1.png

When I interact with it from the front, it changes. The only direction it works in is if the player is facing left.
Spoiler
2.png
4.jpg

(I will be fixing the sides so the interaction looks better, I'm mostly concerned about the up & down interaction.)

This is how the event looks- the direction fix is on and there's no push comments.
Spoiler
3.png

You mentioned to AestheticGamer to turn the Walking + Stepping for the event off, which didn't work for me, but wouldn't help anyway as I need the stepping animation for the water. I've also tried using a set move route: direction fix when you interact with the event, but that changes the graphic and then locks it into the wrong image.

I hope this makes more sense ^^'
These screenshots show default events like they are supposed to behave.

It's a little ambiguous to see the problem with my script.

A screenshot or a bbcode box with the push comments would help.

I'm not even sure you are pushing the event yet.

Original thread: https://forums.rpgmakerweb.com/threads/pushevent-js-pushable-events.75844/