[XP] Terrain Tag Speed Modifier

Started by ForeverZer0, March 01, 2010, 11:49:41 am

Previous topic - Next topic

ForeverZer0

March 01, 2010, 11:49:41 am Last Edit: March 01, 2010, 11:06:39 pm by ForeverZero
Terrain Tag Speed Modifier
Authors: ForeverZero
Version: 1.00
Type: Movement Add-on
Key Term: Movement Add-on



Introduction

Very simple script that will automatically change the player's move speed based on the Terrain Tag of the Tile ID they are walking on.  Good if you want your player to walk slower through high grass, moving up and down ladders, etc. without having to do it manually through eventing.


Features


  • Easily customized to your needs
  • Merely set the terrain tags in your database to change player speeds



Screenshots

None really required...


Demo

None


Script

Spoiler: ShowHide

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Terrain Speed Modifier
# Author: ForeverZero
# Version: 1.00
# Date: 2.28.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#   Player speed will be changed according to the current terrain tag of
#   the tile they are standing on. Can be modified as desired.
#
#   Just change terrain tags in Database as needed.
#  
#   Use Call Script ($game_system.terrain_tag_speeds = true/false)
#
#   See below to change default settings.
#  
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_System
 
 attr_accessor :terrain_tag_speeds
 
 alias terrain_tag_speeds_init initialize
 def initialize
   terrain_tag_speeds_init
   @terrain_tag_speeds = true
 end
end

   
class Game_Player
 attr_accessor :move_speed  
end

class Game_Map
                                         # Edit as needed
 alias terrain_move_speeds_upd update
 def update
   terrain_move_speeds_upd
   if $game_system.terrain_tag_speeds
     if $game_player.terrain_tag == 7  # If Terrain Tag = 7, Move Speed is 2
       $game_player.move_speed = 2
     elsif $game_player.terrain_tag == 6
       $game_player.move_speed = 3     # If Terrain Tag = 6, Move Speed is 3
     else
       $game_player.move_speed = 4     # Default Player Move Speed
     end
   end
 end
end



Instructions

Post above Main, and below Debug


Compatibility

Shouldn't be any. Possible if you are using a script that modifies player movement


Credits and Thanks


  • ForeverZero, for writing the script.



Author's Notes

None
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Holyrapid

Sounds nice. I think i´ll use this if i ever get my computer to work...

Tazero

Very good, Guess my event system is Inefficient now...


If you were a fish...

exile360

Ugh, sorry to necro this.

Thanks for this script, it's simple but cool and saves a lot of time making events. I put this in my project a while ago. Today when I started a new character for playtesting however, I found out that events which modify the player's speed never take effect because of this script, probably because it keeps changing the player's speed back to default. Is there any way to fix this? It kind of messes up my cutscenes, but I don't really want to let go of this... :P

KK20

Quote from: In the script itselfUse Call Script ($game_system.terrain_tag_speeds = true/false)





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

exile360