Timisci Posted December 23, 2007 Share Posted December 23, 2007 (edited) Script che permette di creare un sistema di trasporto via mare - terra - aria.Per settare un veicolo ecco quali sono i parametri da assegnare (sotto la riga 157 del codice):Vehicle.new(id, name, graphic_name, location, x, y, passable_terrains)ES.Vehicle.new(0, 'Land Rover', '156-Animal06', 1, 4, 4,[0, 1, 2, 3])Nello script sono contenuti 3 esempi per ogni tipo di trasporto.Con "C" si usa il mezzo, con "Z" si scende.SCRIPT (da inserire sopra il Main): #***************************************************************************** # Vehicle System * #***************************************************************************** # Author: El Conductor * # Date: December/21/07 * # Version: 1.0 * #***************************************************************************** #---------------------------------------------------------------------------- # What it Does: # This script creates usable vehicles that can be set to cross certian # terrain tagged tiles. Three vehicles are predefined, a Land Rover, a # a Sea Rover, and a Sky Rover. This script also makes it easy to define # your own vehicles. You can even take any vehicle across to other maps. # #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # How it Works: This script is organized into 5 small parts. # # Part 1 defines Vehicles and sets up the database. # # class Vehicle defines a new object (the vehicle) # Its attributes are as follows. # - id : As its name implies it is the Vehicle's ID # - name : The Name of the Vehicle # - graphic_name : The name of the character graphic that will # represent the vehicle # - location : Map ID of where vehicle is located # - x : Vehicle's x coordinate # - y : Vehicle's y coordinate # - passable_terrains: An array of terrain tag ID's that vehicle # can cross # # class Data_Vehicles is the database where all the games vehicles # are defined. The vehicles are set up in an array and assigned to # a Constant. Define your Vehicles within the array like so: # # Vehicle.new(id, name, graphic_name, location, x, y, passable_terrains) # # All the classes that are new or had to be altered are as follows: # # Part I # - RPG::Vehicle # - Game_Vehicle # Part II # - Game_Map # - Spriteset_Map # Part III # - Game_Character 1 # - Game_Player # Part IV # - Scene_Map # - Scene_Menu # Part V # - Scene_Title # - Scene_Save # - Scene_Load # #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # How to Use This Script: # Copy it and paste it above Main. You may want to copy it this script # to a text document and paste it into RPG Maker from there in case it # doesn't copy right from here. # # All you need to do is go under the tilesets tab of RPG Maker set the # tiles you want to have with a certian ID. # # The terrain tags my preset vehicles respond to are: (7) for arial, # (6) for sea, and (1), (2), and (3) for various ground. # # You can create new vehicles under the Module RPG Data-Vehicles class. # There you can specify what tag numbers they can cross. Just remeber, # any tag number that you do not include is NOT passable. The tags range # from 0-7. The RPG Maker default tags for everything is 0. # # To enter a vehicle on the map, just walk up to it and press ENTER. To get # out, press the Z button on the keyboard. #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # Comments: # I hope my script is easy for you to use and modify. Learn from this # script to become a better RGSS scripter yourself. # #---------------------------------------------------------------------------- #****************************************************************************** # I Part One #------------------------------------------------------------------------------ # This part deals with the definition of the vehicle objects # and sets up the Vehicle Database. #****************************************************************************** #============================================================================== # ** Module RPG #------------------------------------------------------------------------------ # This is where most of the games internal data is stored. #============================================================================== module RPG #============================================================================== # ** Vehicle #------------------------------------------------------------------------------ # This class defines the Vehicle object. #============================================================================== class Vehicle #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :id attr_accessor :name attr_accessor :graphic_name attr_accessor :starting_location attr_accessor :starting_x attr_accessor :starting_y attr_accessor :location attr_accessor :x attr_accessor :y attr_accessor :passable_terrain #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(id, name, graphic_name, location, x, y, passable_terrain = []) # Set parameters @id = id @name = name @graphic_name = graphic_name @starting_location = location @starting_x = x @starting_y = y @location = 0 @x = 0 @y = 0 @passable_terrain = passable_terrain end end #============================================================================== # ** Vehicle_Data #------------------------------------------------------------------------------ # Stores all the games Vehicle_Data data. #============================================================================== class Data_Vehicles # This is the Vehicle database # Define new Vehicles like so; # Vehicle.new(id, name, graphic_name, location, x, y, passable_terrains) Vehicle_Database = [ Vehicle.new(0, 'Land Rover', '156-Animal06', 1, 4, 4, [0, 1, 2, 3]), Vehicle.new(1, 'Sea Rover', '187-Lorry01', 1, 8, 8, [6]), Vehicle.new(2, 'Sky Rover', '073-Bird03', 1, 12, 12, [0, 1, 2, 3, 4, 5, 6, 7]) ] end end #****************************************************************************** # II Part Two #------------------------------------------------------------------------------ # This part deals with map classes that had to be altered to accomadate the # vehicle capabilities. #****************************************************************************** #============================================================================ # ** Game_map #============================================================================ class Game_Map #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- # Added variable attr_reader :vehicles #-------------------------------------------------------------------------- # * Alias Method #-------------------------------------------------------------------------- alias vehicle_game_map_setup setup alias vehicle_game_map_update update #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def setup(map_id) # Original setup method vehicle_game_map_setup(map_id) # Added vehicles array # This array stores all the vehicles in the map @vehicles = [] # For all the vehicles in $data_vehicles array, for i in 0...$data_vehicles.size # If the vehicle's location is equal to the id of the current map if @map_id == $data_vehicles[i].location # Add a new vehicle to the map by creating a new Game_Vehicle # object and sending it to the map vehicles array @vehicles.push(Game_Vehicle.new($data_vehicles[i].id)) end end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Original update method vehicle_game_map_update for vehicle in @vehicles vehicle.update end end end #============================================================================== # ** Spriteset_Map #============================================================================== class Spriteset_Map #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Make viewports @viewport1 = Viewport.new(0, 0, 640, 480) @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport2.z = 200 @viewport3.z = 5000 # Make tilemap @tilemap = Tilemap.new(@viewport1) @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name) for i in 0..6 autotile_name = $game_map.autotile_names[i] @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name) end @tilemap.map_data = $game_map.data @tilemap.priorities = $game_map.priorities # Make panorama plane @panorama = Plane.new(@viewport1) @panorama.z = -1000 # Make fog plane @fog = Plane.new(@viewport1) @fog.z = 3000 # Make character sprites @character_sprites = [] for i in $game_map.events.keys.sort sprite = Sprite_Character.new(@viewport1, $game_map.events[i]) @character_sprites.push(sprite) end @character_sprites.push(Sprite_Character.new(@viewport1, $game_player)) # For all indexes in game map vehicles array for i in 0...$game_map.vehicles.size # Create a new character sprite for vehicle from index i sprite = Sprite_Character.new(@viewport1, $game_map.vehicles[i]) @character_sprites.push(sprite) end # Make weather @weather = RPG::Weather.new(@viewport1) # Make picture sprites @picture_sprites = [] for i in 1..50 @picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i])) end # Make timer sprite @timer_sprite = Sprite_Timer.new # Frame update update end end #****************************************************************************** # III Part Three #------------------------------------------------------------------------------ # This part contains the new Game_Vehicle class and modifications to the # standard character classes to deal with vehicles. #****************************************************************************** #============================================================================== # ** Game_Vehicle #------------------------------------------------------------------------------ # Usable vehicles on map are instances of this class. #============================================================================== class Game_Vehicle < Game_Character #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :map_id attr_accessor :passable_terrain attr_accessor :through attr_accessor :id #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(vehicle_id) super() vehicle = $data_vehicles[vehicle_id] @id = vehicle.id @character_name = vehicle.graphic_name @map_id = vehicle.location @passable_terrain = vehicle.passable_terrain if $game_player.current_vehicle != nil @through = true end moveto(vehicle.x, vehicle.y) end #-------------------------------------------------------------------------- # * Embark #-------------------------------------------------------------------------- def embark self.through = true end #-------------------------------------------------------------------------- # * Dismbark #-------------------------------------------------------------------------- def disembark self.through = false $data_vehicles[self.id].x = @x $data_vehicles[self.id].y = @y end #-------------------------------------------------------------------------- # * Don't delete this! Or you will get errors! #-------------------------------------------------------------------------- def check_event_trigger_touch(x, y) # This is put here to do nothing. # It is difficult to explain why this is neccessary. end end #============================================================================== # ** Game_Character (part 1) #============================================================================== class Game_Character #-------------------------------------------------------------------------- # * Determine if Passable # x : x-coordinate # y : y-coordinate # d : direction (0,2,4,6,8) # * 0 = Determines if all directions are impassable (for jumping) #-------------------------------------------------------------------------- def passable?(x, y, d) # Get new coordinates new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0) # If coordinates are outside of map unless $game_map.valid?(new_x, new_y) # impassable return false end # If through is ON if @through # passable return true end # If unable to leave first move tile in designated direction unless $game_map.passable?(x, y, d, self) # impassable return false end # If unable to enter move tile in designated direction unless $game_map.passable?(new_x, new_y, 10 - d) # impassable return false end # Check for all vehicles in $game_map vehicles array for vehicle in $game_map.vehicles # If vehicle coordinates are equal to destination coordinates if vehicle.x == new_x and vehicle.y == new_y # Make impassable unless vehicle is set to through unless vehicle.through == true return false end end end # Loop all events for event in $game_map.events.values # If event coordinates are consistent with move destination if event.x == new_x and event.y == new_y # If through is OFF unless event.through # If self is event if self != $game_player # impassable return false end # With self as the player and partner graphic as character if event.character_name != "" # impassable return false end end end end # If player coordinates are consistent with move destination if $game_player.x == new_x and $game_player.y == new_y # If through is OFF unless $game_player.through # If your own graphic is the character if @character_name != "" # impassable return false end end end # passable return true end end #============================================================================ # ** Game_Player #============================================================================ class Game_Player < Game_Character #------------------------------------------------------------------------ # * Public Instance Variables #-------------------------------------------------------------------------- # Added variables attr_accessor :current_vehicle attr_accessor :graphic #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super() @current_vehicle = nil; end #-------------------------------------------------------------------------- # * Passable Determinants # x : x-coordinate # y : y-coordinate # d : direction (0,2,4,6,8) # * 0 = Determines if all directions are impassable (for jumping) #-------------------------------------------------------------------------- def passable?(x, y, d) # Get new coordinates new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0) # If coordinates are outside of map unless $game_map.valid?(new_x, new_y) # Impassable return false end # If debug mode is ON and ctrl key was pressed if $DEBUG and Input.press?(Input::CTRL) # Passable return true end # If player has a vehicle # Check if the player's vehicle can cross the terrain tag coordinate if @current_vehicle != nil # If the vehicle's passable_terrain array cotains the ID of the terrain tag if @current_vehicle.passable_terrain.include?($game_map.terrain_tag(new_x, new_y)) # Then player can cross return true else return false end end super end #-------------------------------------------------------------------------- # * Passable Determinants # x : x-coordinate # y : y-coordinate # d : direction (0,2,4,6,8) # * 0 = Determines if all directions are impassable (for jumping) #-------------------------------------------------------------------------- def passable_without_vehicle?(x, y, d) # Get new coordinates new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0) # If coordinates are outside of map unless $game_map.valid?(new_x, new_y) # Impassable return false end # If debug mode is ON and ctrl key was pressed if $DEBUG and Input.press?(Input::CTRL) # Passable return true end # If through is ON if @through # passable return true end # If unable to leave first move tile in designated direction unless $game_map.passable?(x, y, d, self) # impassable return false end # If unable to enter move tile in designated direction unless $game_map.passable?(new_x, new_y, 10 - d) # impassable return false end # Loop all vehicles for vehicle in $game_map.vehicles if vehicle.x == new_x and vehicle.y == new_y unless vehicle.through == true return false end end end # Loop all events for event in $game_map.events.values # If event coordinates are consistent with move destination if event.x == new_x and event.y == new_y # If through is OFF unless event.through # If self is event if self != $game_player # impassable return false end # With self as the player and partner graphic as character if event.character_name != "" # impassable return false end end end end # If player coordinates are consistent with move destination if $game_player.x == new_x and $game_player.y == new_y # If through is OFF unless $game_player.through # If your own graphic is the character if @character_name != "" # impassable return false end end end # passable return true end #-------------------------------------------------------------------------- # * Move Down # turn_enabled : a flag permits direction change on that spot #-------------------------------------------------------------------------- def move_down(turn_enabled = true) # Turn down if turn_enabled turn_down if @current_vehicle != nil @current_vehicle.turn_down end end # If passable if passable?(@x, @y, 2) # Turn down turn_down # Move both player and vehicle if @current_vehicle != nil @current_vehicle.move_down end # Update coordinates @y += 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x, @y+1) end end #-------------------------------------------------------------------------- # * Move Left # turn_enabled : a flag permits direction change on that spot #-------------------------------------------------------------------------- def move_left(turn_enabled = true) # Turn left if turn_enabled turn_left if @current_vehicle != nil @current_vehicle.turn_left end end # If passable if passable?(@x, @y, 4) # Turn left turn_left # Move both player and vehicle if @current_vehicle != nil @current_vehicle.move_left end # Update coordinates @x -= 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x-1, @y) end end #-------------------------------------------------------------------------- # * Move Right # turn_enabled : a flag permits direction change on that spot #-------------------------------------------------------------------------- def move_right(turn_enabled = true) # Turn right if turn_enabled turn_right if @current_vehicle != nil @current_vehicle.turn_right end end # If passable if passable?(@x, @y, 6) # Turn right turn_right # Move both player and vehicle if @current_vehicle != nil @current_vehicle.move_right end # Update coordinates @x += 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x+1, @y) end end #-------------------------------------------------------------------------- # * Move up # turn_enabled : a flag permits direction change on that spot #-------------------------------------------------------------------------- def move_up(turn_enabled = true) # Turn up if turn_enabled turn_up if @current_vehicle != nil @current_vehicle.turn_up end end # If passable if passable?(@x, @y, 8) # Turn up turn_up # Move both player and vehicle if @current_vehicle != nil @current_vehicle.move_up end # Update coordinates @y -= 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x, @y-1) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Remember whether or not moving in local variables last_moving = moving? # If moving, event running, move route forcing, and message window # display are all not occurring unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing # Move player in the direction the directional button is being pressed case Input.dir4 when 2 move_down when 4 move_left when 6 move_right when 8 move_up end end # Remember coordinates in local variables last_real_x = @real_x last_real_y = @real_y super # If character moves down and is positioned lower than the center # of the screen if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y # Scroll map down $game_map.scroll_down(@real_y - last_real_y) end # If character moves left and is positioned more let on-screen than # center if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X # Scroll map left $game_map.scroll_left(last_real_x - @real_x) end # If character moves right and is positioned more right on-screen than # center if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X # Scroll map right $game_map.scroll_right(@real_x - last_real_x) end # If character moves up and is positioned higher than the center # of the screen if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y # Scroll map up $game_map.scroll_up(last_real_y - @real_y) end # If not moving unless moving? # If player was moving last time if last_moving # Event determinant is via touch of same position event result = check_event_trigger_here([1,2]) # If event which started does not exist if result == false # Disregard if debug mode is ON and ctrl key was pressed unless $DEBUG and Input.press?(Input::CTRL) # Encounter countdown if @encounter_count > 0 @encounter_count -= 1 end end end end # If C button was pressed if Input.trigger?(Input::C) # Same position and front event determinant check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) check_vehicle_trigger_there end # If A button was pressed if Input.trigger?(Input::A) # If player is in a vehicle, dismount vehicle unless $game_player.current_vehicle == nil # Calculate front event coordinates new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) # Check if player can dismount on a passable terrain if passable_without_vehicle?(new_x, new_y, @direction) dismount_vehicle end end end end end #-------------------------------------------------------------------------- # * Front Vehicle Starting Determinant #-------------------------------------------------------------------------- def check_vehicle_trigger_there() result = false # If event is running if $game_system.map_interpreter.running? return result end # Calculate front event coordinates new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) # If event coordinates and triggers are consistent # For all possible vehicles in map for vehicle in $game_map.vehicles # Check if vehicle is in front of player. If so, enter vehicle if vehicle.x == new_x and vehicle.y == new_y mount_vehicle(vehicle) result = true end end #return result end #-------------------------------------------------------------------------- # * Get in vehicle #-------------------------------------------------------------------------- def mount_vehicle(vehicle) @graphic = @character_name vehicle.embark @through = true move_forward @through = false @current_vehicle = vehicle @character_name = "" end #-------------------------------------------------------------------------- # * Get out of vehicle #-------------------------------------------------------------------------- def dismount_vehicle @character_name = @graphic @current_vehicle.disembark @current_vehicle = nil @through = true move_forward @through = false end end #****************************************************************************** # IV Part Four #------------------------------------------------------------------------------ # This part contains modifications to the Scene_Map and Scene_Menu. #****************************************************************************** #============================================================================ # ** Scene_Map #---------------------------------------------------------------------------- # Altered to handle transfering both player and vehicle. #============================================================================ class Scene_Map #-------------------------------------------------------------------------- # * Player Place Move #-------------------------------------------------------------------------- def transfer_player # Clear player place move call flag $game_temp.player_transferring = false # If move destination is different than current map if $game_map.map_id != $game_temp.player_new_map_id # If player is in a vehicle if $game_player.current_vehicle != nil # Set variable to $data_vehicles vehicle at player's current ID index. vehicle = $data_vehicles[$game_player.current_vehicle.id] # Set variable to player's vehicle ID for retrieval purposes later. vehicle_id = $game_player.current_vehicle.id # Set new location, x, and y coordinates for the vehicle vehicle.location = $game_temp.player_new_map_id vehicle.x = $game_temp.player_new_x vehicle.y = $game_temp.player_new_y # Set up a new map $game_map.setup($game_temp.player_new_map_id) # Loop through all vehicles located on the map for i in 0...$game_map.vehicles.size # If any of the vehicles ID is the same as the player's vehicle if $game_map.vehicles[i].id == vehicle_id # Assign that vehicle to player on the new map $game_player.current_vehicle = $game_map.vehicles[i] end end else $game_map.setup($game_temp.player_new_map_id) end end # Set up player position $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y) # Set player direction case $game_temp.player_new_direction when 2 # down $game_player.turn_down when 4 # left $game_player.turn_left when 6 # right $game_player.turn_right when 8 # up $game_player.turn_up end # Straighten player position $game_player.straighten # Update map (run parallel process event) $game_map.update # Remake sprite set @spriteset.dispose @spriteset = Spriteset_Map.new # If processing transition if $game_temp.transition_processing # Clear transition processing flag $game_temp.transition_processing = false # Execute transition Graphics.transition(20) end # Run automatic change for BGM and BGS set on the map $game_map.autoplay # Frame reset Graphics.frame_reset # Update input information Input.update end end #============================================================================== # ** Scene_Menu #------------------------------------------------------------------------------ # Saving disabled while in vehicle. #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make command window s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "Status" s5 = "Save" s6 = "End Game" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index # If number of party members is 0 if $game_party.actors.size == 0 # Disable items, skills, equipment, and status @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # If save is forbidden if $game_system.save_disabled || $game_player.current_vehicle != nil # Disable save @command_window.disable_item(4) end # Make play time window @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 224 # Make steps window @steps_window = Window_Steps.new @steps_window.x = 0 @steps_window.y = 320 # Make gold window @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 # Make status window @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @command_window.dispose @playtime_window.dispose @steps_window.dispose @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # * Frame Update (when command window is active) #-------------------------------------------------------------------------- def update_command # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to map screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # If command other than save or end game, and party members = 0 if $game_party.actors.size == 0 and @command_window.index < 4 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Branch by command window cursor position case @command_window.index when 0 # item # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to item screen $scene = Scene_Item.new when 1 # skill # Play decision SE $game_system.se_play($data_system.decision_se) # Make status window active @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 # equipment # Play decision SE $game_system.se_play($data_system.decision_se) # Make status window active @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 # status # Play decision SE $game_system.se_play($data_system.decision_se) # Make status window active @command_window.active = false @status_window.active = true @status_window.index = 0 when 4 # save # If saving is forbidden if $game_system.save_disabled || $game_player.current_vehicle != nil # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to save screen $scene = Scene_Save.new when 5 # end game # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to end game screen $scene = Scene_End.new end return end end end #****************************************************************************** # V Part Five #------------------------------------------------------------------------------ # This part is composed of the alterations that deal with starting a new game # saving, and loading. #****************************************************************************** #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # Added creation of $data_vehicles and initialiation of all vehicle # starting positions. #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Command: New Game #-------------------------------------------------------------------------- def command_new_game # Play decision SE $game_system.se_play($data_system.decision_se) # Stop BGM Audio.bgm_stop # Reset frame count for measuring play time Graphics.frame_count = 0 # Make each type of game object $game_temp = Game_Temp.new $game_system = Game_System.new $game_switches = Game_Switches.new $game_variables = Game_Variables.new $game_self_switches = Game_SelfSwitches.new $game_screen = Game_Screen.new $game_actors = Game_Actors.new $game_party = Game_Party.new $game_troop = Game_Troop.new $game_map = Game_Map.new $game_player = Game_Player.new # Assign array to global variable $data_vehicles = RPG::Data_Vehicles::Vehicle_Database # Initialize vehicle starting positions for vehicle in $data_vehicles vehicle.x = vehicle.starting_x vehicle.y = vehicle.starting_y vehicle.location = vehicle.starting_location end # Set up initial party $game_party.setup_starting_members # Set up initial map position $game_map.setup($data_system.start_map_id) # Move player to initial position $game_player.moveto($data_system.start_x, $data_system.start_y) # Refresh player $game_player.refresh # Run automatic change for BGM and BGS set with map $game_map.autoplay # Update map (run parallel process event) $game_map.update # Switch to map screen $scene = Scene_Map.new end end #============================================================================== # ** Scene_Save #------------------------------------------------------------------------------ # Now includes saving of $data_vehicles. #============================================================================== class Scene_Save < Scene_File #-------------------------------------------------------------------------- # * Write Save Data # file : write file object (opened) #-------------------------------------------------------------------------- def write_save_data(file) # Make character data for drawing save file characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end # Write character data for drawing save file Marshal.dump(characters, file) # Wrire frame count for measuring play time Marshal.dump(Graphics.frame_count, file) # Increase save count by 1 $game_system.save_count += 1 # Save magic number # (A random value will be written each time saving with editor) $game_system.magic_number = $data_system.magic_number # Write each type of game object Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, file) Marshal.dump($game_actors, file) Marshal.dump($game_party, file) Marshal.dump($game_troop, file) Marshal.dump($game_map, file) Marshal.dump($game_player, file) Marshal.dump($data_vehicles, file) end end #============================================================================== # ** Scene_Load #------------------------------------------------------------------------------ # Now includes loading of $data_vehicles. #============================================================================== class Scene_Load < Scene_File #-------------------------------------------------------------------------- # * Read Save Data # file : file object for reading (opened) #-------------------------------------------------------------------------- def read_save_data(file) # Read character data for drawing save file characters = Marshal.load(file) # Read frame count for measuring play time Graphics.frame_count = Marshal.load(file) # Read each type of game object $game_system = Marshal.load(file) $game_switches = Marshal.load(file) $game_variables = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_screen = Marshal.load(file) $game_actors = Marshal.load(file) $game_party = Marshal.load(file) $game_troop = Marshal.load(file) $game_map = Marshal.load(file) $game_player = Marshal.load(file) $data_vehicles = Marshal.load(file) # If magic number is different from when saving # (if editing was added with editor) if $game_system.magic_number != $data_system.magic_number # Load map $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end # Refresh party members $game_party.refresh end end I dettagli sono spiegati all'interno dello script.Spero vi torni utile ^^ Edited August 12, 2013 by Flame Progetto in corso: "Hero Walking: Toward Another Life" Video Old Intro su Youtube Visite: 11.896! http://img212.imageshack.us/img212/1060/logheryb0.jpg *Posizioni raggiunte nei contest* http://www.rpg2s.net/awards/bestuser1.jpghttp://www.rpg2s.net/awards/beststaff1.jpg http://www.rpg2s.net/awards/bestmaker3.jpghttp://www.rpg2s.net/awards/bestcritical1.jpghttp://www.rpg2s.net/awards/mostcharismatic2.jpg http://www.rpg2s.net/awards/mosthelpful1.jpghttp://www.rpg2s.net/awards/mostpolite1.jpghttp://www.rpg2s.net/awards/mostpresent1.jpg http://img204.imageshack.us/img204/8039/sccontest3octpl3.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img118.imageshack.us/img118/181/sccontest1octdt9.gif http://img230.imageshack.us/img230/1273/sccontest1batio5.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img143.imageshack.us/img143/3755/destroyae4.png http://img141.imageshack.us/img141/3081/comics3od3.gif http://img118.imageshack.us/img118/181/sccontest1octdt9.gif SE VUOI AVERE RENS PER RISORSE, TUTORIAL, DEMO, ECC... LEGGI QUI Link to comment Share on other sites More sharing options...
Sora-Master Posted January 18, 2008 Share Posted January 18, 2008 c'è 1 errore.... io all'inizio nn voglio nessun trsporto lo script lo inserisce da solo il cavallo l'uccellaccio e il carretto!!!!! non bisognerebbe usare un call script x esempio??? http://dragcave.net/image/VqHI.gifhttp://dragcave.net/image/5thF.gifhttp://dragcave.net/image/7cb8.gifhttp://dragcave.net/image/WPrD.gifhttp://dragcave.net/image/DxRI.gifhttp://dragcave.net/image/JAV2.gifhttp://dragcave.net/image/aiDE.gifclicca sull'uovoFrom Wikipidia:Makeritus vulgaris(Makeritus Enpatologium Catostum) Malattia che si sviluppa nel mekeratore.si manifesta con status alterati di noia e svogliatezza.Malattia grave poiche puo guarire solo con il tempo e impedisce il Maker al soggetto che ne è infetto.Attualmente gli scenziati della Ryu-soft stanno cercando rimedio a questa malattia Ryu-Soft VISITA LA MIA BOTTEGA http://r5.fodey.com/19cf30d77a0fd435cb06407ab7023508e.1.gif ouyang_keba@hotmail.it ha inviato 15/03/2009 15.24:yaDiosba S.O.J. 4ever!!!!! scrive:who's fat??ouyang_keba@hotmail.it ha inviato 15/03/2009 15.25:eccomi mi sono appena connessoouyang_keba@hotmail.it ha inviato 15/03/2009 15.26:wath?Diosba S.O.J. 4ever!!!!! scrive:O.ODiosba S.O.J. 4ever!!!!! scrive:si scrive whatouyang_keba@hotmail.it ha inviato 15/03/2009 15.26:mi sono connesso clandestinamente xD me manca un es di italiano e poi ho finito i compitiouyang_keba@hotmail.it ha inviato 15/03/2009 15.27:seDiosba S.O.J. 4ever!!!!! scrive:O.ODiosba S.O.J. 4ever!!!!! scrive:addiritturingouyang_keba@hotmail.it ha inviato 15/03/2009 15.28:e giaouyang_keba@hotmail.it ha inviato 15/03/2009 15.28:che me raccontiDiosba S.O.J. 4ever!!!!! scrive:mmmmhDiosba S.O.J. 4ever!!!!! scrive:qlcsa che ti farà feliceDiosba S.O.J. 4ever!!!!! scrive:indovining...Diosba S.O.J. 4ever!!!!! scrive:http://www.youtube.com/watch?v=p9Zt8mn14hY...feature=relatedouyang_keba@hotmail.it ha inviato 15/03/2009 15.28:mmmmmmmmmmmmmmmouyang_keba@hotmail.it ha inviato 15/03/2009 15.29:caghi a spruzzo xEDiosba S.O.J. 4ever!!!!! scrive:O.O ri iniziamo a giocare a D&D Diosba S.O.J. 4ever!!!!! scrive::xouyang_keba@hotmail.it ha inviato 15/03/2009 15.30:yeees!!Diosba S.O.J. 4ever!!!!! scrive: Link to comment Share on other sites More sharing options...
Timisci Posted January 21, 2008 Author Share Posted January 21, 2008 Non è un errore, è lo script che funziona in questo modo ^^Magari in qualche modo si può richiamare anche tramite script.Cmq basta settare la mappa in cui vuoi che appaia il mezzo di trasporto e il gioco è fatto; secondo me è una soluzione rapida e facile da usare (soprattutto perchè è un sistema di trasporto completo). Progetto in corso: "Hero Walking: Toward Another Life" Video Old Intro su Youtube Visite: 11.896! http://img212.imageshack.us/img212/1060/logheryb0.jpg *Posizioni raggiunte nei contest* http://www.rpg2s.net/awards/bestuser1.jpghttp://www.rpg2s.net/awards/beststaff1.jpg http://www.rpg2s.net/awards/bestmaker3.jpghttp://www.rpg2s.net/awards/bestcritical1.jpghttp://www.rpg2s.net/awards/mostcharismatic2.jpg http://www.rpg2s.net/awards/mosthelpful1.jpghttp://www.rpg2s.net/awards/mostpolite1.jpghttp://www.rpg2s.net/awards/mostpresent1.jpg http://img204.imageshack.us/img204/8039/sccontest3octpl3.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img118.imageshack.us/img118/181/sccontest1octdt9.gif http://img230.imageshack.us/img230/1273/sccontest1batio5.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img143.imageshack.us/img143/3755/destroyae4.png http://img141.imageshack.us/img141/3081/comics3od3.gif http://img118.imageshack.us/img118/181/sccontest1octdt9.gif SE VUOI AVERE RENS PER RISORSE, TUTORIAL, DEMO, ECC... LEGGI QUI Link to comment Share on other sites More sharing options...
Parbus Posted January 21, 2008 Share Posted January 21, 2008 (edited) OOO finalmente uno script coi mezzi, era un sacco che lo cercavo Ci sono solo dei problemi che magari gia sono risolvibili ma nn mi viene in mente come, ovvero:-lo sky rover non dovrebbe attivare gli eventi di trasporto (es. non dovrebbe entrare in città se sta nella worldmap), come si può fare per rendere il tutto in "invisibile"? pensavo attraverso eventi comuni con una if="qualcosa con lo script" ma nn saprei dove mettere le mai,-Bhe in effetti sarebbe comodo trovare un comando script per richiamare il vehicle (es. al'inizio del gioco nn c'è l'ho, ad un certo punto della storia compare nel worldmap), quale potrebbe essere? Edited January 21, 2008 by Parbus http://img143.imageshack.us/img143/1411/ubd6549sd1.png <-- La volpe è megliohttp://img215.imageshack.us/img215/1198/rmxpuser1ox4nwzd1.png <-- ma va? http://img246.imageshack.us/img246/1826/powlm5pr5.gifhttp://img530.imageshack.us/img530/4523/crashnewqw3.gifhttp://img407.imageshack.us/img407/1639/gintokiep5.gif http://img204.imageshack.us/img204/5715/naptitolopiccolo.png\--->Topic di Riferimento<---/ Link to comment Share on other sites More sharing options...
Timisci Posted January 21, 2008 Author Share Posted January 21, 2008 lo sky rover non dovrebbe attivare gli eventi di trasporto (es. non dovrebbe entrare in città se sta nella worldmap)Se lo devi usare in una world map potresti settare un tile non passabile per lo sky rover da mettere intorno alla città (nella world map), in modo che non arrivi al trasporto e il pg è costretto a scendere per accedervi. (es. al'inizio del gioco nn c'è l'ho, ad un certo punto della storia compare nel worldmap)Potresti fare una copia della world map, in modo che quando hai il mezzo di trasporto usi appunto la copia per girare (in cui trovi il mezzo desiderato). Progetto in corso: "Hero Walking: Toward Another Life" Video Old Intro su Youtube Visite: 11.896! http://img212.imageshack.us/img212/1060/logheryb0.jpg *Posizioni raggiunte nei contest* http://www.rpg2s.net/awards/bestuser1.jpghttp://www.rpg2s.net/awards/beststaff1.jpg http://www.rpg2s.net/awards/bestmaker3.jpghttp://www.rpg2s.net/awards/bestcritical1.jpghttp://www.rpg2s.net/awards/mostcharismatic2.jpg http://www.rpg2s.net/awards/mosthelpful1.jpghttp://www.rpg2s.net/awards/mostpolite1.jpghttp://www.rpg2s.net/awards/mostpresent1.jpg http://img204.imageshack.us/img204/8039/sccontest3octpl3.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img118.imageshack.us/img118/181/sccontest1octdt9.gif http://img230.imageshack.us/img230/1273/sccontest1batio5.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img103.imageshack.us/img103/1496/sccontest2octou1.gif http://img143.imageshack.us/img143/3755/destroyae4.png http://img141.imageshack.us/img141/3081/comics3od3.gif http://img118.imageshack.us/img118/181/sccontest1octdt9.gif SE VUOI AVERE RENS PER RISORSE, TUTORIAL, DEMO, ECC... LEGGI QUI Link to comment Share on other sites More sharing options...
Parbus Posted January 21, 2008 Share Posted January 21, 2008 Se lo devi usare in una world map potresti settare un tile non passabile per lo sky rover da mettere intorno alla città (nella world map), in modo che non arrivi al trasporto e il pg è costretto a scendere per accedervi. :ph34r: geniale, nn ci avevo pensato per niente :huh: problema risolto Potresti fare una copia della world map, in modo che quando hai il mezzo di trasporto usi appunto la copia per girare (in cui trovi il mezzo desiderato).Si è vero, a questo ci avevo pensato, però preferirei un soluzione meno incasinosa: andrebbero modificati tutti i teleport alla/dalla worldmap. Non basterebbe modificare lo script con una stringa che fa comparire i vehicles tramite una switch, invece che essere creati da subito? (non ne so molto di ruby ) http://img143.imageshack.us/img143/1411/ubd6549sd1.png <-- La volpe è megliohttp://img215.imageshack.us/img215/1198/rmxpuser1ox4nwzd1.png <-- ma va? http://img246.imageshack.us/img246/1826/powlm5pr5.gifhttp://img530.imageshack.us/img530/4523/crashnewqw3.gifhttp://img407.imageshack.us/img407/1639/gintokiep5.gif http://img204.imageshack.us/img204/5715/naptitolopiccolo.png\--->Topic di Riferimento<---/ Link to comment Share on other sites More sharing options...
Skimodex Posted October 31, 2008 Share Posted October 31, 2008 A me da errore...vi posto l'immaginehttp://img373.imageshack.us/img373/3840/immagineyr4.png http://www.GameFun.it Link to comment Share on other sites More sharing options...
Darkshiva Posted October 31, 2008 Share Posted October 31, 2008 Grande bello script mi è molto utile http://team.ffonline.it/imgpersonaggio/seifer_it.jpg http://team.ffonline.it/imgpersonaggio/kimahri_it.jpg E tu in che personaggio ti identifichi?http://img145.imageshack.us/img145/4716/squallni0.gifhttp://img262.imageshack.us/img262/6382/gohanssj2ky4.gif Link to comment Share on other sites More sharing options...
Mattone Posted November 8, 2008 Share Posted November 8, 2008 ho due domande: -come si setta la mappa dove si attivano i veicoli?-come si cambia la velocità di un veicolo? http://img171.imageshack.us/img171/8702/mattone2pm6.jpghttp://img171.imageshack.us/img171/8702/mattone2pm6.fde157aac7.jpgSpoiler http://img393.imageshack.us/img393/9920/legenrpgmaniamu3.gifForum:The legend of makingMSN....Ahiai!![c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: :hail:Mattone scrive: hail weiss[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Cumlava?Mattone scrive: spermosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Orgasmamente bene.Mattone scrive: cicciosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Robustamente bene.Mattone scrive: Lollosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Iccsdamente bene.Mattone scrive: Iccstramente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Rotflamente bene.Mattone scrive: Fooddosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Bannatamente bene.Mattone scrive: Caiossamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Allora male[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Mattonamente bene.Mattone scrive: Sephirottamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Kremente bene.Mattone scrive: settismente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Clorosamente bene.Mattone scrive: morganosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Cikcosamente bene.Mattone scrive: PyrosHellReavenosamente bene.[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Solatralenuvolosamente bene.Mattone scrive: Dexmente bene.[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Dandaramente bene.Mattone scrive: Frankamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Trooperamente bene.Mattone scrive: Tiosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Metalshikamente bene.Mattone scrive: Devoandareamangiaremente bene. Adopomente bene.[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Ciaosamente bene.Già... ma ora passiamo ad altro...Se fai parte della Mattone Pictures, incolla questo nella tua firma:[/color][/size]Mattone Pictures: Progetti in corso: The Last Dragon. Io sono uno [il tuo ruolo]. Io faccio parte della Mattone Pictures!Il Sito di Mattone, per info sulla vita, i progetti, i contatti e i numeri di cel di Mattone!!http://img702.mytextgraphics.com/graffititextlive/2008/04/06/7cfbdd0f5cddf6d1f8a9d1f2b08c5541.gifhttp://www.dvdbeaver.com/film2/DVDReviews32/a%20lol/ttile%20lol.jpghttp://team.ffonline.it/imgpersonaggio/ward_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/cloud_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/auron_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/cyan_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/cecil_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/galuf_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/gus_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/steiner_it.jpg E tu in che personaggio ti identifichi? Link to comment Share on other sites More sharing options...
Marcoz Posted May 9, 2010 Share Posted May 9, 2010 scusate, ho fatto un evento che richiama questop script: Vehicle.new(0, 'Sea Rover', '156-Animal06', 1, 4, 4,[0, 1, 2, 3])però, mi dice questo: initialized constant interpreted: vehiclecosa devo fare? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now