- 15
- Posts
- 10
- Years
- Seen Nov 1, 2017
Hey guys!
So I'm a noob at scripting, but have been fiddling around on and off in RMXP for about a year.
I've eventually gotten around to making a feature for a game of mine in which you 'ride' the Pokemon in your party (Ride is an HM).
I've gotten it to change the graphic of the character when the HM is used, but everything stops (but the music) once that happens.
Ideally the riding works pretty much the same as the bicycle, but I want both features in the game, not a simple replace.
Here's what I've put in:
in Game_Map
in Walk_Run
in PField_Field
Also in PField_Field, placed under line 458 (which is the [S-HIGHLIGHT]def Kernel.pbDismountBike[/S-HIGHLIGHT] block)
IN PField_Metadata
is added under the opening list and
is added straight after line 114.
This is the Hidden Move script:
IN PField_HiddenMoves this is added to the end
and this is added to a new section above main:
There is a Syntax error in line 84 of the new section, but I've gone through with different alternatives of that section, that haven't had syntax errors, and everything has worked up until the player is actually riding the Pokemon.
EDIT: thanks to Vendily, there is no longer a syntax error in this section.
However, the issue regarding the player not actually being able to move (or being able to open any menus etc) has not been resolved.
Thanks for the support everyone!
If anyone could help me out here, that would be appreciated!
of course, credits will be given where credits are due :)
Thanks all ! (and sorry for the amount of rookie-ness in this post :D)
So I'm a noob at scripting, but have been fiddling around on and off in RMXP for about a year.
I've eventually gotten around to making a feature for a game of mine in which you 'ride' the Pokemon in your party (Ride is an HM).
I've gotten it to change the graphic of the character when the HM is used, but everything stops (but the music) once that happens.
Ideally the riding works pretty much the same as the bicycle, but I want both features in the game, not a simple replace.
Here's what I've put in:
in Game_Map
Spoiler:
line 271:
Code:
# Prevent cycling in really tall grass/on ice
elsif $PokemonGlobal.bicycle &&
PBTerrain.onlyWalk?(@terrain_tags[tile_id])
return false
# Prevent riding in really tall grass/on ice
[S-HIGHLIGHT] elsif $PokemonGlobal.ride &&
PBTerrain.onlyWalk?(@terrain_tags[tile_id])
return false[/S-HIGHLIGHT]
in Walk_Run
Spoiler:
line 46:
Code:
if !moving? && !@move_route_forcing && $PokemonGlobal
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
if $PokemonGlobal.playerID>=0 && meta &&
!$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing [S-HIGHLIGHT]&& !$PokemonGlobal.ride[/S-HIGHLIGHT]
if meta[4] && meta[4]!="" && Input.dir4!=0 && passable?(@x,@y,Input.dir4) && pbCanRun?
in PField_Field
Spoiler:
line 415:
Code:
def Kernel.pbUpdateVehicle
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
if meta
if $PokemonGlobal.diving
$game_player.character_name=pbGetPlayerCharset(meta,5) # Diving graphic
elsif $PokemonGlobal.surfing
$game_player.character_name=pbGetPlayerCharset(meta,3) # Surfing graphic
elsif $PokemonGlobal.bicycle
$game_player.character_name=pbGetPlayerCharset(meta,2) # Bicycle graphic
[S-HIGHLIGHT] elsif $PokemonGlobal.ride
$game_player.character_name=pbGetPlayerCharset(meta,2) # Riding graphic
else[/S-HIGHLIGHT]
$game_player.character_name=pbGetPlayerCharset(meta,1) # Regular graphic
end
end
end
Also in PField_Field, placed under line 458 (which is the [S-HIGHLIGHT]def Kernel.pbDismountBike[/S-HIGHLIGHT] block)
Spoiler:
Code:
def pbCanRide?(mapid)
return true if pbGetMetadata(mapid,MetadataBicycleAlways)
val=pbGetMetadata(mapid,MetadataBicycle)
val=pbGetMetadata(mapid,MetadataOutdoor) if val==nil
return val ? true : false
end
def Kernel.pbMountRide
return if $PokemonGlobal.ride
$PokemonGlobal.ride=true
Kernel.pbUpdateVehicle
bikebgm=pbGetMetadata(0,MetadataBicycleBGM)
if bikebgm
pbCueBGM(bikebgm,0.5)
end
end
def Kernel.pbDismountRide
return if !$PokemonGlobal.ride
$PokemonGlobal.ride=false
Kernel.pbUpdateVehicle
$game_map.autoplayAsCue
end
IN PField_Metadata
Spoiler:
Code:
attr_accessor :ride
is added under the opening list and
Spoiler:
Code:
@ride = false
This is the Hidden Move script:
IN PField_HiddenMoves this is added to the end
Spoiler:
Code:
#==============================================================================
#Ride
#==============================================================================
def Kernel.pbRide
if $game_player.pbHasDependentEvents?
return false
end
movefinder=Kernel.pbCheckMove(:RIDE)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("Your Pokemon is waiting...\nWould you like to ride it?"))
speciesname=!movefinder ? $Trainer.name : movefinder.name
Kernel.pbMessage(_INTL("{1} used Ride!",speciesname))
pbHiddenMoveAnimation(movefinder)
bicyclebgm=pbGetMetadata(0,MetadataBicycleBGM)
if bicyclebgm
pbCueBGM(bicyclebgm,0.5)
end
pbStartRiding()
return true
end
end
return false
end
def pbStartRiding()
Kernel.pbCancelVehicles
$PokemonEncounters.clearStepCount
$PokemonGlobal.ride=true
Kernel.pbUpdateVehicle
Kernel.pbJumpToward
Kernel.pbUpdateVehicle
$game_player.check_event_trigger_here([1,2])
end
def pbEndRiding()
Kernel.pbCancelVehicles
$PokemonGlobal.ride=false
Kernel.pbUpdateVehicle
end
def Kernel.pbTransferRiding(mapid,xcoord,ycoord,direction=$game_player.direction)
pbFadeOutIn(99999){
$game_temp.player_new_map_id=mapid
$game_temp.player_new_x=xcoord
$game_temp.player_new_y=ycoord
$game_temp.player_new_direction=direction
Kernel.pbCancelVehicles
$PokemonGlobal.ride=true
Kernel.pbUpdateVehicle
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
HiddenMoveHandlers::CanUseMove.add(:RIDE,proc{|move,pkmn|
if $PokemonGlobal.ride
Kernel.pbMessage(_INTL("You dismount."))
pbEndRiding ()
return false
end
if $PokemonGlobal.surfing
Kernel.pbMessage(_INTL("Can't do that here."))
return false
end
if $PokemonGlobal.bicycle
Kernel.pbMessage(_INTL("You're already riding your bicycle"))
return false
end
if $game_player.pbHasDependentEvents?
Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
return false
end
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
Kernel.pbMessage(_INTL("You're already riding your bicycle."))
return false
end
return true
})
HiddenMoveHandlers::UseMove.add(:RIDE,proc{|move,pokemon|
if !pbHiddenMoveAnimation(pokemon)
Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
end
pbStartRiding()
return true
})
and this is added to a new section above main:
Spoiler:
Code:
class Game_Character
def ride_down(turn_enabled = true)
if $PokemonGlobal.ride
if turn_enabled
turn_down
elsif passable?(@x, @y, 2)
return if pbLedge(0,1)
return if pbEndSurf(0,1)
turn_down
@y += 1
increase_steps
elsif !check_event_trigger_touch(@x, @y+1)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
def ride_left(turn_enabled = true)
if $PokemonGlobal.ride
if turn_enabled
turn_left
elsif passable?(@x, @y, 4)
return if pbLedge(-1,0)
return if pbEndSurf(-1,0)
turn_left
@x -= 1
increase_steps
elsif !check_event_trigger_touch(@x-1, @y)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
def ride_right(turn_enabled = true)
if $PokemonGlobal.ride
if turn_enabled
turn_right
elsif passable?(@x, @y, 6)
return if pbLedge(1,0)
return if pbEndSurf(1,0)
turn_right
@x += 1
increase_steps
elsif !check_event_trigger_touch(@x+1, @y)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
def ride_up(turn_enabled = true)
if $PokemonGlobal.ride
if turn_enabled
turn_up
elsif passable?(@x, @y, 8)
return if pbLedge(0,-1)
return if pbEndSurf(0,-1)
turn_up
@y -= 1
increase_steps
elsif !check_event_trigger_touch(@x, @y-1)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
end
EDIT: thanks to Vendily, there is no longer a syntax error in this section.
However, the issue regarding the player not actually being able to move (or being able to open any menus etc) has not been resolved.
Thanks for the support everyone!
If anyone could help me out here, that would be appreciated!
of course, credits will be given where credits are due :)
Thanks all ! (and sorry for the amount of rookie-ness in this post :D)
Last edited: