VEHICLE/MAP TRANSFER ISSUES (VX)
Posts
Pages:
1
Hey guys, thought I'd throw some help out there if anyone else has had these issues.
Basically, I wanted to make where I could use a ship. Fine enough? Thing is, this ship starts off in town, meaning I have at least two maps where the ship can be accessed. I was presented with a couple of problems:
Here's the coding fixes/changes I did:
In there I made it so that it would ONLY change the move speed to "normal if on the world map, otherwise it would make no change, since I have my game set to slower walk on the world map and faster walk everywhere else. The $game_map.vehicle_exit_bgm is another fix I also had to implement. This class is in Game_Player
I basically used this extra class so that I could force the autoplay of the current map's BGM when getting off the vehicle. This gets added to Game_Map
I changed the usual autoplay class so that it will only change music when you change maps IF you are not in a vehicle. This class is in Game_Map.
This pretty much embodies some of the more major changes I've made to the scripting and will probably keep in every game I make, outside of the variables solution.
Basically, I wanted to make where I could use a ship. Fine enough? Thing is, this ship starts off in town, meaning I have at least two maps where the ship can be accessed. I was presented with a couple of problems:
- If I boarded in town and got off on the world map, it would play the town music
- It would always set the player walk speed to "normal" which was fine on the world map, but definitely not in town!
- I ended up having to do a few more fixes too because once I boarded a vehicle and changed maps, it would swap the music.
Here's the coding fixes/changes I did:
#--------------------------------------------------------------------------
# * Get Off Vehicle
# Assumes that the player is currently riding in a vehicle.
#--------------------------------------------------------------------------
def get_off_vehicle
if in_airship? # Airship
return unless airship_land_ok?(@x, @y) # Can't land?
else # Boat/ship
front_x = $game_map.x_with_direction(@x, @direction)
front_y = $game_map.y_with_direction(@y, @direction)
return unless can_walk?(front_x, front_y) # Can't touch land?
end
$game_map.vehicles[@vehicle_type].get_off # Get off processing
if in_airship? # Airship
@direction = 2 # Face down
else # Boat/ship
force_move_forward # Move one step forward
@transparent = false # Remove transparency
end
@vehicle_getting_off = true # Start getting off operation
@map = $game_map.map_id
if @map == 1
@move_speed = 4 # Return move speed
end
@through = false # Passage OFF
$game_map.vehicle_exit_bgm
make_encounter_count # Initialize encounter
end
In there I made it so that it would ONLY change the move speed to "normal if on the world map, otherwise it would make no change, since I have my game set to slower walk on the world map and faster walk everywhere else. The $game_map.vehicle_exit_bgm is another fix I also had to implement. This class is in Game_Player
#--------------------------------------
# * Change music when exiting vehicle
#--------------------------------------
def vehicle_exit_bgm
@map.bgm.play if @map.autoplay_bgm
@map.bgs.play if @map.autoplay_bgs
end
I basically used this extra class so that I could force the autoplay of the current map's BGM when getting off the vehicle. This gets added to Game_Map
#--------------------------------------------------------------------------
# * Automatically Switch BGM and BGS (not in vehicle)
#--------------------------------------------------------------------------
def autoplay
if $game_player.in_vehicle?
else
@map.bgm.play if @map.autoplay_bgm
@map.bgs.play if @map.autoplay_bgs
end
end
I changed the usual autoplay class so that it will only change music when you change maps IF you are not in a vehicle. This class is in Game_Map.
This pretty much embodies some of the more major changes I've made to the scripting and will probably keep in every game I make, outside of the variables solution.
Is this an RMXP problem? You might want to be more specific in your topic title (attracts certain people who know better) or post.
author=YummyDrumsticks link=topic=2805.msg53657#msg53657 date=1230932367VX is the only maker with vehicles, so I would assume it's a VX problem.
Is this an RMXP problem? You might want to be more specific in your topic title (attracts certain people who know better) or post.
Only XP and 95 are the ones that don't have default vehicles. As for XP, I wasn't sure if he was referring to a custom-made script, but that aside.
I'm sorry, I know this is a big necropost, but how do I plug this in? I don't want the BGM to change when I exit vehicles, just play the same as the map's.
I guess I should replace the first code(if needed for the BGM fix) with the default code in the script. But where should the other two codes be placed/replaced?
I'm sorry if I might sound a little stupid, but I don't really get this fully :/
I guess I should replace the first code(if needed for the BGM fix) with the default code in the script. But where should the other two codes be placed/replaced?
I'm sorry if I might sound a little stupid, but I don't really get this fully :/
Pages:
1