The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on June 23, 2008, 02:10:52 AM

Title: Baldur's Gate Travel System
Post by: modern algebra on June 23, 2008, 02:10:52 AM
Baldur's Gate Travel System
Version: 1.0
Author: modern algebra
Date: June 20, 2008

Version History



Description


This script is an alternative to World Map Travel and calls a menu so that the player may choose their next destination. It also allows for ambushes in the course of this journey.

Features


Screenshot

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg261.imageshack.us%2Fimg261%2F2931%2Ftravelscriptyn8.png&hash=27989d441b18416c757e2bce618e95471fc48949)

Instructions

Please see inside the script. Customization and Setup can be difficult, so read through all of the instructions in the script carefully.

Script


Script is too long. Please retrieve it from the demo or the text document.

Addon

Spoiler for Easy Way to Remove/Add Destinations In-Game:

This Addon allows you to add and remove destinations in-game much easier. Please see inside the header of the Addon for instructions.


Code: [Select]
#==============================================================================
#  Easy Remove/Add Destination
#  ADDON for Baldur's Gate Travel System
#  Author: modern algebra (rmrk.net)
#  Version 1.0
#  April 28, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    While you could change destinations before, this makes it a little easier
#   to do. Now, all you need to do is use these commands:
#
#    remove_destination (map_id, destination_map_id, travel_type)
#
#      :map_id: is the ID of the map from which the destination can be accessed
#      :destination_map_id: is the ID of the destination to remove
#      :travel_type: the type of travel from which it can be accessed.
#    
#    add_destination (map_id, destination_id, destination_xyd, travel_type, price)
#
#      :map_id: is the ID of the map from which the new destination is accessed
#      :destination_id: is the ID of the new destination to add
#      :destination_xyd: is the XYD coordinates that selecting that destination
#         teleports you to.
#      :travel_type: the type of travel from which it can be accessed.
#      :price: the amount it costs to travel
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Destination
  #    map_id      : is the ID of the map from which the new destination is
  #                  accessed
  #    dest_id     : is the ID of the new destination to add
  #    dest_xyd    : is the XYD coordinates that selecting that destination
  #                  teleports you to.
  #    travel_type : the type of travel from which it can be accessed.
  #    price       : the amount it costs to travel
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_destination (map_id, dest_id, dest_xyd, travel_type, price = 0)
    # Get Map Travel Data
    data = $game_system.travel_data[map_id]
    # Do not add destination if it is already there.
    return if data.dests[travel_type].include? (dest_id)
    # Set up location data.
    data.dests[travel_type].push (dest_id)
    data.dest_xyd[travel_type].push (dest_xyd)
    data.prices[travel_type].push (price) if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[travel_type] != 0
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Remove Destination
  #    map_id      : is the ID of the map from which the destination can be
  #                  accessed
  #    dest_id     : is the ID of the destination to remove
  #    travel_type : the type of travel from which it can be accessed.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def remove_destination (map_id, dest_id, travel_type)
    # Get Map Travel Data
    data = $game_system.travel_data[map_id]
    # Do not remove destination if it is not there.
    return unless data.dests[travel_type].include? (dest_id)
    index = data.dests[travel_type].index (dest_id)
    # Remove this destination from the list
    data.dests[travel_type].delete_at (index)
    data.dest_xyd[travel_type].delete_at (index)
    data.prices[travel_type].delete_at (index) if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[travel_type] != 0
  end
end

Credit



Thanks


Support


Please post here for support

Demo


See attached.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Baldur's Gate Travel System
Post by: SouthWall on July 02, 2008, 04:14:22 AM
I downloaded the demo. This looks really good, thanks.

I was wondering, is there a way to replace the image of a location with a town description or something like that? (or maybe have both?)
Title: Re: Baldur's Gate Travel System
Post by: modern algebra on July 02, 2008, 10:53:53 AM
No, not in this version.
Title: Re: Baldur's Gate Travel System
Post by: SouthWall on July 02, 2008, 12:20:10 PM
Okay, thanks.
Title: Re: Baldur's Gate Travel System
Post by: Leventhan on July 03, 2008, 10:08:25 AM
How come I missed this ;-;
Great script! Now I can make Disgaea-ish games and avoid making world maps. ;8

+rep
Title: Re: Baldur's Gate Travel System
Post by: Darkie on April 19, 2009, 03:44:43 AM
Bringing this baby back from the dead. =)

... because it is an awesome script!

----

with the exception of a few small things...

... I'm a little unsettled by the fact that all destinations are categorized by map ID via an unchangeable script (with absolutely no possibility of change in-game. In other words... (for example) after defeating a level or a series of events, you can't add on, or subtract destinations from a list)

With little knowledge I have for scripting, I've tried using an Event => Script dealy in attempt to change some values in-game, but they all come out in error.

I say that the concept behind this travel system is awesome, and completely erases the need for a world map forever! =)

... I just wish I could get it to work for my needs. =(
Title: Re: Baldur's Gate Travel System
Post by: modern algebra on April 19, 2009, 08:16:49 PM
You can, I just didn't make it explicit. These commands in a call script can alter destinations:

Code: [Select]
data = $game_system.travel_data
data[map_index].dests = [x, y, z]

That would completely redefine the array. If you do not wish to redefine the array, then you can just delete with:

Code: [Select]
data = $game_system.travel_data
data[map_index].dests.delete (x)
where x is the ID of the map you want to delete from the destinations list

or to add:

Code: [Select]
data = $game_system.travel_data
data[map_index].dests.push (x)
where x is the ID of the map you want to add to the destinations list

Of course, you would also need to delete the other data. They are all accessible in ways like this:

Code: [Select]
$game_system.travel_data[map_index].travel_types
$game_system.travel_data[map_index].dests
$game_system.travel_data[map_index].dest_xyd
$game_system.travel_data[map_index].prices
$game_system.travel_data[map_index].enemy_troops
$game_system.travel_data[map_index].image
Title: Re: Baldur's Gate Travel System
Post by: modern algebra on April 28, 2009, 07:30:24 PM
Hmm, to make it easier to remove and add destinations, I have made a script that uses the call script commands:

Code: [Select]
add_destination
and
Code: [Select]
remove_destination

Please see inside the addon header for more details.

Code: [Select]
#==============================================================================
#  Easy Remove/Add Destination
#  ADDON for Baldur's Gate Travel System
#  Author: modern algebra (rmrk.net)
#  Version 1.0
#  April 28, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    While you could change destinations before, this makes it a little easier
#   to do. Now, all you need to do is use these commands:
#
#    remove_destination (map_id, destination_map_id, travel_type)
#
#      :map_id: is the ID of the map from which the destination can be accessed
#      :destination_map_id: is the ID of the destination to remove
#      :travel_type: the type of travel from which it can be accessed.
#   
#    add_destination (map_id, destination_id, destination_xyd, travel_type, price)
#
#      :map_id: is the ID of the map from which the new destination is accessed
#      :destination_id: is the ID of the new destination to add
#      :destination_xyd: is the XYD coordinates that selecting that destination
#         teleports you to.
#      :travel_type: the type of travel from which it can be accessed.
#      :price: the amount it costs to travel
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Destination
  #    map_id      : is the ID of the map from which the new destination is
  #                  accessed
  #    dest_id     : is the ID of the new destination to add
  #    dest_xyd    : is the XYD coordinates that selecting that destination
  #                  teleports you to.
  #    travel_type : the type of travel from which it can be accessed.
  #    price       : the amount it costs to travel
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_destination (map_id, dest_id, dest_xyd, travel_type, price = 0)
    # Get Map Travel Data
    data = $game_system.travel_data[map_id]
    # Do not add destination if it is already there.
    return if data.dests[travel_type].include? (dest_id)
    # Set up location data.
    data.dests[travel_type].push (dest_id)
    data.dest_xyd[travel_type].push (dest_xyd)
    data.prices[travel_type].push (price) if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[travel_type] != 0
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Remove Destination
  #    map_id      : is the ID of the map from which the destination can be
  #                  accessed
  #    dest_id     : is the ID of the destination to remove
  #    travel_type : the type of travel from which it can be accessed.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def remove_destination (map_id, dest_id, travel_type)
    # Get Map Travel Data
    data = $game_system.travel_data[map_id]
    # Do not remove destination if it is not there.
    return unless data.dests[travel_type].include? (dest_id)
    index = data.dests[travel_type].index (dest_id)
    # Remove this destination from the list
    data.dests[travel_type].delete_at (index)
    data.dest_xyd[travel_type].delete_at (index)
    data.prices[travel_type].delete_at (index) if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[travel_type] != 0
  end
end
Title: Re: Baldur's Gate Travel System
Post by: Okogawa on December 09, 2009, 11:00:21 AM
As of late I have a need to implement a much more simplified version of this script into my project, yet I cannot follow specific instructions given to me by a coder to "make" the changes.

Can anyone in here please inspect the topic and maybe assist me: http://www.rpgmakervx.net/index.php?showtopic=23682&st=0#entry211966 (http://www.rpgmakervx.net/index.php?showtopic=23682&st=0#entry211966)

Feel free to post the altered script in here, there or directly on my email: okogawa@hotmail.com

EDIT: I read your replay and are very happy that the very maker of the script might take a look at it. But then again, real-life go 1st, and after all, its our studies who make our real-life (and in the long turn others if I am allowed to be philosophical) better... ;D I'll monitor this page tho...

Cheers

O.
Title: Re: Baldur's Gate Travel System
Post by: modern algebra on December 09, 2009, 03:11:51 PM
I'll take a look when I can, but it might not be until after the 18. Exams and stufferz
Title: Re: Baldur's Gate Travel System
Post by: Okogawa on December 24, 2009, 07:44:50 PM
Christmas bump for a simplified travel system (when there might be some spare time over for it ofc)  ;D

Cheers!

O.
Title: Re: Baldur's Gate Travel System
Post by: modern algebra on December 29, 2009, 05:22:37 PM
There appears to have been a reply in that topic that did what you wanted. I didn't check it, but is what that person did not sufficient for your purposes?
Title: Re: Baldur's Gate Travel System
Post by: Okogawa on December 29, 2009, 09:37:44 PM
Oh... sorry, missed my original post! Aye, it works great... but truth be known: - it's your map-system, just a "lite" version now  :lol: so the credit still goes your way.

Thanks alot for making this addon btw

Happy new year...

O

I'll be back...
Title: Re: Baldur's Gate Travel System
Post by: Okogawa on January 01, 2010, 08:21:32 PM
Special Request!

The modified script I requested later works great, and I'll even post it here for reference since I would (if possible) like two modifications. One tweak should be easy to do, while the other is (gently put) a bit odd ;)

Here is the modified Baldur's Gate Travel System Light script:

Spoiler for:
Code: [Select]
#==============================================================================
# Baldur's Gate Travel System (this is an ALTERED version!!!!!!!!)
# Version 1.0
# Author: modern algebra
# Date: June 21, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Thanks:
# Baldur's Gate for original concept I thought of while making the script
# Anaxim for the request and the details of the scene, including a different
# design scheme and a number of different features from Baldur's Gate
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Call this scene using the Script event command with this code:
# $scene = Scene_TravelMenu.new
#
# To change a map's stats at any time, you can use the code:
# $game_system.travel_data[map_index].<command> = new stat
#
# The possible commands are:
# $game_system.travel_data[map_index].travel_types
# $game_system.travel_data[map_index].dests
# $game_system.travel_data[map_index].dest_xyd
# $game_system.travel_data[map_index].prices
# $game_system.travel_data[map_index].enemy_troops
# $game_system.travel_data[map_index].image
#
# The correct format for any of those values is located in the comments
# starting at line 120. You can also use the command:
#
# $game_system.travel_data[map_index].reset
#
# To restore it to the values you set here in the script editor
#
# To configure this script read all of the directions from line 39-88 and
# from 124-194
#
# Fixed text-merge bug at line: 517
#
# To change window aspects:
# Left window:
# line 488 = changes window width, for traveloptions_height, I use 320
# line 498 = changes marker width, I use 288
# Right window:
# line 458 = changes window width, I use 320

#==============================================================================

module ModAlg_Travel
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Constants
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# The words you want to represent each travel option. Note that the index for
# each word is retained as the index for that travel type. The default is
# ['Walk', 'Stage Coach', 'Teleport'], so travel types are:
# 0 => Walk, 1 => Stage Coach, and 2 => Teleport
VOCAB_TRAVELOPTIONS = ['Walk', 'Stage Coach', 'Teleport']
# How many possibilities for random encounter by travel type. The default is
# [3, 1, 0], which means that Walking will draw three possibilities for
# being ambushed (meaning you can get into a maximum of three battles),
# Stage Coach will draw 1, and Teleport will draw 0

# TRAVELOPTIONS_AMBUSHES = [3, 1, 0]
TRAVELOPTIONS_AMBUSHES = [0, 0, 0]

# The Chance for each possible ambush to result in an actual ambush, in
# percentile. The default is [50, 50, 0], which means that for walking or
# stage coach, the chance of being ambushed is 50% for each possibility. So,
# with default settings, Walking will have three chances of being ambushed
# at 50% chance each time, etc...

# TRAVELOPTIONS_AMBUSH_CHANCE = [50, 50, 0] # Chance of encounters
TRAVELOPTIONS_AMBUSH_CHANCE = [0, 0, 0] # Chance of encounters

# There are three Payment types - 0 => Nothing, 1 => Money, 2 => MP. You must,
# for each travel type, set what type of payment is expected. By default, the
# option is [0, 1, 2], which means that walking costs nothing, Stage Coach
# costs money, and Teleport costs mp
TRAVELOPTIONS_PAYMENT = [0, 1, 2]
# Sound Effect to be played when destination selected for each option.
# The default is ['Move', 'Horse', 'Teleport'], so it plays the Move SE when
# walking somewhere, the Horse SE when Stage Coach, and the Teleport SE when
# teleporting
TRAVELOPTIONS_SE = ['Move', 'Horse', 'Teleport']
# This only applies for Travel types of Payment Option 2, and it is the ID of
# the skill required to cast Teleport. Having the skill is necessary before
# you can teleport anywhere. If, you had more than one travel type with
# payment option 2 (MP), then the array would need to have two elements.
# Elements can be repeated if you want the same skill to enable more than
# one type of Teleport
TELEPORT_SKILL_IDS = [83]
# This is the Sentence that comes up before you are attacked while travelling.
# There are three special message codes you can use:
# \nt - Shows the name of the ambushing troop
# \nl - the name of the location you are leaving
# \nd - the name of the location you are going to
AMBUSH_NOTE = 'You have been waylaid by \nt and must defend yourself'
# This is the name of the SE played when ambushed
AMBUSH_SE = "Darkness5"
RECOVER_HP_AFTER_AMBUSH = true # Recover HP after battle?
RECOVER_SP_AFTER_AMBUSH = true # Recover SP after battle?
RECOVER_CONDITIONS_AFTER_AMBUSH = true #Recover States after battle?
# Should the script remember the last travel type and assume it favoured (true),
# or should it force the player to choose at the start of the scene (false)?
TRAVEL_TYPE_MEMORY = true
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ** Location
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Location
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :id # The Map ID of the location
attr_reader :name # The name of the location
attr_accessor :image # An image representing the location
attr_accessor :dests # An Array containing map IDs of all destinations
attr_accessor :dest_xyd # A 2D array with corresponding x, y, d arrival data
attr_accessor :prices # An array with prices corresponding to dests
attr_accessor :enemy_troops # An array with all monster troops near this location
attr_accessor :travel_types # The types of travel available from this map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
# id : the ID of the location
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def setup (id)
@id = id
data = load_data("Data/MapInfos.rvdata")
@name = data[id].name
@travel_types = []
@prices = []
@dests = []
@dest_xyd = []
for i in 0...VOCAB_TRAVELOPTIONS.size
@travel_types.push (i)
@dests[i] = []
@dest_xyd[i] = []
@prices[i] = []
end
@enemy_troops = []
@image = ''
#--------------------------------------------------------------------
# Default values for everything:
# @id : map ID
# @name : name of map with that ID
# @travel_types : all possible types
# @dests : [] for all @travel_types
# @dest_xyd : [] for all @travel_types
# @prices : [0, etc..] for all @travel_types
#*********************************************************************
# So what are all of those?
# @id corresponds to the ID of the map. When you call Scene_TravelMenu,
# it calls the Location object that is married to it's ID.
# @name is the map name that you set in the editor for that ID
# @travel_types is a list of the IDs of all types of travel available
# from this location. Travel types correspond to VOCAB_TRAVELOPTIONS,
# and so if that is ['Walk', 'Stage Coach', 'Teleport'], then
# travel type 0 is Walk, travel type 1 is Stage Coach, and travel
# type 2 is Teleport. Thus, If @travel_types = [0, 2], it means that
# you can only choose walk or teleport from this location. Stage
# coach would be unavailable in this map.
# @dests is a 2D array separated by travel type. For each valid travel
# type, you should set an array containing the IDs of all maps
# that you can travel to from this map using that type of travel.
# @dest_xyd is a list that is married to @dest, and it determines the
# xy location of your arrival to the map in @dest with corresponding
# index, as well as indicating the direction to face. The format for
# each location is [x, y, direction], where x and y are integer
# values indicating square to teleport to and direction is either
# 'D' for down, 'U' for up, 'L' for left, or 'R' for right. Thus, an
# example is [0, 4, 'D']. One of these must be there for every
# possible destination by any possible travel type.
# @prices is a list also married to @dests, and it holds the cost of
# travelling to the location in @dest with corresponding index. It is
# unnecesary to set this for any travel type with payment option 0,
# but it will be 0 for
# @enemy_troops is a list of enemy troop IDs you encounter if you choose
# to travel TO, not from, this destination.
# @image is a string with the name of a picture in the Pictures folder.
# It is the picture shown when scrolling over this destination.
#-----------------------------------------------------------------------
case id
#//////////////////////////////////////////////////////////////////////
# EDITABLE REGION ///////////////////////////////////////////////
#////////////////////////////////////////////////////////////////////
# Set up all locations from which you can travel in this format:
# when <map ID>
# EXAMPLE: when 2
# @travel_types = [<ID of each type of travel>]
# EXAMPLE: @travel_types = [0, 1]
# @dests[travel_id] = [ <map IDs of each destination> ]
# EXAMPLE: @dests[0] = [1, 4]
# @dests[1] = [3, 4]
# @dest_xyd[travel_id] = [ <[x, y, d]>, for all destinations ]
# EXAMPLE: @dest_xyd[0] = [ [0, 8, 'R'], [11, 0, 'D'] ]
# @dest_xyd[1] = [ [16, 7, 'L'], [11, 12, 'U'] ]
# @prices[travel_type_id] = [ <cost of travel for each destination> ]
# EXAMPLE: @prices[1] = [150, 200]
# NB: Prices for Payment option 1 are always fixed amounts of Gold.
# For Payment Option 2 (Mana), you can set either a percentage
# or a fixed amount. For a percentage, put any number between
# 0 and 100 and it will use it as a percentage. For a fixed
# cost of mana, make the number greater than 100 and the script
# will subtract 100 to get actual cost. Thus, 110 is 10 mana
# cost, 250 is 150 mana cost, and 10 is 10% of the actor's mana.
# @enemy_troops = [ <IDs of all troops to be encountered coming TO this location> ]
# EXAMPLE: @enemy_troops = [3, 4, 6]
# @image = 'Name of Image in Picture folder'
# EXAMPLE: @image = '005-Beach01'
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# The following are examples. Feel free to delete them once you
# understand how to set a Travel Location

# when 1 # I
# @dests[0] = [2, 5]
# @dests[1] = [3]
# @dests[2] = [3, 4, 5]
# @dest_xyd[0] = [ [8, 12, 'U'], [7, 12, 'U'] ]
# @dest_xyd[1] = [ [11, 0, 'D'] ]
# @dest_xyd[2] = [ [13, 4, 'D'], [8, 10, 'D'], [4, 8, 'L'] ]
# @prices[1] = [100] # Gold Cost for Stage Coach
# @prices[2] = [10, 10, 10] # Mana cost for Teleport
# @enemy_troops = [1, 2, 3]
# @image = '015-ForestTown01'

when 1 # I - Map 1: Brecilian Forest
@dests[0] = [1, 2]
# @dests[1] = [3]
# @dests[2] = [3, 4, 5]
@dest_xyd[0] = [ [7, 10, 'U'], [1, 1, 'D'], [1, 1, 'L'], [1, 1, 'R'] ]
# @dest_xyd[1] = [ [11, 0, 'D'] ]
# @dest_xyd[2] = [ [13, 4, 'D'], [8, 10, 'D'], [4, 8, 'L'] ]
@prices[1] = [100] # Gold Cost for Stage Coach
@prices[2] = [10, 10, 10] # Mana cost for Teleport
@enemy_troops = [1, 2, 3]
@image = 'TEMP1'

when 2 # II (Map Name - it is useful to write it as a reminder)
@travel_types = [0, 1]
@dests[0] = [1, 4]
@dests[1] = [3, 4]
@dest_xyd[0] = [ [0, 8, 'R'], [11, 0, 'D'] ]
@dest_xyd[1] = [ [16, 7, 'L'], [11, 12, 'U'] ]
@prices[1] = [150, 200] # Gold Cost for Stage Coach
@enemy_troops = [3, 4, 5]
@image = 'TEMP2'
when 3 # III
@dests[0] = [4, 5]
@dests[1] = [1, 2, 4, 5]
@dests[2] = [1, 4, 5]
@dest_xyd[0] = [ [11, 12, 'U'], [7, 12, 'U'] ]
@dest_xyd[1] = [ [10, 0, 'D'], [8, 12, 'U'], [11, 12, 'U'], [7, 12, 'U'] ]
@dest_xyd[2] = [ [10, 7, 'D'], [8, 10, 'D'], [4, 8, 'L'] ]
@prices[1] = [100, 150, 250, 400] # Gold Cost for Stage Coach
@prices[2] = [10, 10, 10] # Mana cost for teleport
@enemy_troops = [5, 6]
@image = 'TEMP'
when 4 # IV
@dests[0] = [2, 3, 5]
@dests[1] = [2, 3, 5]
@dests[2] = [1, 3, 5]
@dest_xyd[0] = [ [8, 12, 'U'], [16, 8, 'L'], [7, 12, 'U'] ]
@dest_xyd[1] = [ [8, 12, 'U'], [11, 0, 'D'], [7, 12, 'U'] ]
@dest_xyd[2] = [ [10, 7, 'D'], [13, 4, 'D'], [4, 8, 'L'] ]
@prices[1] = [200, 250, 200] # Gold Cost for Stage Coach
@prices[2] = [220, 250, 210] # Mana Cost for teleport
@enemy_troops = [1, 2, 3, 4, 5]
@image = '008-Snowfield01'
when 5 # V
@dests[0] = [1, 3, 4]
@dests[1] = [1, 3, 4]
@dests[2] = [1, 3, 4]
@dest_xyd[0] = [ [0, 0, 'D'], [16, 8, 'L'], [11, 0, 'D'] ]
@dest_xyd[1] = [ [0, 0, 'D'], [11, 0, 'D'], [11, 12, 'U'] ]
@dest_xyd[2] = [ [10, 7, 'D'], [13, 4, 'D'], [8, 10, 'D'] ]
@prices[1] = [100, 200] # Gold Cost for Stage Coach
@prices[2] = [10, 10, 10] # Mana cost for teleport
@enemy_troops = [4, 5]
@image = '016-ForestTown02'
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# END EDITABLE REGION \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
end
# Make sure all price values that matter exist
@travel_types.each { |i|
@prices[i] = [] if @prices[i] == nil
for j in 0...@dests[i].size
@prices[i][j] = 0 if @prices[i][j] == nil
end
}
end
#------------------------------------------------------------------------
# * Reset
#------------------------------------------------------------------------
def reset
setup (@id)
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ** Game_TravelData
#----------------------------------------------------------------------------
# This class is a wrapper for the "Hash" class. It holds in-game data about
# Travel Locations
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_TravelData
#------------------------------------------------------------------------
# * Object Initialization
#------------------------------------------------------------------------
def initialize
@data = {}
end
#------------------------------------------------------------------------
# * Get Location
#------------------------------------------------------------------------
def [] (map_id)
if @data[map_id] == nil
@data[map_id] = Location.new
@data[map_id].setup (map_id)
end
return @data[map_id]
end
end
end

#==============================================================================
# ** Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new instance variable - travel_data, last_travel_option
# aliased method - initialize
#==============================================================================

class Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :travel_data
attr_accessor :last_travel_option
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_anaxim_init_travel_4fd2 initialize
def initialize
# Run Original method
modalg_anaxim_init_travel_4fd2
@travel_data = ModAlg_Travel::Game_TravelData.new
@last_travel_option = 0
end
end

#==============================================================================
# ** Game_Temp
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new instance variables - num_ambushes, ambush_chance, ambush_troops
#==============================================================================

class Game_Temp
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :num_ambushes
attr_accessor :ambush_chance
attr_accessor :destination
attr_accessor :destination_xyd
attr_accessor :location
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_anaxim_trvl_ambush_init_3ht4 initialize
def initialize
# Run Original Method
modalg_anaxim_trvl_ambush_init_3ht4
# Initialize new instance variables
reset_travel_values
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Reset Travel Values
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def reset_travel_values
@num_ambushes = 0
@ambush_chance = 0
@destination = nil
@destination_xyd = []
@location = nil
end
end

#==============================================================================
# ** Window_TravelMana
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window shows the mana of the actor with teleport
#==============================================================================

class Window_TravelMana < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
# x : the x position of the window
# y : the y position of the window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (x, y)
super (x, y, 160, WLH + 32)
@teleport_actors = []
@last_travel_type = -1
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
# price : the mana cost percentage
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (travel_type, price)
return if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[travel_type] != 2
# Find which teleport skill is attached to this travel_type
port_type = 0
for i in 0...travel_type
port_type += 1 if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[i] == 2
end
# If teleport actors not already calculated
if travel_type != @last_travel_type
# Calculate teleport actors
@last_travel_type = travel_type
@teleport_actors.clear
teleport_skill = $data_skills[ModAlg_Travel::TELEPORT_SKILL_IDS[port_type]]
$game_party.members.each { |i|
@teleport_actors.push (i) if i.skill_learn? (teleport_skill)
}
end
contents.clear
return if @teleport_actors.empty?
# Sort by lowest mana total to highest
@teleport_actors.sort! { |a, b| a.maxmp <= b.maxmp }
@teleport_actors.each { |i|
price = price > 100 ? price - 100 : (i.maxmp.to_f*(price.to_f / 100.0)).to_i
if i.mp >= (price)
@actor = i
break
end
}
@actor = @teleport_actors[0] if @actor == nil
tw = [contents.text_size (@actor.name).width, 60].min
contents.draw_text (0, 0, tw, WLH, @actor.name)
draw_actor_mp (@actor, tw + 4, 0, 124 - tw)
end
end

#==============================================================================
# ** Window_TravelImage
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays an image, centred
#==============================================================================

class Window_TravelImage < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
#~ super (224, 0, Graphics.width - 224, Graphics.height)
super (320, 0, Graphics.width - 320, Graphics.height)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (image)
contents.clear
image = Cache.picture (image)
src_rect = Rect.new (0, 0, image.width, image.height)
x = (contents.width - src_rect.width) / 2
y = (contents.height - src_rect.height) / 2
contents.blt (x, y, image, src_rect)
end
end

#==============================================================================
# ** Window_DestinationList
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays the list of all possible destinations
#==============================================================================

class Window_DestinationList < Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
# location_id : the current map ID
# traveloptions_height : the height of the window above it
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (traveloptions_height)
@location = $game_system.travel_data[$game_map.map_id]
@disabled = []
#~ super (0, traveloptions_height, 224, Graphics.height)
super (0, traveloptions_height, 320, Graphics.height)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
# travel_type_id : the ID of the travel type selected
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (travel_type_id, teleport_actor = nil)
contents.clear
contents.dispose
#~ self.contents = Bitmap.new (192, @location.dests[travel_type_id].size*WLH)
self.contents = Bitmap.new (288, @location.dests[travel_type_id].size*WLH)
@disabled.clear
@item_max = @location.dests[travel_type_id].size
for i in 0...@location.dests[travel_type_id].size
destination = $game_system.travel_data[@location.dests[travel_type_id][i]]
contents.font.color.alpha = 255
if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[travel_type_id] == 1 # Gold
# Draw price
price = @location.prices[travel_type_id][i]
if $game_party.gold < price
@disabled.push (i)
contents.font.color.alpha = 160
end
contents.draw_text (contents.width - 40, i*WLH, 36, WLH, price, 2)
elsif ModAlg_Travel::TRAVELOPTIONS_PAYMENT[travel_type_id] == 2 # Mana
# Draw mana cost
price = destination.prices[travel_type_id][i]
price = price > 100 ? price - 100 : (teleport_actor.maxmp.to_f * (price.to_f / 100.0)).to_i
if teleport_actor.mp < price
@disabled.push (i)
contents.font.color.alpha = 160
end
contents.draw_text (contents.width - 36, i*WLH, 36, WLH, price, 2)
end
# Draw name of Destination
# contents.draw_text (0, i*WLH, contents.width - 44, WLH, destination.name)

# Fixed bug: Changed: 0 to 5 so text do not merge with border marker!
contents.draw_text (4, i*WLH, contents.width - 10, WLH, destination.name)
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Option Disabled?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def option_disabled?
return @disabled.include? (self.index)
end
end

#==============================================================================
# ** Window_VaryWidthHelp
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window is a basic help window, but with a variable width
#==============================================================================

class Window_VaryWidthHelp < Window_Help
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (x = 0, y = 0, wdth = Graphics.width)
super ()
self.x = x
self.y = y
if wdth != self.width
self.width = wdth
create_contents
end
end
end

#==============================================================================
# ** Scene_TravelMenu
#------------------------------------------------------------------------------
# This class performs the travel menu screen processing.
#==============================================================================

class Scene_TravelMenu < Scene_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def start
super
# Get location
@location = $game_system.travel_data[$game_map.map_id]
# Set up gold/mana window position
x, y = Graphics.width - 160, Graphics.height - 32 - Window_Base::WLH
@mana_window = Window_TravelMana.new (x, y)
#~ @gold_window = Window_Gold.new (x, y)
# Make travel options window
create_command_window
if ModAlg_Travel::TRAVEL_TYPE_MEMORY
# Set up travel type memory
#~ if @valid_options.include? ($game_system.last_travel_option)
#~ @command_window.index = @valid_options.index ($game_system.last_travel_option)
#~ else
#~ @command_window.index = 0
#~ $game_system.last_travel_option = 0
#~ end
#~ else
#~ @command_window.index = 0
#~ @command_window.active = true
end
@travel_type = @valid_options[0]
@mana_window.refresh (@travel_type, @location.prices[@travel_type][0])
# Check what kind of payment options the current choice is
pay_options = ModAlg_Travel::TRAVELOPTIONS_PAYMENT
#~ if pay_options[@valid_options[@command_window.index]] == 2
#~ # Show mana window
#~ @gold_window.visible = false
#~ else
#~ # Show gold window
@mana_window.visible = false
#~ end
@destination_window = Window_DestinationList.new (0)
@destination_window.refresh (@travel_type, @mana_window.actor)
@destination_window.active = ModAlg_Travel::TRAVEL_TYPE_MEMORY
@destination_window.index = 0
@last_dest_index = 0
@image_window = Window_TravelImage.new
destination_id = @location.dests[@travel_type][0]
@image_window.refresh ($game_system.travel_data[destination_id].image)
#~ @help_window = Window_VaryWidthHelp.new (0, y, Graphics.width)
#~ @help_window.set_text ("Choose a Destination")
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Termination Processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def terminate
super
#~ @command_window.dispose
@destination_window.dispose
@mana_window.dispose
#~ @gold_window.dispose
@image_window.dispose
#~ @help_window.dispose
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update
super
#~ if @command_window.active
#~ update_command_selection
#~ elsif @destination_window.active
update_destination_selection
#~ end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create Command Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def create_command_window
# Remove Teleport options unless it is available
@valid_options = []
pay_options = ModAlg_Travel::TRAVELOPTIONS_PAYMENT
teleport_skills = ModAlg_Travel::TELEPORT_SKILL_IDS
counter = 0
# Check each option
@location.travel_types.each { |i|
if pay_options[i] == 2
teleport_skill = $data_skills[teleport_skills[counter]]
counter += 1
# Check if someone in the party has the teleport skill
$game_party.members.each { |j|
if j.skill_learn? (teleport_skill)
# Certify as valid if someone in party has the teleport skill
@valid_options.push (i)
break
end
}
else
# Add it to the options list
@valid_options.push (i)
end
}
vocab_options = []
@valid_options.each { |i| vocab_options.push (ModAlg_Travel::VOCAB_TRAVELOPTIONS[i]) }
#~ @command_window = Window_Command.new (224, vocab_options)
#~ @command_window.active = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Command Selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_command_selection
#~ @command_window.update
# Select Travel Type
@travel_type = @valid_options[0]
if @travel_type != $game_system.last_travel_option
$game_system.last_travel_option = @travel_type
@mana_window.refresh (@travel_type, @location.prices[@travel_type][0])
@destination_window.refresh (@travel_type, @mana_window.actor)
if ModAlg_Travel::TRAVELOPTIONS_PAYMENT[@travel_type] == 2
@mana_window.visible = true
#~ @gold_window.visible = false
else
@mana_window.visible = false
#~ @gold_window.visible = true
end
end
# If Button B is pressed
if Input.trigger?(Input::B)
# Play Cancel SE
Sound.play_cancel
# Return to Map
$scene = Scene_Map.new
# If Button C is pressed
elsif Input.trigger?(Input::C)
# Play Decision SE
Sound.play_decision
#~ @command_window.active = false
@destination_window.index = 0
@destination_window.active = true
destination_id = @location.dests[@travel_type][0]
@image_window.refresh ($game_system.travel_data[destination_id].image)
@mana_window.refresh (@travel_type, @location.prices[@travel_type][0])
#~ @help_window.set_text ("Choose a Destination")
end
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_destination_selection
@destination_window.update
if @last_dest_index != @destination_window.index
# Refresh Image and Mana Window
destination_id = @location.dests[@travel_type][@destination_window.index]
@image_window.refresh ($game_system.travel_data[destination_id].image)
@mana_window.refresh (@travel_type, @location.prices[@travel_type][@destination_window.index])
@last_dest_index = @destination_window.index
end
#~ if Input.trigger?(Input::cool.gif
#~ # Play Cancel SE
#~ Sound.play_cancel
#~ # Select a Travel Type
#~ @command_window.active = true
#~ @destination_window.active = false
#~ @destination_window.index = -1
#~ @image_window.refresh (@location.image)
#~ @help_window.set_text ("How would you like to travel?")
if Input.trigger?(Input::C)
if @destination_window.option_disabled?
Sound.play_buzzer
return
end
# Play Travel Type SE
sound = RPG::SE.new
sound.name = ModAlg_Travel::TRAVELOPTIONS_SE[@travel_type]
sound.play
# Subtract money if Gold payable and mana if actor teleport
price = @location.prices[@travel_type][@destination_window.index]
case ModAlg_Travel::TRAVELOPTIONS_PAYMENT[@travel_type]
when 1 # Money
$game_party.gain_gold (-price)
when 2 # Mana
price = price > 100 ? price - 100 : (@mana_window.actor.maxmp.to_f*(price.to_f / 100.0)).to_i
@mana_window.actor.mp -= price
end
$game_temp.location = @location
$game_temp.destination = $game_system.travel_data[@location.dests[@travel_type][@destination_window.index]]
$game_temp.destination_xyd = $game_temp.location.dest_xyd[@travel_type][@destination_window.index]
$game_temp.ambush_chance = ModAlg_Travel::TRAVELOPTIONS_AMBUSH_CHANCE[@travel_type]
$game_temp.num_ambushes = ModAlg_Travel::TRAVELOPTIONS_AMBUSHES[@travel_type]
$scene = Scene_Map.new
end
end
end

#==============================================================================
# ** Scene_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased methods - start, update, terminate
#==============================================================================

class Scene_Map < Scene_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start Processing
#--------------------------------------------------------------------------
# Checks to see if travelling and incites encounters
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_anaxim_trvl_encntr_check_strt start
def start
while $game_temp.num_ambushes > 0
$game_temp.num_ambushes -= 1
# Randomly generate a number between 0 and 100
die_roll = rand (100)
# If ambush succeeds
if die_roll < $game_temp.ambush_chance
# Randomly pick a troop from the list of possibles
troops = $game_temp.destination.enemy_troops
die_roll = rand (troops.size)
troop_id = troops[die_roll]
# If the troop is real
unless $data_troops[troop_id] == nil
ambush_se = RPG
# Recover the actors before a battle
$game_party.members.each { |actor|
actor.hp = actor.maxhp if ModAlg_Travel::RECOVER_HP_AFTER_AMBUSH
actor.mp = actor.maxmp if ModAlg_Travel::RECOVER_SP_AFTER_AMBUSH
if ModAlg_Travel::RECOVER_CONDITIONS_AFTER_AMBUSH
actor.states.each { |i| actor.remove_state (i) }
end }
# Setup a battle
$game_troop.setup(troop_id)
$game_troop.can_escape = true
$game_troop.can_lose = true
$game_temp.battle_proc = nil
# Notify the Player of the battle
y = (Graphics.height - 32 - Window_Base::WLH) / 2
@ambush_window = Window_VaryWidthHelp.new (0, y, Graphics.width)
text = ModAlg_Travel::AMBUSH_NOTE.clone
text.gsub! (/\\NT/i) { $game_troop.troop.name }
text.gsub! (/\\NL/i) { $game_troop.location.name }
text.gsub! (/\\ND/i) { $game_troop.destination.name }
@ambush_window.set_text (text, 1)
perform_transition # Perform transition
loop do
Graphics.update
Input.update
# If Buttons B or C are pressed
if Input.trigger? (Input::B) || Input.trigger? (Input::C)
# Play Decision SE
Sound.play_decision
@ambush_window.dispose
# Set up Map BGM and Map BGS to avoid error
$game_temp.map_bgm = RPG::BGM.new
$game_temp.map_bgs = RPG::BGS.new
Sound.play_battle_start
$game_system.battle_bgm.play
# Start the battle
$scene = Scene_Battle.new
return
end
end
end
end
end
# Transport Party if Travelling
if $game_temp.destination != nil
map_id = $game_temp.destination.id
x, y, direction = $game_temp.destination_xyd
direction = case direction
when 'D' then 2
when 'L' then 4
when 'R' then 6
when 'U' then 8
end
$game_player.reserve_transfer(map_id, x, y, direction)
$game_player.perform_transfer
$game_map.autoplay # Automatically switch BGM and BGS
$game_map.update
$game_temp.reset_travel_values
end
# Start Scene_Map if all encounters are exhausted
modalg_anaxim_trvl_encntr_check_strt
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#--------------------------------------------------------------------------
# Skip update if going into travel battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_anxm_trvl_skipupdt update
def update
# Skip Update if temp travel values exist
return if $game_temp.destination != nil
# Otherwise, run as normal
modalg_anxm_trvl_skipupdt
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update (Basic)
#--------------------------------------------------------------------------
# Skip update if going into travel battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_anaxm_trvel_skip_basupdt_5ht6 update_basic
def update_basic
# Skip Update if temp travel values exist
return if $game_temp.destination != nil
# Otherwise, run as normal
modalg_anaxm_trvel_skip_basupdt_5ht6
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Terminate
#--------------------------------------------------------------------------
# Skip terminate if going into travel battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_anxm_trvl_termnt_skip terminate
def terminate
# Skip Update if temp travel values exist
return if $game_temp.destination != nil
# Otherwise, run as normal
modalg_anxm_trvl_termnt_skip
end
end

Request 1:
Need a new textbox on top of the travel selection and map display box i.e. look on the image demo.jpg, if it would be possible the box should be on the red marked area expanded over over the two other boxes, and the text inside should simply say: "Choose a Destination"

Request 2:
I would love to use one more version of the provided script above in the SAME game. Let me explain, normally one use the addon script for BG Travel System:
Easy Remove/Add Destination - ADDON for Baldur's Gate Travel System
But I would love to have a SEPARATE version used exclusively for a major capital city, and as it stands now, it will be quite messed up to use add/remove destination when the player needs to travel inside the big city.

So, what lines do I need to change in the posted script for it to work stand-alone with it's own "call-command"  i.e. $scene = Scene_TravelMenu.new

If any kind soul make the changes, please make LOTS of # comments just "before the changes" in the script so I can make "more" versions of it... I really want each city to have it's own Baldur's Gate Travel System Light script - yes, I am serious! Thats why it would help with lots of comments...

Hope for the best, and thanks for reading...
Title: Re: Baldur's Gate Travel System
Post by: Okogawa on February 08, 2010, 12:16:00 PM
I have posted a project where I (myself) tried to get everything to work out, and I managed to "hack" most stuff into place, but I fail with the two bottom windows who now "move out" from the main window.

Please look at this URL http://www.rpgmakervx.net/index.php?showtopic=26625 (http://www.rpgmakervx.net/index.php?showtopic=26625) where I posted a image and a link to my project.

Any kind assistance would be most welcome...

O.
Title: Re: Baldur's Gate Travel System
Post by: aett on March 18, 2011, 01:05:26 AM
Sorry to revive an old topic, but I have a support question.

I added this into my game and customized the script -- I only added a few locations to start with, just to test it out. However, whenever I enter a battle, the game crashes with the following error:

Code: [Select]
????????? NameError ????????

unititalized constant Game_Interpreter::Location

I tried to Google this first, but I couldn't find anything. Does anyone have any advice? Thanks in advance.
Title: Re: Baldur's Gate Travel System
Post by: modern algebra on March 18, 2011, 01:25:09 AM
Well, I can't tell too much from that; I probably need a demo; it might have to do with how you are trying to set things up. I don't know where in the default script it would occur that you would try to create a new Location object within Game_Interpreter... maybe it has something to do with something you put in a call script?

Maybe if you could recreate the error in a new project and upload it for me, I might be able to help more. Right now I can only speculate.
Title: Re: Baldur's Gate Travel System
Post by: aett on March 18, 2011, 02:51:06 PM
I just created a new project and tried to recreate the error, but it ended up working just fine. I guess I'll have to tinker around in my actual game to see what's up. Honestly, I'm having so many problems with my game that sometimes I just want to start over... sigh.

Thanks for the quick response; I'll let you know if I have any more specific problems.

EDIT: I just completely removed Battle Engine Melody from my scripts and I didn't get the error any more. Is this incompatible with BEM? If not, does anyone know how I can make them work together?
Title: Re: Baldur's Gate Travel System
Post by: pacdiggity on March 19, 2011, 08:24:06 AM
BEM is very complicated. I suppose that this script refers to the battle scene when you travel, as a result of that awesome feature. BEM probably either rewrites that scene or creates another one. Most likely the former. Try taking out the battle feature in this script, see if it works. If it does, then it should be quite simple to make compatible with both scripts in completion.
Title: Re: Baldur's Gate Travel System
Post by: aett on March 19, 2011, 02:07:38 PM
BEM is very complicated. I suppose that this script refers to the battle scene when you travel, as a result of that awesome feature. BEM probably either rewrites that scene or creates another one. Most likely the former. Try taking out the battle feature in this script, see if it works. If it does, then it should be quite simple to make compatible with both scripts in completion.

Thanks. I have no idea how to do that, but I guess I'll mess around with the script and anything that looks like it's related to the battle feature.
Title: Re: Baldur's Gate Travel System
Post by: Infinate X on April 10, 2011, 03:08:08 AM
Is it possible to use CBS scripts like ORBS, PRABS, Requiem, or Vampyr?
Title: Re: Baldur's Gate Travel System
Post by: modern algebra on April 10, 2011, 03:52:50 AM
I can't see why not. Test them out and see.
Title: Re: Baldur's Gate Travel System
Post by: JonFawkes on August 24, 2011, 03:38:19 AM
Sorry to bump this, but I didn't think this needed its own topic.

Just wanted to note that this doesn't have compatibility with GubiD's TBS. Whenever an ambush happens it calls the normal battle scene, but nothing can actually happen. The battle transition continually plays, the enemies don't appear, and I didn't try battling, but it didn't look like it was going to work.