Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- #==============================================================================#
- # AMN Move Route Convenience
- # Version 1.02
- # Author: AMoonlessNight
- # Date: 21 Sep 2020
- # Latest: 22 Sep 2020
- #==============================================================================#
- # UPDATE LOG
- #------------------------------------------------------------------------------#
- # 21 Sep 2020 - created the script
- # 22 Sep 2020 - codes can be downcase or uppercase
- #==============================================================================#
- # TERMS OF USE
- #------------------------------------------------------------------------------#
- # - Please credit AMoonlessNight or A-Moonless-Night
- # - Free for non-commercial use; contact for commercial use
- # - If you would like to edit/adjust this script, please make edits as a new
- # script (do not edit this script directly) and provide proper credit
- # - I'd love to see your game if you end up using one of my scripts
- #==============================================================================#
- This script makes a few convenience methods for character move routes. If you
- want to make your character move up 4 times, you don't need to make 4 separate
- move commands---you can just use a simple script call in the move route.
- Use the following script call in the character's move route:
- <move X Y>
- X can be one of the following codes:
- MD or M2 move down
- ML or M4 move left
- MR or M6 move right
- MU or M8 move up
- MLL or M1 move lower left
- MLR or M3 move lower right
- MUL or M7 move upper left
- MUR or M9 move upper right
- MRAN move random
- MTWP move toward player
- MAWP move away from player
- MF move forward
- MB move backward
- M90R turn 90 degrees right
- M90L turn 90 degrees left
- M90RL turn 90 degrees right or left
- M180 turn 180 degrees
- MTRAN turn random
- Y should be the number of times the character should do that action
- For example, to make the character move up 4 times, you would use the script
- call in the move route:
- <move MU 4> or <move M8 4>
- IMPORTANT: the script call must be inside the move route (e.g. Set Move Route or
- in the event's custom move route). It will throw an error if you try doing it
- in a regular script call.
- =end
- #==============================================================================
- # Please do not edit below this point unless you know what you are doing.
- #==============================================================================
- class Game_Character < Game_CharacterBase
- MR_REGEX = /<move\s+(.+)\s(\d+)>/i
- MR_COMMANDS = {
- "md" => ROUTE_MOVE_DOWN,
- "m2" => ROUTE_MOVE_DOWN,
- "ml" => ROUTE_MOVE_LEFT,
- "m4" => ROUTE_MOVE_LEFT,
- "mr" => ROUTE_MOVE_RIGHT,
- "m6" => ROUTE_MOVE_RIGHT,
- "mu" => ROUTE_MOVE_UP,
- "m8" => ROUTE_MOVE_UP,
- "mll" => ROUTE_MOVE_LOWER_L,
- "m1" => ROUTE_MOVE_LOWER_L,
- "mlr" => ROUTE_MOVE_LOWER_R,
- "m3" => ROUTE_MOVE_LOWER_R,
- "mul" => ROUTE_MOVE_UPPER_L,
- "m7" => ROUTE_MOVE_UPPER_L,
- "mur" => ROUTE_MOVE_UPPER_R,
- "m9" => ROUTE_MOVE_UPPER_R,
- "mran" => ROUTE_MOVE_RANDOM,
- "mtwp" => ROUTE_MOVE_TOWARD,
- "mawp" => ROUTE_MOVE_AWAY,
- "mf" => ROUTE_MOVE_FORWARD,
- "mb" => ROUTE_MOVE_BACKWARD,
- "m90r" => ROUTE_TURN_90D_R,
- "m90l" => ROUTE_TURN_90D_L,
- "m180" => ROUTE_TURN_180D,
- "m90rl" => ROUTE_TURN_90D_R_L,
- "mtran" => ROUTE_TURN_RANDOM,
- }
- alias amn_moveroute_gamechara_forcemr force_move_route
- def force_move_route(move_route)
- move_route = move_route_parse(move_route)
- amn_moveroute_gamechara_forcemr(move_route)
- end
- def move_route_parse(move_route)
- move_route.list.each_with_index do |move, i|
- if move.code == ROUTE_SCRIPT && move.parameters[0] =~ MR_REGEX
- code = MR_COMMANDS[$1.strip.downcase]
- if code
- cmd = RPG::MoveCommand.new(code, [])
- $2.to_i.times { |mr| move_route.list.insert(i+1, cmd) }
- end
- move_route.list.delete_at(i)
- end
- end
- return move_route
- end
- end
- class Game_Event < Game_Character
- alias amn_moveroute_gameevent_setuppgset setup_page_settings
- def setup_page_settings
- amn_moveroute_gameevent_setuppgset
- @move_route = move_route_parse(@move_route)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement