[RMVX ACE] WAY TO CHECK IF PLAYER IS ON A BOAT/SHIP?

Posts

Pages: 1
unity
You're magical to me.
12540
The situation I am working on: You have, say, a boat that looks like a surfboard, and when you get on that surfboard, the surfboard's sprite transforms to a sprite of the hero riding the surfboard, and when you get off, the surfboard goes back to having a sprite of an empty surfboard.

I know how to change the ship/boat's graphic via an event, and I thought that maybe I could pull it off if I made every bit of water a certain region, and had a parallel process that checks if you're on that region, and if you are, changes the ship/boat sprite to look like you're riding the surfboard, and if you're not, changes the ship/boat to look like an empty surfboard.

My question is, is this the best way to do this? Is there an easier way to do this? Is there a script call that could make this easier (like something that checks if you're on the ship/boat? I'm not very experienced with conditional script calling like that) or some other way to do this that I'm missing?

Thanks a lot! ^_^
I threw together a quick script that when the player gets on a vehicle it'll change it's graphic to another, and restore it to what it was before when the player gets off. Currently only supports changing each vehicle to one hardcoded type but that can always be changed. Demo project here.

Just change the corresponding
vehicle.set_graphic("Vehicle", 7)

For each vehicle. "Vehicle" is the name of the character set to use, index is the 0-7 (0 upper left, 3 upper right, 4 bottom left, 7 bottom right) position to use. If it's a $characterset file... probably index 0? idk how it does that.

Script c/p:
class Game_Player < Game_Character
  
  alias :update_vehicle_get_on_change_gfx :update_vehicle_get_on unless $@
  def update_vehicle_get_on
    # Call original method to do core geton stuff
    update_vehicle_get_on_change_gfx
    
    # Wait until the hero is done getting on the vehicle
    if !@followers.gathering? && !moving?
      # Then update the vehicle graphic based on what vehicle they're getting on
      case @vehicle_type
      when :boat
        #vehicle = $game_map.vehicles[0]
        vehicle.remember_current_graphic
        vehicle.set_graphic("Vehicle", 5) unless vehicle.nil?
      when :ship
        #vehicle = $game_map.vehicles[1]
        vehicle.remember_current_graphic
        vehicle.set_graphic("Vehicle", 6) unless vehicle.nil?
      when :airship
        #vehicle = $game_map.vehicles[2]
        vehicle.remember_current_graphic
        vehicle.set_graphic("Vehicle", 7) unless vehicle.nil?
      end
    end
  end
  
  alias :update_vehicle_get_off_change_gfx :update_vehicle_get_off unless $@
  def update_vehicle_get_off
    # Remember our current vehicle, it can change between calling the
    # original method
    vehicle_temp = vehicle
    
    # Call original method to do core getoff stuff
    update_vehicle_get_off_change_gfx
    
    # Wait until the hero is done getting off the vehicle
    if !@followers.gathering? && vehicle_temp.altitude == 0
      # Then update the vehicle graphic based on what vehicle they're getting off
      vehicle_temp.restore_remembered_graphics unless vehicle_temp.nil?
    end
  end
  
end

class Game_Vehicle < Game_Character
  
  # Remember the current vehicle graphics and store them
  def remember_current_graphic
    @remembered_character_name = @character_name
    @remembered_character_index = @character_index
  end
  
  # Call this to restore a vehicle to the remembered settings
  def restore_remembered_graphics
    @character_name = @remembered_character_name 
    @character_index = @remembered_character_index 
  end
end
SunflowerGames
The most beautiful user on RMN!
13323

Event

Player Touch

Have an actor that's just a surfboard
Have an actor in database look like character with surfboard

(Add and remove party members accordingly to make picture match.)
unity
You're magical to me.
12540
author=GreatRedSpirit
I threw together a quick script that when the player gets on a vehicle it'll change it's graphic to another, and restore it to what it was before when the player gets off. Currently only supports changing each vehicle to one hardcoded type but that can always be changed. Demo project here.

Just change the corresponding
vehicle.set_graphic("Vehicle", 7)

For each vehicle. "Vehicle" is the name of the character set to use, index is the 0-7 (0 upper left, 3 upper right, 4 bottom left, 7 bottom right) position to use. If it's a $characterset file... probably index 0? idk how it does that.



GRS, you are amazing ;_; Seriously, thank you so much!

author=kory_toombs
Event

Player Touch

Have an actor that's just a surfboard
Have an actor in database look like character with surfboard

(Add and remove party members accordingly to make picture match.)


The problem with that is it doesn't take into account the ability to move in water that a ship has. You'd change the actor but be unable to move afterwards.
SunflowerGames
The most beautiful user on RMN!
13323

In movement route can't you change to through?
(I thought there as some way to do this?)
Marrend
Guardian of the Description Thread
21806
Wouldn't changing the "Party" character to have a "Through" move-route cause the player to move through all objects? It wouldn't just be the terrain that the boat/ship would normally be able to move on.

*Edit: Not to mention being able to traverse on tiles that would normally be impassible if a player is riding the boat/ship.
SunflowerGames
The most beautiful user on RMN!
13323

Not if you use a script by Yanfly that blocks all players and events, even with through on!
Pages: 1