Automatic Boat Call
I updated your code for Ace if you don't mind so others can use it. It did make a few changes being a professional programmer. So here you go so you can post the update (please take all the credit given that it is your idea and original work). Good job by the way for VX.Code:
module CallBoatConfig# The item that must be in inventory for the boat to be called ITEM_ID = 147 # If this is set to "true", a map name must include this text: # # <boat> # # in order for the boat to be called automatically. USE_BOAT_REQ = true # If this is set to "true", an animation will play # when the player gets on or off the boat. USE_ANIMATION = true # The animation displayed when the player gets on the # boat if USE_ANIMATION is set to "true". ON_ANIMATION_ID = 75 # The animation displayed when the player gets off of the # boat if USE_ANIMATION is set to "true". OFF_ANIMATION_ID = 75 # If this is set to "true", the boat will # disappear when the player gets off of it. REMOVE_VEHICLE = true endclass Game_Vehicle attr_accessor :direction endclass Game_Mapalias :eds_pre_call_setup :setup def setup(map_id) eds_pre_call_setup(map_id) @info = load_data("Data/MapInfos.rvdata2") enddef can_use_boat? return true unless CallBoatConfig::USE_BOAT_REQ return @info[@map_id].name.downcase.include?("<boat>") endendclass Game_Player < Game_Character include CallBoatConfigdef get_directional_pos(d) x, y = 0, 0;case(d) when 8 #up y, x = @y - 1, @x; when 2 #down y, x = @y + 1, @x; when 6 #right x, y = @x + 1, @y; y = @y when 4 #left x, y = @x - 1, @y; end return x, y; end def should_call_boat?(d)x, y = get_directional_pos(d);if ($game_map.can_use_boat? && $game_party.items.include?($data_items) && $game_map.boat_passable?(x, y) && !@vehicle_getting_on && !in_boat?) auto_call_boat(x, y); return true; endreturn false; enddef auto_call_boat(x, y) $game_map.boat.direction = $game_player.direction; $game_map.boat.set_location($game_map.map_id, x, y); if(USE_ANIMATION) $game_map.boat.animation_id = ON_ANIMATION_ID end get_on_vehicle end #-------------------------------------------------------------------------- # * Move Up #-------------------------------------------------------------------------- alias _move_straight move_straight def move_straight(d, turn_ok = true) _move_straight(d, turn_ok) unless should_call_boat?(d); end #-------------------------------------------------------------------------- # * Move Right #-------------------------------------------------------------------------- alias _move_diagonal move_diagonal def move_diagonal(d, turn_ok = true) _move_diagonal(d, turn_ok) unless should_call_boat?(d); end#-------------------------------------------------------------------------- # * Get Off Vehicle #-------------------------------------------------------------------------- alias _get_off_vehicle get_off_vehicle def get_off_vehicle in_boat = (@vehicle_type == 0); _get_off_vehicle(); if REMOVE_VEHICLE $game_map.boat.set_location(-1, -1, -1) if USE_ANIMATION $game_map.boat.animation_id = 75; end end endend
本贴来自国际rpgmaker官方论坛作者:RCS_2012处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/automatic-boat-call.606/
页:
[1]