On Water Events

Here's another snippet that has been asked for over and over again but never get addressed as far as i am concern.

When someone asked for a script to let events move on water, the answer they get is:

Set the event to "through", then get a script to restrict the event movement to regions.

Not really a smart way and a lot of work just to get some events to work on water.

Well, here's a snippet that let any event(s) with <water> tag in their name move normally on water like your ship/boat do, and trigger like any other events.

[IMG]http://s28.postimg.org/k9zvjnyy5/Water_Events.png[/IMG]

Force Move routes/Random Movement/Chase, all works just like before, the only difference will be, these events

can only move on water.

Features:

Events that moves/acts in water.

How it works:

[1] Script itself is plug and play, simply put it anywhere in between Material and Main

[2] Put <water> as a tag in the event's name to make it moveable in water.

      [IMG]http://s3.postimg.org/aeslqv55b/watertag.png[/IMG]

Compatibility:

This snippet is unlikely to conflict with other scripts unless they modify the event passage.

Simply put this snippet below that script when that happens.

Terms of Use:

Feel free to use in both free/commercial project.

Get the Script here:

Spoiler
#==============================================================================# ■ Meow Face Water Events#------------------------------------------------------------------------------# Create on water only events#==============================================================================# How to Use:# [1]Plug & Play, Put this script below Material and above Main# [2]Put <water> in the event name you wish to place on water.#==============================================================================class Game_Event < Game_Character    #--------------------------------------------------------------------------  # ○ Alias method  #-------------------------------------------------------------------------- alias mf_wevent map_passable? unless $@  def map_passable?(x, y, d)      return $game_map.ship_passable?(x, y) if @event.name.include?('<water>')      return mf_wevent(x, y, d)  endend
UPDATES:

07-09-2015 Released

10-09-2015 Modified the alias method to overcome the compatibility issue.
Just a note...


It is not really a new method. You still overwrote an existing method in Game_Event, which means it will most probably conflict with any pixel movement scripts and other scripts which deal with the events' pass-ability.

Spoiler
Game_Event inherits from Game_Character which inherits from Game_CharacterBase, and that's where this method is defined initially.
Just because you can't see it directly in Game_Event, it doesn't mean that it's not there.


In these cases, you can call 'super' instead of a direct copy/paste of the original method.


If you want to alias these methods, first you need to call 'super' on them, and only after that you can alias them safely.


In these cases (and there are a lot of other methods with the same "issue"), I usually just call 'super' on these methods in a separate "script" which is placed at the very top of my custom script list, so that I can alias these methods safely later on in any other script I need.
Just a little info dump which is good to know if you want to share your scripts.


But, still, it's a cool script, and you handled it the easiest way possible, which is a good thing, in my opinion.
Thanks for pointing that out!  🙂

I pulled that out from my main script which has tons of event based vehicles + pick up able events + extra system vehicles, and completely forgot why i am not using super there. lol!

I should change that to super right now and probably re alias it in a different way.

Edit:

Changed. And it's much shorter than before 😀
WoW! This is really handy Meow. XD

Daaang this is really handy... lemme say it agaaaain, this is reallllly haaaaandy... and the best part of it, its only 6 lines long;D
Thanks! Glad you find it useful! 😀
Heck yeah! But now im just wondering. Will this cause like any lag since im assuming thats its constantly updating for a check? XD
Nope, this works the same as map passage check.

I only add a line for it to change the passage to be the same as ship when the event has a name tag.
The script in the top post is being messed up due to the recent V3 to V4 forum migration.


They are working on fixing it and we are told to avoid editing such posts so they can look into it.


Since this is one of the major used script and the messed up code isn't easy to fix by the user themselves, i am posting an alternative here until the web staff come up with the new patch to fix the top post:

Code:
#==============================================================================
# ■ Meow Face Water Events
#------------------------------------------------------------------------------
# Create on water only events
#==============================================================================
# How to Use:
# [1]Plug & Play, Put this script below Material and above Main
# [2]Put <water> in the event name you wish to place on water.
#==============================================================================
class Game_Event < Game_Character  
  #--------------------------------------------------------------------------
  # ○ Alias method
  #--------------------------------------------------------------------------
  alias mf_wevent map_passable? unless $@
  def map_passable?(x, y, d)
      return $game_map.ship_passable?(x, y) if @event.name.include?('<water>')
      return mf_wevent(x, y, d)
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/on-water-events.44530/