PushEvent.js (pushable events)

Discussion in 'JS Plugin Releases (RMMV)' started by mogwai, Mar 12, 2017.

  1. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    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.

    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
     

    Attached Files:

    Last edited: May 8, 2017
    #1
    Val, Rhino, RionFish and 9 others like this.
  2. Trihan

    Trihan Speedy Scripter

    Messages:
    1,397
    Likes Received:
    888
    Location:
    Buckie, Scotland
    First Language:
    English
    Nicely done, mogwai! Sometimes the most useful plugins are the ones that are simple things everyone asks about.
     
    #2
    Kyuukon and mogwai like this.
  3. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks @Trihan ! Kudos I get, fuels my motivation to make more things.
    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.
     
    #3
  4. Trihan

    Trihan Speedy Scripter

    Messages:
    1,397
    Likes Received:
    888
    Location:
    Buckie, Scotland
    First Language:
    English
    I didn't pick up on it but then again I came to that series fairly late.
     
    #4
  5. The Stranger

    The Stranger A Faceless Friend

    Messages:
    2,476
    Likes Received:
    7,250
    Location:
    Birmingham, England
    First Language:
    English
    Primarily Uses:
    RMMV
    That music is awesome!

    Handy script\plug-in. Eventing pushable stuff is always fairly time consuming - this saves a lot of time.
     
    #5
  6. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    @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

    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.
     
    Last edited: Mar 12, 2017
    #6
    The Stranger likes this.
  7. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
    Last edited: Apr 19, 2017
    #7
    LTN Games likes this.
  8. Edilsonsoares

    Edilsonsoares Villager

    Messages:
    10
    Likes Received:
    1
    Location:
    Brasil
    First Language:
    portugues
    Primarily Uses:
    N/A
    I open a title screen and when I press the new game, it appears[​IMG]
     
    Last edited: Apr 23, 2017
    #8
  9. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    @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.
     

    Attached Files:

    Last edited: Apr 23, 2017
    #9
  10. Edilsonsoares

    Edilsonsoares Villager

    Messages:
    10
    Likes Received:
    1
    Location:
    Brasil
    First Language:
    portugues
    Primarily Uses:
    N/A
    I've disabled all plugins,but the error persists :rswt
     
    #10
  11. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
    #11
  12. Edilsonsoares

    Edilsonsoares Villager

    Messages:
    10
    Likes Received:
    1
    Location:
    Brasil
    First Language:
    portugues
    Primarily Uses:
    N/A
    I had not seen... :rswt
    Now it worked
    Muito obrigado ou melhor, thanks
     
    #12
    mogwai likes this.
  13. AestheticGamer

    AestheticGamer Veteran

    Messages:
    41
    Likes Received:
    16
    Location:
    Portland, Oregon
    First Language:
    English
    Heads-up, this plug-in for whatever reason completely breaks the "Direction Fix" check for events so it just doesn't work anymore.
     
    #13
  14. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
  15. AestheticGamer

    AestheticGamer Veteran

    Messages:
    41
    Likes Received:
    16
    Location:
    Portland, Oregon
    First Language:
    English
    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:

    [​IMG]

    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.
     
    #15
  16. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    Turn off walking/stepping.
     

    Attached Files:

    #16
  17. Rhino

    Rhino Champion Snoozer

    Messages:
    404
    Likes Received:
    455
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm having a problem with the directional fix too. I've turned the walking & stepping off but it hasn't helped :kaocry: 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.
     
    Last edited: May 7, 2017
    #17
  18. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
    #18
  19. Rhino

    Rhino Champion Snoozer

    Messages:
    404
    Likes Received:
    455
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
    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.
    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.
    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 ^^'
     
    #19
  20. mogwai

    mogwai 1984

    Messages:
    876
    Likes Received:
    564
    Location:
    Bassett Nebraska
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
    #20

Share This Page