On Water Events

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
183
First Language
Meowish
Primarily Uses
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.



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.

      


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:

#==============================================================================# ■ 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.
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,145
Reaction score
815
First Language
Hungarian
Primarily Uses
RMVXA
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.

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.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
183
First Language
Meowish
Primarily Uses
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 :D
 
Last edited by a moderator:
Joined
Sep 9, 2015
Messages
297
Reaction score
28
First Language
English
Primarily Uses
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
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
183
First Language
Meowish
Primarily Uses
Thanks! Glad you find it useful! :D
 
Joined
Sep 9, 2015
Messages
297
Reaction score
28
First Language
English
Primarily Uses
Heck yeah! But now im just wondering. Will this cause like any lag since im assuming thats its constantly updating for a check? XD
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
183
First Language
Meowish
Primarily Uses
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.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
183
First Language
Meowish
Primarily Uses
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Ami
--- Diary ---

M.Mage: It's the F.Mage's Diary. While she isn't here,i can read it.

May, 10: I'm hurt after the battle with the Minotaur. But luckily,F.Healer heal me with her Heal-2. That why,i Fall in Love with her.

M.Mage: Eh???
So... some of my Desktop hardware has kicked it apparently (still trying to figure out what and how at the moment :/ ) .... yay?
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
Made a HUGE (YYOOOOJJ) Update to Monstructs and moving towards a Steam Early Access release!
A skill type called: "Rumagic". The intention is Magic with Rum(that pirates drink)
Does it sound strange in English?

Forum statistics

Threads
104,221
Messages
1,004,799
Members
135,737
Latest member
julek
Top