Tsuki Vehicle Extend Addon - More "Airship" Type Vehicles

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
241
Reaction score
15
First Language
Portuguese
Primarily Uses
RMVXA
Good Morning / Day / Afternoon / Evening everyone.

I once again have a request

I'm using Tsuki's Vehicle Extend to create additional vehicles in my game. However, it doesn't seem to let me create a new vehicle type that functions like an airship.

I would like to create a second airship, but so far this only allows me to make more land vehicles.

Any help would be appreciated.


Ruby:
=begin
#==============================================================================
 ** Vehicle Extend
 Author: Tsukihime
 Date: May 25, 2012
------------------------------------------------------------------------------
 ** Change log
 May 25
   - initial release
------------------------------------------------------------------------------   
 This script allows you to add more vehicles into the game.
 Customization is a little complicated.
#==============================================================================
=end
$imported = {} if $imported.nil?
$imported["Tsuki_VehicleExtend"] = true
#==============================================================================
# ** Configuration
# NOTE:
# To set vehicle use $game_map.vehicles[vehicle_id].set_location(map_id, x, y)
#==============================================================================
module Tsuki
  module Vehicle_Extend
  
    # Key: vehicle symbol (must be unique)
    # vehicle ID (must be unique)
    # vehicle name
    # start_map_id, start_x, start_y
    # character sheet, character index
    # vehicle BGM, vehicle speed
    # "Front" type (whether it has to be in front of your character to board)
    Vehicle_Table = {
      :car => [3, "Car", 3, 5, 5, "0 - WR CAR", 0,"0 - WR Fields of Balance", 6, false]
    }
#==============================================================================
# ** Rest of the script.
#==============================================================================
    Vehicle_Types = Vehicle_Table.keys
    Front_Index = 9
  end
end

class Custom_Vehicle < RPG::System::Vehicle
  include Tsuki::Vehicle_Extend
 
  attr_accessor :vehicle_name
  attr_accessor :front
  def initialize(type)
    @type = type
    @id = 0
    setup
  end
 
  def setup
    data = Vehicle_Table[@type]
    @id = data[0]
    @vehicle_name = data[1]
    @start_map_id = data[2]
    @start_x = data[3]
    @start_y = data[4]
    @character_name = data[5]
    @character_index = data[6]
    @bgm = RPG::BGM.new(data[7])
    @speed = data[8]
    @front = data[9]
  end
end

class Game_Vehicle < Game_Character
  include Tsuki::Vehicle_Extend
 
  attr_reader :name
  attr_reader :type
  attr_reader :front
 
  alias :th_vehicle_extend_init_vehicle :initialize
  def initialize(type)
    @name = ""
    @type = type
    th_vehicle_extend_init_vehicle(type)
    init_custom_move_speed
  end
 
  alias :th_vehicle_extend_system_vehicle :system_vehicle
  def system_vehicle
    return Custom_Vehicle.new(@type) if Vehicle_Types.include?(@type)
    th_vehicle_extend_system_vehicle
  end
 
  alias :th_vehicle_extend_load_sys_settings :load_system_settings
  def load_system_settings
    th_vehicle_extend_load_sys_settings
    load_custom_settings if system_vehicle.is_a?(Custom_Vehicle)
  end
 
  def load_custom_settings
    @name = system_vehicle.vehicle_name
    @front = system_vehicle.front
  end
 
  def init_custom_move_speed
    @move_speed = Vehicle_Table[@type][8] if Vehicle_Types.include?(@type)
  end
end

class Game_Player < Game_Character
  include Tsuki::Vehicle_Extend
 
  alias :th_vehicle_extend_in_airship? :in_airship?
  def in_airship?
    th_vehicle_extend_in_airship? || (!Vehicle_Table[@vehicle_type][Front_Index] if Vehicle_Types.include?(@vehicle_type))
  end
  
  alias :th_vehicle_extend_get_on :get_on_vehicle
  def get_on_vehicle
    front_x = $game_map.round_x_with_direction(@x, @direction)
    front_y = $game_map.round_y_with_direction(@y, @direction)
    Vehicle_Types.each {|vtype|
      if Vehicle_Table[vtype][Front_Index]
        @vehicle_type = vtype if $game_map.vehicle_type_here(front_x, front_y) == vtype
      else
        @vehicle_type = vtype if $game_map.vehicle_type_here(x, y) == vtype
      end
    }
    th_vehicle_extend_get_on
  end
end

class Game_Map
  include Tsuki::Vehicle_Extend
 
  alias :th_vehicle_extend_create_map_vehicles :create_vehicles
  def create_vehicles
    th_vehicle_extend_create_map_vehicles
    create_custom_vehicles
  end
 
  alias :th_vehicle_extend_map_vehicle :vehicle
  def vehicle(type)
    return custom_vehicle(type) if Vehicle_Types.include?(type)
    th_vehicle_extend_map_vehicle(type)
  end
 
  def vehicle_type_here(x, y)
    @vehicles.each {|vehicle| return vehicle.type if vehicle.pos?(x, y) }
    return nil
  end
 
  def custom_vehicle(type)
    @vehicles[Vehicle_Table[type][0]]
  end
 
  def create_custom_vehicles
    Vehicle_Types.each do |vtype|
      @vehicles << Game_Vehicle.new(vtype)
    end
  end
 
  def vehicle_passable?(type, x, y)
  end
end
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,668
Reaction score
566
First Language
English
Primarily Uses
RMVXA
Look for Shenwolf Multi vehicles script.
I got it from a demo in the steam vx ace workshop.
 

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

Latest Threads

Latest Profile Posts

Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect
I have gathered enough feedback from a few selected people. But it is still available if you want to sign up https://forums.rpgmakerweb.com/index.php?threads/looking-for-testers-a-closed-tech-demo.130774/

Forum statistics

Threads
105,992
Messages
1,018,190
Members
137,772
Latest member
Kirakirna
Top