VPassengersLimit XP
#1
VPassengersLimit XP
The Unofficial Super Simple Vehicle System Add On

by Kyonides Arkanthes

Introduction

Thinking Did you ever want to limit a furry werewolf's script called Super Simple Vehicle System in a curious way?

Shocked Now you can with this add for it lets you set the maximum passengers capacity of any vehicle.

The Scriptlet

Code:
# * VPassengersLimit XP
#   Unofficial Super Simple Vehicle System Add On
#   Scripter : Kyonides Arkanthes
#   2021-08-17

# This scriptlet adds a passengers limit to the vehicle system.
# It also displays an in game warning if the party tries to embark on a journey.

# * Overwritten Method * #
# Game_Player#update_vehicle_detect_boarding?

# * Aliased Method * #
# Game_Player#update
# Window_Message#update

module Vehicles
# Indexes 5 - Speed, 6 - Step Animation, 7 - Maximum No. of Actors on board
  VEHICLE['Canoe'][5..7] = [false, 0, 2]
  VEHICLE['Boat'][5..7] = [false, 0, 3]
  PARTY_SIZE_ERROR = "The %s is not large enough for all heroes\n" +
   "to embark.\nVehicle's maximum capacity: %s"
end

class Game_Temp
  attr_accessor :embark_failed
end

class Game_Party
  def size() @actors.size end
end

class Game_Player
  alias :kyon_vpasslim_gm_player_up :update
  def update
    return true if $game_temp.embark_failed
    kyon_vpasslim_gm_player_up
  end

  def check_char_event_dir(event_x, event_y)
    case @direction
    when 1 ; return true if event_x == @x-1 and event_y == @y+1
    when 2 ; return true if event_x == @x+0 and event_y == @y+1
    when 3 ; return true if event_x == @x+1 and event_y == @y+1
    when 4 ; return true if event_x == @x-1 and event_y == @y+0
    when 6 ; return true if event_x == @x+1 and event_y == @y+0
    when 7 ; return true if event_x == @x-1 and event_y == @y-1
    when 8 ; return true if event_x == @x+0 and event_y == @y-1
    when 9 ; return true if event_x == @x+1 and event_y == @y-1
    end
    return false
  end

  def stop_embark(name, limit)
    $game_system.se_play($data_system.buzzer_se)
    $game_temp.message_text = sprintf(Vehicles::PARTY_SIZE_ERROR, name, limit)
    $game_temp.embark_failed = true
  end

  def update_vehicle_detect_boarding?
    return true if $game_temp.embark_failed
    return false unless $game_system.vehicle_current.nil?
    return false unless Input.trigger?(Vehicles::BOARD_INPUT)
    veh_key = nil
    veh_id  = 0
    for event in $game_map.events.values
      next if event.nil? or event.erased
      next unless event.name =~ Vehicles::VEHICLE_FORMULA
      check_type = false
      if event.through
        check_type = (event.x == @x and event.y == @y)
      else
        check_type = check_char_event_dir(event.x, event.y)
      end
      next unless check_type
      veh_key = $1
      veh_id  = event.id
      break
    end
    if veh_id != 0
      if (v = Vehicles::VEHICLE[veh_key])
        max = v[7]
        return stop_embark(veh_key, max) if max and $game_party.size > max
        update_vehicle_board_peform(veh_key, veh_id)
      end
    end
    return true
  end
end

class Window_Message
  alias :kyon_vpasslim_win_mess_up :update
  def update
    if @contents_showing and $game_temp.embark_failed
      if Input.trigger?(Input::B) or Input.trigger?(Input::C) or
         Input.trigger?(Vehicles::BOARD_INPUT)
        $game_system.se_play($data_system.cancel_se)
        $game_temp.embark_failed = nil
        terminate_message
        return
      end
    end
    kyon_vpasslim_win_mess_up
  end
end


Terms & Conditions

Happy with a sweat You know, it is the usual inclusion in your game credits. You can use it free of charge.
Yet, I could charge you Cash for it if that is what you wish. Laughing
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: 2 Guest(s)