- 30
- Posts
- 5
- Years
- Seen Jan 16, 2024
I've found a script that make maps sloped for cycling. Give credit to Sichlor, not me.
First, go to the end of PSystem_Utilities and add those lines
Second, go to Game_Player_Visuals and find (line 59)
Replace it with
ng or diving
else
@move_speed = ($RPGVX) ? 4.5 : 3.8 # Walking
end
end
update_old
end[/CODE]
Finally, go to Game_Player (line 393) and find
Under the first "dir=Input.dir4" (line 398), add
Give credit to Sichlor, not me!
First, go to the end of PSystem_Utilities and add those lines
Code:
################################################################################
# Sloped down for cycling
################################################################################
def onCyclingRoad?
maps=[44] # The Map ID of cycling roads (separated by ",")
for map in maps
return true if map == $game_map.map_id
end
return false
end
def bikespeed
slow = $RPGVX ? 4.5: 3.8
normal = $RPGVX ? 8.0: 5.2
fast = $RPGVX ? 8.5: 5.4
if onCyclingRoad?
dir= $game_player.direction
if dir==2
move_speed = fast
elsif dir==8
move_speed = slow
else
move_speed = normal
end
else
move_speed = normal
end
return move_speed
end
Code:
def update
if PBTerrain.isIce?(pbGetTerrainTag)
@move_speed = ($RPGVX) ? 6.5 : 4.8 # Sliding on ice
elsif !moving? && !@move_route_forcing && $PokemonGlobal
if $PokemonGlobal.bicycle
@move_speed = ($RPGVX) ? 8 : 5.2 # Cycling
elsif pbCanRun? || $PokemonGlobal.surfing || $PokemonGlobal.diving
@move_speed = ($RPGVX) ? 6.5 : 4.8 # Running, surfing or diving
else
@move_speed = ($RPGVX) ? 4.5 : 3.8 # Walking
end
end
update_old
end
Code:
def update
if PBTerrain.isIce?(pbGetTerrainTag)
@move_speed = ($RPGVX) ? 6.5 : 4.8 # Sliding on ice
elsif !moving? && !@move_route_forcing && $PokemonGlobal
if $PokemonGlobal.bicycle
@move_speed = bikespeed # Cycling
elsif pbCanRun? || $PokemonGlobal.surfing || $PokemonGlobal.diving
@move_speed = ($RPGVX) ? 6.5 : 4.8 # Running, surfi[CODE]
else
@move_speed = ($RPGVX) ? 4.5 : 3.8 # Walking
end
end
update_old
end[/CODE]
Finally, go to Game_Player (line 393) and find
Code:
#-----------------------------------------------------------------------------
# * 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
[U]dir=Input.dir4[/U]
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
$PokemonTemp.miniupdate
# Move player in the direction the directional button is being pressed
if dir==@lastdir && Graphics.frame_count-@lastdirframe>2
case dir
when 2; move_down
when 4; move_left
when 6; move_right
when 8; move_up
end
elsif dir!=@lastdir
case dir
when 2; turn_down
when 4; turn_left
when 6; turn_right
when 8; turn_up
end
end
end
$PokemonTemp.dependentEvents.updateDependentEvents
if dir!=@lastdir
@lastdirframe=Graphics.frame_count
end
@lastdir=dir
# Remember coordinates in local variables
last_real_x = @real_x
last_real_y = @real_y
super
center_x = (Graphics.width/2 - Game_Map::TILEWIDTH/2) *
Game_Map::XSUBPIXEL # Center screen x-coordinate * 4
center_y = (Graphics.height/2 - Game_Map::TILEHEIGHT/2) *
Game_Map::YSUBPIXEL # Center screen y-coordinate * 4
# If character moves and is now positioned off-centre of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > center_y
$game_map.scroll_down(@real_y - last_real_y) # Scroll map down
end
if @real_x < last_real_x and @real_x - $game_map.display_x < center_x
$game_map.scroll_left(last_real_x - @real_x) # Scroll map left
end
if @real_x > last_real_x and @real_x - $game_map.display_x > center_x
$game_map.scroll_right(@real_x - last_real_x) # Scroll map right
end
if @real_y < last_real_y and @real_y - $game_map.display_y < center_y
$game_map.scroll_up(last_real_y - @real_y) # Scroll map up
end
# Count down the time between allowed bump sounds
@bump_se -= 1 if @bump_se && @bump_se>0
# If not moving
unless moving?
if $PokemonTemp.endSurf
Kernel.pbCancelVehicles
$PokemonTemp.surfJump = nil
$PokemonTemp.endSurf = false
end
# If player was moving last time
if last_moving
$PokemonTemp.dependentEvents.pbTurnDependentEvents
result = pbCheckEventTriggerFromDistance([2])
# Event determinant is via touch of same position event
result |= check_event_trigger_here([1,2])
# If event which started does not exist
Kernel.pbOnStepTaken(result) # *Added function call
end
# If C button was pressed
if Input.trigger?(Input::C) && !$PokemonTemp.miniupdate
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,2]) # *Modified to prevent unnecessary triggers
end
end
end
end
Code:
# force down if on CYCLINGROAD
if onCyclingRoad?
dir=2 if dir==0 && !Input.press?(Input::B) #[X] holds position
end