MS Custom Movement + New Mode 07 + Caterpillar Walking

Medina Stories Custom Movement System Version: 1.1.0
By: Juan J. Sánchez

Introduction

This script combines MGCaladtogel's New Mode 07 script and Fukuyama's Caterpillar Walking script, along with my custom movement system, allowing more frames, eight directions, sneaking, dashing, idle animation, custom stances, and much more. It works with both custom and standard character sets. It now features Kristovski's Add-on, which adjusts the game controls in accordance with the rotation of the camera, allowing for a pseudo-3D experience.

Features

    Movement in four and eight directions
    Any standard amount of frames
    MGCaladtogel's New Mode 07 script compatibility
    Fukuyama's Caterpillar Walking script compatibility
    Kristovski's Add-on for MGCaladtogel's New Mode 07 (adjustment of game controls in accordance to the rotation of the camera)
    Simultaneous compatibility with both custom and standard character sets
    Standing frame
    Idle animation
    Custom stances for every direction (i.e., looking clockwise, looking counter clockwise, sitting, sitting looking clockwise, sitting looking counter clockwise, etc.)
    Dashing
    Sneaking
    Custom animations for every direction (frames, looping and speed can be customized)

Video



Screenshots

Image
Image

Demo

Medina Stories Custom Movement System v1.1.0 Demo
Medina Stories Custom Movement System v1.0.0 Demo

Script

MGCaladtogel's New Mode 07 script
MGCmode7.dll file
Fukuyama's Caterpillar Walking script

Content Hidden Spoiler
Medina Stories Custom Movement System
  1. #==============================================================================
  2. # ** Movement
  3. #------------------------------------------------------------------------------
  4. #  This module contains global variables and classes.
  5. #==============================================================================
  6.  
  7. module MOVEMENT
  8.   #--------------------------------------------------------------------------
  9.   # * General Configuration
  10.   #     DIR8_ENABLED : 8 directions input enabled
  11.   #     SUFFIX       : suffix for custom character sets
  12.   #     DIRECTIONS   : standard number of directions
  13.   #--------------------------------------------------------------------------
  14.   DIR8_ENABLED = true
  15.   SUFFIX       = '_custom'
  16.   DIRECTIONS   = 8
  17.     #----------------------------------------------------------------------
  18.     # ** Stances
  19.     #     STANCE_IDLE        : idle
  20.     #     STANCE_LOOKING_CW  : looking clockwise
  21.     #     STANCE_LOOKING_CCW : looking counter clockwise
  22.     #     STANCE_SITTING     : sitting
  23.     #     STANCE_SITTING_CW  : sitting looking clockwise
  24.     #     STANCE_SITTING_CCW : sitting looking counter clockwise
  25.     #----------------------------------------------------------------------
  26.     STANCE_IDLE        = 1
  27.     STANCE_LOOKING_CW  = 9
  28.     STANCE_LOOKING_CCW = 10
  29.     STANCE_SITTING     = 12
  30.     STANCE_SITTING_CW  = 11
  31.     STANCE_SITTING_CCW = 13
  32.     #----------------------------------------------------------------------
  33.     # ** Frames
  34.     #     TOTAL_FRAMES        : total number of frames
  35.     #     FRAMES              : standard number of frames
  36.     #     STAND_FRAME_ENABLED : standing frame enabled
  37.     #----------------------------------------------------------------------
  38.     TOTAL_FRAMES        = 13
  39.     FRAMES              = 8
  40.     STAND_FRAME_ENABLED = true
  41.     #----------------------------------------------------------------------
  42.     # ** Idle Animation
  43.     #     IDLE_ENABLED      : idle stance enabled
  44.     #     IDLE_TIME         : idle stance time delay
  45.     #     IDLE_FRAMES       : idle stance standard number of frames
  46.     #     IDLE_LOOP_ENABLED : idle stance loop enabled
  47.     #     IDLE_SPEED        : idle stance speed
  48.     #----------------------------------------------------------------------
  49.     IDLE_ENABLED      = true
  50.     IDLE_TIME         = 200
  51.     IDLE_FRAMES       = 8
  52.     IDLE_LOOP_ENABLED = true
  53.     IDLE_SPEED        = 2
  54.   #--------------------------------------------------------------------------
  55.   # * Action Configuration
  56.   #     SPEED_NORMAL : normal speed
  57.   #     SPEED_DASH   : dash speed
  58.   #     SPEED_SNEAK  : sneak speed
  59.   #--------------------------------------------------------------------------
  60.   SPEED_NORMAL = 3
  61.   SPEED_DASH   = 4
  62.   SPEED_SNEAK  = 1
  63.     #----------------------------------------------------------------------
  64.     # ** Buttons
  65.     #     DASH_BUTTON  : key for dashing
  66.     #     SNEAK_BUTTON : key for sneaking
  67.     #----------------------------------------------------------------------
  68.     DASH_BUTTON  = Input::Z
  69.     SNEAK_BUTTON = Input::Y
  70. end
  71.  
  72.  
  73. #==============================================================================
  74. # ** Game_Character
  75. #------------------------------------------------------------------------------
  76. #  This class deals with characters. It's used as a superclass for the
  77. #  Game_Player and Game_Event classes.
  78. #==============================================================================
  79.  
  80. class Game_Character  
  81.   #--------------------------------------------------------------------------
  82.   # * Modules
  83.   #--------------------------------------------------------------------------
  84.   include MOVEMENT                        # MOVEMENT module
  85.   #--------------------------------------------------------------------------
  86.   # * Public Instance Variables
  87.   #--------------------------------------------------------------------------
  88.   attr_reader   :step_anime               # character step flag
  89.   attr_reader   :walk_anime               # character movement flag
  90.   attr_reader   :stop_count               # number of steps left
  91.   attr_accessor :dashing                  # dashing flag
  92.   attr_accessor :sneaking                 # sneaking flag
  93.   attr_accessor :waiting                  # waiting flag
  94.   attr_accessor :looking_cw               # looking clockwise flag
  95.   attr_accessor :looking_ccw              # looking counter clockwise flag
  96.   attr_accessor :sitting                  # sitting flag
  97.   attr_accessor :sitting_cw               # sitting clockwise flag
  98.   attr_accessor :sitting_ccw              # sitting counter clockwise flag
  99.   #--------------------------------------------------------------------------
  100.   # * Frame Update
  101.   #--------------------------------------------------------------------------
  102.   def update
  103.     return update_custom_anim if @animating
  104.     if jumping?
  105.       update_jump
  106.     elsif moving?
  107.       update_move
  108.     else
  109.       update_stop
  110.     end
  111.     if @anime_count > 18 - @move_speed * 2
  112.       if not @step_anime and @stop_count > 0
  113.         @pattern = @original_pattern
  114.       else
  115.         if @character_name.include?(SUFFIX)
  116.           @pattern = ((@pattern + 1 ) % FRAMES)
  117.         else
  118.           @pattern = ((@pattern + 1 ) % 4)
  119.         end
  120.       end
  121.       @anime_count = 0
  122.     end
  123.     if @wait_count > 0
  124.       @wait_count -= 1
  125.       return
  126.     end
  127.     if @move_route_forcing
  128.       move_type_custom
  129.       return
  130.     end
  131.     return if @starting or lock?
  132.     if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
  133.       case @move_type
  134.       when 1  # Random
  135.         move_type_random
  136.       when 2  # Approach
  137.         move_type_toward_player
  138.       when 3  # Custom
  139.         move_type_custom
  140.       end
  141.     end
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # * Move Lower Left
  145.   #--------------------------------------------------------------------------  
  146.   def move_lower_left(turn_enabled = true)
  147.     if turn_enabled
  148.       turn_downleft
  149.     end
  150.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  151.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  152.       @x -= 1
  153.       @y += 1
  154.       increase_steps
  155.     end
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # * Move Lower Right
  159.   #--------------------------------------------------------------------------  
  160.   def move_lower_right(turn_enabled = true)
  161.     if turn_enabled
  162.       turn_downright
  163.     end
  164.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  165.       (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  166.       @x += 1
  167.       @y += 1
  168.       increase_steps
  169.     end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # * Move Upper Left
  173.   #--------------------------------------------------------------------------  
  174.   def move_upper_left(turn_enabled = true)
  175.     if turn_enabled
  176.       turn_upleft
  177.     end
  178.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  179.       (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  180.       @x -= 1
  181.       @y -= 1
  182.       increase_steps
  183.     end
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # * Move Upper Left
  187.   #--------------------------------------------------------------------------  
  188.   def move_upper_right(turn_enabled = true)
  189.     if turn_enabled
  190.       turn_upright
  191.     end
  192.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  193.       (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  194.       @x += 1
  195.       @y -= 1
  196.       increase_steps
  197.     end
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # * Move Random
  201.   #--------------------------------------------------------------------------
  202.   def move_random
  203.     case rand(8)
  204.     when 0  # Move down
  205.       move_down(false)
  206.     when 1  # Move left
  207.       move_left(false)
  208.     when 2  # Move right
  209.       move_right(false)
  210.     when 3  # Move up
  211.       move_up(false)
  212.     when 4  # Move lower left
  213.       move_lower_left
  214.     when 5  # Move lower right
  215.       move_lower_right
  216.     when 6  # Move upper left
  217.       move_upper_left
  218.     when 7  # Move upper right
  219.       move_upper_right
  220.     end
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # * Move Toward Player
  224.   #--------------------------------------------------------------------------
  225.   def move_toward_player
  226.     sx = @x - $game_player.x
  227.     sy = @y - $game_player.y
  228.     return if sx == 0 and sy == 0
  229.     abs_sx = sx.abs
  230.     abs_sy = sy.abs
  231.     if abs_sx == abs_sy
  232.       rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
  233.     end
  234.     move_down                   if sy < 0
  235.     move_left        if sx > 0
  236.     move_right       if sx < 0
  237.     move_up                     if sy > 0
  238.     move_lower_left  if sx > 0 and sy < 0
  239.     move_lower_right if sx < 0 and sy < 0
  240.     move_upper_left  if sx > 0 and sy > 0
  241.     move_upper_right if sx < 0 and sy > 0
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * Move Away From Player
  245.   #--------------------------------------------------------------------------
  246.   def move_away_from_player
  247.     sx = @x - $game_player.x
  248.     sy = @y - $game_player.y
  249.     return if sx == 0 and sy == 0
  250.     abs_sx = sx.abs
  251.     abs_sy = sy.abs
  252.     if abs_sx == abs_sy
  253.       rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
  254.     end
  255.     move_down                    if sy > 0    
  256.     move_left         if sx < 0
  257.     move_right        if sx > 0
  258.     move_up                      if sy < 0
  259.     move_lower_left   if sx < 0 and sy > 0
  260.     move_lower_right  if sx > 0 and sy > 0
  261.     move_upper_left   if sx < 0 and sy < 0
  262.     move_upper_right  if sx > 0 and sy < 0
  263.   end  
  264.   #--------------------------------------------------------------------------
  265.   # * Turn Upper Left
  266.   #--------------------------------------------------------------------------  
  267.   def turn_upleft
  268.     unless @direction_fix
  269.       if DIRECTIONS == 8
  270.         @direction = 7
  271.       else
  272.         @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  273.       end      
  274.     end
  275.     @stop_count = 0
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # * Turn Uppper Right
  279.   #--------------------------------------------------------------------------  
  280.   def turn_upright
  281.     unless @direction_fix
  282.       if DIRECTIONS == 8
  283.         @direction = 9
  284.       else
  285.         @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  286.       end
  287.     end
  288.     @stop_count = 0
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # * Turn Lower Left
  292.   #--------------------------------------------------------------------------  
  293.   def turn_downleft
  294.     unless @direction_fix
  295.       if DIRECTIONS == 8
  296.         @direction = 1
  297.       else
  298.         @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)        
  299.       end
  300.     end
  301.     @stop_count = 0
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # * Turn Lower Right
  305.   #--------------------------------------------------------------------------  
  306.   def turn_downright
  307.     unless @direction_fix
  308.       if DIRECTIONS == 8
  309.         @direction = 3
  310.       else
  311.         @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  312.       end
  313.     end
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # * Set Custom Animation
  317.   #--------------------------------------------------------------------------
  318.   def set_custom_anim
  319.     return if @animating
  320.     @total_frames = FRAMES
  321.     @total_frames = IDLE_FRAMES       if @waiting
  322.     @loop_enabled = false
  323.     @loop_enabled = IDLE_LOOP_ENABLED if @waiting
  324.     @anim_speed   = 1
  325.     @anim_speed   = IDLE_SPEED        if @waiting
  326.     @frame_count  = @total_frames
  327.     @anim_wait    = 0
  328.     @pattern      = 0
  329.     @animating    = true
  330.   end  
  331.   #--------------------------------------------------------------------------
  332.   # * Frame Update (custom animation)
  333.   #--------------------------------------------------------------------------
  334.   def update_custom_anim
  335.     update_jump if jumping?
  336.     if @anim_wait >= 8
  337.       @pattern = ((@pattern + 1 ) % @total_frames)
  338.       @frame_count -= 1
  339.       @anim_wait = 0
  340.     end
  341.     @anim_wait += @anim_speed if @anim_wait < 18 - @move_speed * 2
  342.     if @frame_count == 0
  343.       if @loop_enabled == true
  344.         @frame_count = @total_frames
  345.       else
  346.         end_custom_anim
  347.       end
  348.       return
  349.     end
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # * End Custom Animation
  353.   #--------------------------------------------------------------------------
  354.   def end_custom_anim
  355.     @animating = false
  356.     @waiting   = false if @waiting
  357.   end
  358. end
  359.  
  360.  
  361. #==============================================================================
  362. # ** Game_Player
  363. #------------------------------------------------------------------------------
  364. #  This class handles the player. Its functions include event starting
  365. #  determinants and map scrolling. Refer to "$game_player" for the one
  366. #  instance of this class.
  367. #==============================================================================
  368.  
  369. class Game_Player < Game_Character
  370.   #--------------------------------------------------------------------------
  371.   # * Modules
  372.   #--------------------------------------------------------------------------
  373.   include MOVEMENT                        # MOVEMENT module
  374.   #--------------------------------------------------------------------------
  375.   # * Invariables
  376.   #--------------------------------------------------------------------------
  377.   @@idle_time = 0
  378.   #--------------------------------------------------------------------------
  379.   # * Public Instance Variables
  380.   #--------------------------------------------------------------------------
  381.   attr_accessor :idle_time                # idle time
  382.   #--------------------------------------------------------------------------
  383.   # * Frame Update
  384.   #--------------------------------------------------------------------------
  385.   def update
  386.     @idle_time = @@idle_time
  387.     unless $game_system.map_interpreter.running? or $game_temp.message_window_showing
  388.       @dashing  = false
  389.       @sneaking = false
  390.       trigger_d unless DASH_BUTTON  == nil
  391.       trigger_s unless SNEAK_BUTTON == nil
  392.       unless @dashing or @sneaking
  393.         @move_speed = SPEED_NORMAL
  394.       end
  395.     end
  396.     last_moving = moving?
  397.     unless moving? or $game_system.map_interpreter.running? or
  398.            @move_route_forcing or $game_temp.message_window_showing  
  399.         if DIR8_ENABLED == true
  400.           case Input.dir8
  401.           when 2  # Move down
  402.             move_down
  403.           when 4  # Move left
  404.             move_left
  405.           when 6  # Move right
  406.             move_right
  407.           when 8  # Move up
  408.             move_up
  409.           when 1  # Move lower left
  410.             move_lower_left
  411.           when 3  # Move lower right
  412.             move_lower_right
  413.           when 7  # Move upper left
  414.             move_upper_left
  415.           when 9  # Move upper right
  416.             move_upper_right
  417.           end
  418.           if IDLE_ENABLED
  419.             if Input.dir8 == 0
  420.               @@idle_time += 1 unless @waiting
  421.               trigger_w if @@idle_time == IDLE_TIME
  422.             else
  423.               @@idle_time = 0
  424.               @waiting = false
  425.               end_custom_anim
  426.             end
  427.           end
  428.         else
  429.           case Input.dir4
  430.           when 2  # Move down
  431.             move_down
  432.           when 4  # Move left
  433.             move_left
  434.           when 6  # Move right
  435.             move_right
  436.           when 8  # Move up
  437.             move_up
  438.           end
  439.           if IDLE_ENABLED
  440.             if Input.dir4 == 0
  441.               @@idle_time += 1 unless @waiting
  442.               trigger_w if @@idle_time == IDLE_TIME
  443.             else
  444.               @@idle_time = 0
  445.               @waiting = false
  446.               end_custom_anim
  447.             end
  448.           end
  449.         end
  450.       end
  451.     last_real_x = @real_x
  452.     last_real_y = @real_y
  453.     super
  454.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  455.       $game_map.scroll_down(@real_y - last_real_y)
  456.     end
  457.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  458.       $game_map.scroll_left(last_real_x - @real_x)
  459.     end
  460.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  461.       $game_map.scroll_right(@real_x - last_real_x)
  462.     end
  463.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  464.       $game_map.scroll_up(last_real_y - @real_y)
  465.     end
  466.     unless moving?
  467.       if last_moving
  468.         result = check_event_trigger_here([1,2])
  469.         if result == false
  470.           unless $DEBUG and Input.press?(Input::CTRL)
  471.             if @encounter_count > 0
  472.               @encounter_count -= 1
  473.             end
  474.           end
  475.         end
  476.       end
  477.       if Input.trigger?(Input::C)
  478.         check_event_trigger_here([0])
  479.         check_event_trigger_there([0,1,2])
  480.       end
  481.     end
  482.   end
  483.   #----------------------------------------------------------------------
  484.   # * Trigger Processing: Dash
  485.   #----------------------------------------------------------------------  
  486.   def trigger_d
  487.     return if (DIR8_ENABLED ? Input.dir8 == 0 : Input.dir4 == 0)    
  488.     return if Input.press?(SNEAK_BUTTON)
  489.     if Input.press?(DASH_BUTTON)
  490.       @dashing    = true
  491.       @move_speed = SPEED_DASH
  492.     end    
  493.   end
  494.   #----------------------------------------------------------------------
  495.   # * Trigger Processing: Sneak
  496.   #----------------------------------------------------------------------  
  497.   def trigger_s
  498.     return if (DIR8_ENABLED ? Input.dir8 == 0 : Input.dir4 == 0)
  499.     return if Input.press?(DASH_BUTTON)
  500.     if Input.press?(SNEAK_BUTTON)
  501.       @sneaking   = true
  502.       @move_speed = SPEED_SNEAK
  503.     end
  504.   end
  505.   #----------------------------------------------------------------------
  506.   # * Trigger Processing: Idle
  507.   #----------------------------------------------------------------------  
  508.   def trigger_w
  509.     @@idle_time = 0
  510.     @waiting    = true
  511.     self.set_custom_anim
  512.   end
  513. end
  514.  
  515.  
  516. #==============================================================================
  517. # ** Sprite_Character
  518. #------------------------------------------------------------------------------
  519. #  This sprite is used to display the character.It observes the Game_Character
  520. #  class and automatically changes sprite conditions.
  521. #==============================================================================
  522.  
  523. class Sprite_Character < RPG::Sprite
  524.   #--------------------------------------------------------------------------
  525.   # * Modules
  526.   #--------------------------------------------------------------------------
  527.   include MOVEMENT                        # MOVEMENT module
  528.   #--------------------------------------------------------------------------
  529.   # * Frame Update
  530.   #--------------------------------------------------------------------------
  531.   def update
  532.     super
  533.     if @tile_id != @character.tile_id or
  534.        @character_name != @character.character_name or
  535.        @character_hue != @character.character_hue
  536.       @tile_id = @character.tile_id
  537.       @character_name = @character.character_name
  538.       @character_hue = @character.character_hue
  539.       if @tile_id >= 384
  540.         self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  541.           @tile_id, @character.character_hue)
  542.         self.src_rect.set(0, 0, 32, 32)
  543.         self.ox = 16
  544.         self.oy = 32
  545.       else
  546.         self.bitmap = RPG::Cache.character(@character.character_name,
  547.           @character.character_hue)
  548.         if @character.character_name.include?(SUFFIX)
  549.           if STAND_FRAME_ENABLED
  550.             @cw = bitmap.width / (TOTAL_FRAMES + 1)
  551.           else
  552.             @cw = bitmap.width / TOTAL_FRAMES
  553.           end
  554.           @ch = bitmap.height / DIRECTIONS
  555.         else
  556.           @cw = bitmap.width / 4
  557.           @ch = bitmap.height / 4
  558.         end
  559.         self.ox = @cw / 2
  560.         self.oy = @ch
  561.       end
  562.     end
  563.     self.visible = (not @character.transparent)
  564.     if @tile_id == 0
  565.       if @character.character_name.include?(SUFFIX)
  566.         if not @character.step_anime and @character.stop_count > 0
  567.           if @character.waiting
  568.             sx = (@character.pattern + STANCE_IDLE) * @cw
  569.           else
  570.             sx = @character.pattern * @cw
  571.           end
  572.         else
  573.           if STAND_FRAME_ENABLED
  574.             sx = (@character.pattern + 1) * @cw
  575.           else
  576.             sx = @character.pattern * @cw
  577.           end
  578.         end
  579.       else
  580.         sx = @character.pattern * @cw
  581.       end
  582.       sx = STANCE_LOOKING_CW  * @cw if @character.looking_cw
  583.       sx = STANCE_LOOKING_CCW * @cw if @character.looking_ccw
  584.       sx = STANCE_SITTING     * @cw if @character.sitting
  585.       sx = STANCE_SITTING_CW  * @cw if @character.sitting_cw
  586.       sx = STANCE_SITTING_CCW * @cw if @character.sitting_ccw
  587.       if @character.character_name.include?(SUFFIX)
  588.         if DIRECTIONS == 8
  589.           value = (@character.direction == 7 or @character.direction == 9) ? 3 : 1
  590.           sy = (@character.direction - value) * @ch
  591.         else
  592.           sy = (@character.direction - 2) / 2 * @ch
  593.         end
  594.       else
  595.         sy = (@character.direction - 2) / 2 * @ch
  596.       end
  597.       self.src_rect.set(sx, sy, @cw, @ch)
  598.     end
  599.     self.x = @character.screen_x
  600.     self.y = @character.screen_y
  601.     self.z = @character.screen_z(@ch)
  602.     self.opacity = @character.opacity
  603.     self.blend_type = @character.blend_type
  604.     self.bush_depth = @character.bush_depth
  605.     if @character.animation_id != 0
  606.       animation = $data_animations[@character.animation_id]
  607.       animation(animation, true)
  608.       @character.animation_id = 0
  609.     end
  610.   end
  611. end
Expand to see the code.


MGCaladtogel's New Mode 07 / MS Custom Movement Patch
  1. #==============================================================================
  2. # ** Sprite_Character
  3. #------------------------------------------------------------------------------
  4. #  This sprite is used to display the character.It observes the Game_Character
  5. #  class and automatically changes sprite conditions.
  6. #==============================================================================
  7.  
  8. class Sprite_Character < RPG::Sprite
  9.   #--------------------------------------------------------------------------
  10.   # * Modules
  11.   #--------------------------------------------------------------------------
  12.   include MOVEMENT                        # MOVEMENT module
  13.   #--------------------------------------------------------------------------
  14.   # * Aliased methods (F12 compatibility)
  15.   #--------------------------------------------------------------------------
  16.   if !@already_aliased
  17.     alias update_neoM7_sprite_character update
  18.     @already_aliased = true
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # * Update
  22.   #--------------------------------------------------------------------------
  23.   def update
  24.     if !$game_system.neoM7
  25.       update_neoM7_sprite_character
  26.       return
  27.     end
  28.     super
  29.     if @tile_id != @character.tile_id or
  30.        @character_name != @character.character_name or
  31.        @character_hue != @character.character_hue
  32.       @tile_id = @character.tile_id
  33.       @character_name = @character.character_name
  34.       @character_hue = @character.character_hue
  35.       if @tile_id >= 384
  36.         self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  37.           @tile_id, @character.character_hue)
  38.         self.src_rect.set(0, 0, 32, 32)
  39.         self.ox = 16
  40.         self.oy = 32
  41.       else
  42.         self.bitmap = RPG::Cache.character(@character.character_name,
  43.           @character.character_hue)
  44.         if @character.character_name.include?(SUFFIX)
  45.           if STAND_FRAME_ENABLED
  46.             @cw = bitmap.width / (TOTAL_FRAMES + 1)
  47.           else
  48.             @cw = bitmap.width / TOTAL_FRAMES
  49.           end
  50.           @ch = bitmap.height / DIRECTIONS
  51.         else
  52.           @cw = bitmap.width / 4
  53.           @ch = bitmap.height / 4
  54.         end
  55.         self.ox = @cw / 2
  56.         self.oy = @ch
  57.       end
  58.     end
  59.     self.visible = (not @character.transparent)
  60.     if @tile_id == 0
  61.       if @character.character_name.include?(SUFFIX)
  62.         if not @character.step_anime and @character.stop_count > 0
  63.           if @character.waiting
  64.             sx = (@character.pattern + STANCE_IDLE) * @cw
  65.           else
  66.             sx = @character.pattern * @cw
  67.           end
  68.         else
  69.           if STAND_FRAME_ENABLED
  70.             sx = (@character.pattern + 1) * @cw
  71.           else
  72.             sx = @character.pattern * @cw
  73.           end
  74.         end
  75.       else
  76.         sx = @character.pattern * @cw
  77.       end
  78.       sx = STANCE_LOOKING_CW  * @cw if @character.looking_cw
  79.       sx = STANCE_LOOKING_CCW * @cw if @character.looking_ccw
  80.       sx = STANCE_SITTING     * @cw if @character.sitting
  81.       sx = STANCE_SITTING_CW  * @cw if @character.sitting_cw
  82.       sx = STANCE_SITTING_CCW * @cw if @character.sitting_ccw
  83.       if @character.character_name.include?(SUFFIX)
  84.         if DIRECTIONS == 8
  85.           dir = (@character.direction == 7 or @character.direction == 9) ? 3 : 1
  86.           current_dir = (@character.direction - dir)
  87.           theta = $scene.spriteset.tilemap.theta rescue 0
  88.           if $scene.spriteset != nil and $scene.spriteset.tilemap.is_a?(Tilemap_neoM7)
  89.             dir_list = [0, 1, 2, 5, 6, 7, 4, 3]
  90.             current_dir = dir_list[(dir_list.index(current_dir % 8) + ((theta + 22.5) % 360) / 45) % 8]
  91.           end
  92.           sy = current_dir * @ch
  93.         else
  94.           current_dir = (@character.direction - 2) / 2
  95.           theta = $scene.spriteset.tilemap.theta rescue 0
  96.           if $scene.spriteset != nil and $scene.spriteset.tilemap.is_a?(Tilemap_neoM7)
  97.             dir_list = [0, 2, 3, 1]
  98.             current_dir = dir_list[(dir_list.index(current_dir % 4) + ((theta + 45) % 360) / 90) % 4]
  99.           end
  100.           sy = current_dir * @ch
  101.         end
  102.       else
  103.         current_dir = (@character.direction - 2) / 2
  104.         theta = $scene.spriteset.tilemap.theta rescue 0
  105.         if $scene.spriteset != nil and $scene.spriteset.tilemap.is_a?(Tilemap_neoM7)
  106.           dir_list = [0, 2, 3, 1]
  107.           current_dir = dir_list[(dir_list.index(current_dir % 4) + ((theta + 45) % 360) / 90) % 4]
  108.         end
  109.         sy = current_dir * @ch
  110.       end
  111.       self.src_rect.set(sx, sy, @cw, @ch)
  112.       self.length = @cw
  113.       self.height = @ch
  114.     end
  115.     x_intermediate = @character.screen_x
  116.     y_intermediate = @character.screen_y - 4
  117.     if $game_system.neoM7_loop
  118.       diff_y = ($game_player.y - @character.y).to_i
  119.       offset_y = ($game_map.height << 5) * (diff_y >= 0 ?
  120.       (diff_y / ($game_map.height >> 1)) :
  121.       (diff_y / ($game_map.height >> 1)) + 1)
  122.       diff_x = ($game_player.x - @character.x).to_i
  123.       offset_x = ($game_map.width << 5) * (diff_x >= 0 ?
  124.       (diff_x / ($game_map.width >> 1)) :
  125.       (diff_x / ($game_map.width >> 1)) + 1)
  126.       neoM7_character(x_intermediate + offset_x, y_intermediate + offset_y)
  127.     else
  128.       neoM7_character(x_intermediate, y_intermediate)
  129.     end
  130.     if !on_screen_x(x) or !on_screen_y(y)
  131.       self.opacity = 0
  132.       return
  133.     end
  134.     neoM7_zoom(x, y)
  135.     self.opacity = 255
  136.     self.z = 4 * y
  137.     self.y -= 32 * @character.height * zoom_y
  138.     self.blend_type = @character.blend_type
  139.     self.bush_depth = @character.bush_depth
  140.     if @character.animation_id != 0
  141.       animation = $data_animations[@character.animation_id]
  142.       animation(animation, true)
  143.       @character.animation_id = 0
  144.     end
  145.   end
  146. end
Expand to see the code.


Fukuyama's Caterpillar Walking / MS Custom Movement Patch
  1. #==============================================================================
  2. # ** Movement
  3. #------------------------------------------------------------------------------
  4. #  Caterpillar movement of actor is carried out on map.
  5. #==============================================================================
  6.  
  7. module Train_Actor
  8.   #============================================================================
  9.   # ** Game_Party_Actor
  10.   #----------------------------------------------------------------------------
  11.   #  This class handles the party train actors. Its functions include event
  12.   #  starting determinants and map scrolling.
  13.   #============================================================================
  14.  
  15.   class Game_Party_Actor < Game_Character
  16.     #------------------------------------------------------------------------
  17.     # * Modules
  18.     #------------------------------------------------------------------------
  19.     include MOVEMENT                        # MOVEMENT module
  20.     #------------------------------------------------------------------------
  21.     # * Move Lower Left
  22.     #------------------------------------------------------------------------
  23.     def move_lower_left(turn_enabled = true)
  24.       if turn_enabled
  25.         turn_downleft
  26.       end
  27.       if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  28.          (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  29.         @x -= 1
  30.         @y += 1
  31.         increase_steps
  32.       end
  33.     end
  34.     #------------------------------------------------------------------------
  35.     # * Move Lower Right
  36.     #------------------------------------------------------------------------
  37.     def move_lower_right(turn_enabled = true)
  38.       if turn_enabled
  39.         turn_downright
  40.       end
  41.       if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  42.         (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  43.         @x += 1
  44.         @y += 1
  45.         increase_steps
  46.       end
  47.     end
  48.     #------------------------------------------------------------------------
  49.     # * Move Upper Left
  50.     #------------------------------------------------------------------------
  51.     def move_upper_left(turn_enabled = true)
  52.       if turn_enabled
  53.         turn_upleft
  54.       end
  55.       if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  56.         (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  57.         @x -= 1
  58.         @y -= 1
  59.         increase_steps
  60.       end
  61.     end
  62.     #------------------------------------------------------------------------
  63.     # * Move Upper Right
  64.     #------------------------------------------------------------------------
  65.     def move_upper_right(turn_enabled = true)
  66.       if turn_enabled
  67.         turn_upright
  68.       end
  69.       if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  70.         (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  71.         @x += 1
  72.         @y -= 1
  73.         increase_steps
  74.       end
  75.     end
  76.     #------------------------------------------------------------------------
  77.     # * Frame Update
  78.     #------------------------------------------------------------------------
  79.     if @train_patch_stack.nil?
  80.       @train_patch_stack = true
  81.       alias train_patch_update update
  82.       def update
  83.         train_patch_update
  84.         @dashing   = $game_player.dashing
  85.         @sneaking  = $game_player.sneaking
  86.         @waiting   = $game_player.waiting
  87.         @idle_time = nil if !@waiting
  88.         if @waiting && @character_name.include?(SUFFIX)
  89.           @idle_time = $game_player.idle_time if @idle_time == nil
  90.           @idle_time += 1
  91.           if @idle_time == IDLE_TIME
  92.             @idle_time = 0
  93.             @waiting   = true
  94.             self.set_custom_anim
  95.           end
  96.         end
  97.         self.end_custom_anim if !@waiting
  98.       end
  99.     end
  100.   end
  101. end
Expand to see the code.


Kristovski's Add-on
  1. #============================================================================
  2. # Add-on for H-Mode7 Engine
  3. # V.1.1 - 10/01/2011
  4. # Author : MGC
  5. #
  6. # This add-on reorients the direction controls when the map is rotated.
  7. # This is a request from Kristovki.
  8. #============================================================================
  9. module Input
  10.   #--------------------------------------------------------------------------
  11.   # * Aliased methods (F12 compatibility)
  12.   #--------------------------------------------------------------------------
  13.   class << self
  14.     if !@already_aliased
  15.       alias dir4_neoM7_input dir4
  16.       alias dir8_neoM7_input dir8
  17.       @already_aliased = true
  18.     end
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # * Dir4
  22.   #--------------------------------------------------------------------------
  23.   Left = [6, 2, 8, 4]
  24.   def self.dir4
  25.     unless $game_system.neoM7
  26.       return dir4_neoM7_input
  27.     end
  28.     input_value = dir4_neoM7_input
  29.     unless input_value == 0
  30.       case $game_system.neoM7_theta
  31.       when 45...135
  32.         camera_direction = 4
  33.       when 135...225
  34.         camera_direction = 2
  35.       when 225...315
  36.         camera_direction = 6
  37.       else
  38.         camera_direction = 8
  39.       end
  40.       case camera_direction
  41.       when 2
  42.         input_value = 10 - input_value
  43.       when 4
  44.         input_value = 10 - Left[(input_value >> 1) - 1]
  45.       when 6
  46.         input_value = Left[(input_value >> 1) - 1]
  47.       when 8
  48.         input_value = input_value
  49.       end
  50.     end
  51.     return input_value
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # * Dir8 - V.1.1
  55.   #--------------------------------------------------------------------------
  56.   Dir8_Index = [0, 5, 4, 3, 6, 0, 2, 7, 0, 1]
  57.   Dir8_Left = [8, 9, 6, 3, 2, 1, 4, 7]
  58.   def self.dir8
  59.     unless $game_system.neoM7
  60.       return dir8_neoM7_input
  61.     end
  62.     input_value = dir8_neoM7_input
  63.     unless input_value == 0
  64.       offset = (($game_system.neoM7_theta + 23) / 45) % 8
  65.       input_value = Dir8_Left[(Dir8_Index[input_value] + offset) % 8]
  66.     end
  67.     return input_value
  68.   end
  69. end
Expand to see the code.


Drawing Actor Graphic / MS Custom Movement Patch
  1. #==============================================================================
  2. # ** Window_Base
  3. #------------------------------------------------------------------------------
  4. #  This class is for all in-game windows.
  5. #==============================================================================
  6.  
  7. class Window_Base < Window
  8.   #--------------------------------------------------------------------------
  9.   # * Modules
  10.   #--------------------------------------------------------------------------
  11.   include MOVEMENT                        # MOVEMENT module
  12.   #--------------------------------------------------------------------------
  13.   # * Draw Actor Graphic
  14.   #     actor : actor
  15.   #     x     : draw spot x-coordinate
  16.   #     y     : draw spot y-coordinate
  17.   #--------------------------------------------------------------------------
  18.   def draw_actor_graphic(actor, x, y)
  19.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  20.     if actor.character_name.include?(SUFFIX)
  21.       if STAND_FRAME_ENABLED
  22.         cw = bitmap.width / (TOTAL_FRAMES + 1)
  23.       else
  24.         cw = bitmap.width / TOTAL_FRAMES
  25.       end
  26.       ch = bitmap.height / DIRECTIONS
  27.     else
  28.       cw = bitmap.width / 4
  29.       ch = bitmap.height / 4
  30.     end    
  31.     src_rect = Rect.new(0, 0, cw, ch)
  32.     self.contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect)
  33.   end
  34. end
Expand to see the code.


Instructions

Copy the scripts in the same order they were posted. The script, Medina Stories Custom Movement System, works as a stand-alone script. If you add MGCaladtogel's New Mode 07 script, you must add the MGCaladtogel's New Mode 07 / MS Custom Movement Patch. Remember to add the MGCmode7.dll file in your game folder if using MGCaladtogel's New Mode 07 script. If you add Fukuyama's Caterpillar Walking script, you must add the Fukuyama's Caterpillar Walking / MS Custom Movement Patch. Kristovski's Add-on allows you to change game controls in accordance to the rotation of the camera. The Draw Actor Graphic / MS Custom Movement Patch is necessary to fix an error in standard menus. If you are using custom menus, you might not need this patch.

The script works with almost any character set. You can configure the character set in the MOVEMENT module at the beginning of the Medina Stories Custom Movement System script. Every custom character set must have a suffix which can be defined in the MOVEMENT module. The standard suffix is "_custom". You can use the following character set from the MMORPG Ragnarok Online to test the script.

Image

Configuring and activating custom stances

Content Hidden Spoiler
Step 1. In the MOVEMENT module, under General Configuration, in the subsection Stances, add a variable with the frame number of your stance. The variable name should be written in capital letters and should be easy to remember. The standard name is "STANCE_<NAME>". For the purpose of teaching, I shall be using the name "STANCE_SITTING".

  1. STANCE_SITTING = 1
Expand to see the code.


Step 2. In the Game_Character class, under Public Instance Variables, add an attribute accessor with the same name as your stance. The attribute accessor name should be written in lower case letters. If your variable name is "STANCE_SITTING", your attribute accessor name should be "sitting".

  1. attr_accessor :sitting
Expand to see the code.


Step 3. In the Sprite_Character class, under update method, add the following code in line 582. If using MGCaladtogel's New Mode 07 / MS Custom Movement Patch, do this in the patch in line 78. This concludes the configuration of custom stances.

  1. sx = STANCE_SITTING  * @cw if @character.sitting
Expand to see the code.


Step 4. To activate a custom stance for a given character, event or player, in Event Commands, under Move Event..., under Script..., add the following code.

  1. self.sitting = true
Expand to see the code.


Step 5. To inactivate a custom stance for a given character, event or player, in Event Commands, under Move Event..., under Script..., add the following code.

  1. self.sitting = false
Expand to see the code.


Configuring and activating custom animations

Content Hidden Spoiler
Step 1. In the MOVEMENT module, under General Configuration, in the subsection Stances, add a variable with the initial frame number of your animation. The variable name should be written in capital letters and should be easy to remember. The standard name is "STANCE_<NAME>". For the purpose of teaching, I shall be using the name "STANCE_ATTACKING".

  1. STANCE_ATTACKING = 1
Expand to see the code.


Step 2. In the MOVEMENT module, under General Configuration, make a new subsection and add the following variables: <NAME>_FRAMES, <NAME>_LOOP_ENABLED and <NAME>_SPEED. The first variable determines how many frames the animation has. The second variable determines whether the animation stops or whether it plays in an infinite loop. The third variable determines the animation speed, from 1, the slowest speed, to 8, the fastest speed.

  1. #----------------------------------------------------------------------
  2. # ** Attacking Animation
  3. #     ATTACKING_FRAMES       : attacking stance standard number of frames
  4. #     ATTACKING_LOOP_ENABLED : attacking stance loop enabled
  5. #     ATTACKING_SPEED        : attacking stance speed
  6. #----------------------------------------------------------------------
  7. ATTACKING_FRAMES       = 8
  8. ATTACKING_LOOP_ENABLED = true
  9. ATTACKING_SPEED        = 2
Expand to see the code.


Step 3. In the Game_Character class, under Public Instance Variables, add an attribute accessor with the same name as your animation. The attribute accessor name should be written in lower case letters. If your variable name is "STANCE_ATTACKING", your attribute accessor name should be "attacking".

  1. attr_accessor :attacking
Expand to see the code.


Step 4. In the Game_Character class, under set_custom_anim method, add the following code at the beginning of the method, after the variables have been declared.

  1. @total_frames = FRAMES
  2. @total_frames = ATTACKING_FRAMES       if @attacking
  3. @loop_enabled = false
  4. @loop_enabled = ATTACKING_LOOP_ENABLED if @attacking
  5. @anim_speed   = 1
  6. @anim_speed   = ATTACKING_SPEED        if @attacking
Expand to see the code.


Step 5. In the Game_Character class, under end_custom_anim method, add the following code at the end of the method.

  1. @attacking = false if @attacking
Expand to see the code.


Step 6. In the Sprite_Character class, under update method, add the following code in line 582. If using MGCaladtogel's New Mode 07 / MS Custom Movement Patch, do this in the patch in line 78. This concludes the configuration of custom animations.

  1. sx = (@character.pattern + STANCE_ATTACKING) if @character.attacking
Expand to see the code.


Step 7. To activate a custom animation for a given character, event or player, in Event Commands, under Move Event..., under Script..., add the following code.

  1. self.attacking = true
  2. self.set_custom_anim
Expand to see the code.


Step 8. To inactivate a custom animation for a given character, event or player, in Event Commands, under Move Event..., under Script..., add the following code.

  1. self.end_custom_anim
Expand to see the code.


Compatibility

Not SDK compatible.

The script rewrites the following classes: Game_Character, Game_Player and Sprite_Character. MGCaladtogel's New Mode 07 script and Fukuyama's Caterpillar Walking script rewrite classes of their own.

The script assumes all characters, both events and players, have the same amount of directions. When using characters with different amount of directions, movement might become funny.

There seems to be an error with MGCaladtogel's New Mode 07 script. When looping a map, vertical sprites become unstable. You might want to avoid vertical sprites in looped maps, such as world maps.

Please inform me of any other compatibility issues.

Credits and Thanks

All credits for the Medina Stories Custom Movement System go to Juan J. Sánchez. Do not credit me as medinastories, Medina, Medina Stories, or any other variation of these names.

The New Mode 07 script and Kristovski's Add-on were written by MGCaladtogel. The Caterpillar Walking script was written by Fukuyama. I do not count with permissions to distribute the aforementioned scripts.

The character set provided, obtained from the MMORPG Ragnarok Online, is property of Gravity Co., LTD.

Special thanks go to DerVVulfman, whose scripts I edited to write my own. For a similar insight into custom movement, I suggest searching for DerVVulfman's Eight Directions & More Frames script.

Author's Notes

This script was designed for my RPG Maker XP project, Medina Stories. I first had the idea to make this script a couple of years ago upon encountering MGCaladtogel's New Mode 07 script. When I further analyzed DerVVulfman's Eight Directions & More Frames script, I decided to write my own script, specially designed for MMORPG Ragnarok Online character sets. After writing the Medina Stories Custom Movement System script, I then wrote the Fukuyama's Caterpillar Walking / MS Custom Movement Patch. Then I wrote the MGCaladtogel's New Mode 07 / MS Custom Movement Patch. Finally, I wrote the Draw Actor Graphic / MS Custom Movement Patch.

Terms and Conditions

Free for Commercial Use. Must include the scripter's name.
I still need to add a demo and to explain how to set up and activate custom stances and animations. The latter, unfortunately, is complicated and requires scripting. It's not terribly complicated, but it's definitely not recommended for anyone who doesn't know Ruby programming language.

EDIT: The demo is done. Since the last time I created an event system, RPG Maker 2000 was still popular, the demo works erratically, even though the system works perfectly. If anyone has any problems at all setting up a custom stance or animation, please let me know, and I will help you.
Oh geeze, it's that time of the year again. (That time is refering to the period where scripters happily release scripts with lots and lots of constants in it for random kids putting it in their 08/15 projects, rejoicing from 5000 functions that the didn't really need, but now that they got it will try to include. Especially mysterious, as you said you have to know RGSS to use the script - something's wrong there!)

Ranting aside, it's an interesting bunch of scripts... the preview screenshot looks pretty decent and visually attractive even with default graphics and the drag queen, but that might just be me, as I like RO graphics. The script itself is alright-if-not-perfectly documented, but you're definately able to find your way through it (especially since all movement systems more or less share the same architechture). The constants I don't like as much (that's right, still fighting!), but whatever floats your boat. You also have a lot of strange method names, such as 'trigger_d' - that you definately want to change, in my opinion.
You got a few inconsistancies with what most people write when writing RMVXP scripts, like capitalizing the module names, or including modules elsewhere. That makes it harder to read through your script in case you want to adjust something to your liking, so if that's something you care about, you might want to change that.
Other than that, it's written better than a lot of scripts I've seen... some fine tuning on the scripting style should make a pretty decent scripting fella out of you.

On a somewhat random side note, your RO sprite alignment seems a bit off... I can explain it to you in detail if you want (per PM though, not gonna spam your thread ^^), but basically, you have to align them by the head, then adjust the individual frames vertically by 1 pixel up or down. As I said, if you don't know what I'm talking about, ask for a more detailed explanation, please.
BlueScope wrote:
On a somewhat random side note, your RO sprite alignment seems a bit off... I can explain it to you in detail if you want (per PM though, not gonna spam your thread ^^), but basically, you have to align them by the head, then adjust the individual frames vertically by 1 pixel up or down. As I said, if you don't know what I'm talking about, ask for a more detailed explanation, please.


I know the horizontal alignment is off by a few pixels, specially when walking sideways. The vertical alignment, believe it or not, is perfectly well aligned.The master file, which is perfectly aligned, it's based on a 256x256 grid. When I transposed it, the program moved the horizontal frames slightly. I've learned the only good way of doing this is taking your time.

I apologize for the many variables and functions in this script. Quite sincerely, the script was designed specifically for MMORPG Ragnarok Online character sets. Also, I don't believe you need to know RGSS to make the script work. But if you were to add custom animations or poses, you would probably need to know, at the very least, what is a variable.

You know, in high school I took Computer Science courses and learned Java. Ruby I've been learning over the years, but I still don't know what the language formalities. Could you give me some pointers?
The second screen you posted there is an example of where you should apply full settings to your Mode7 setup, meaning the map will scroll through the entire screen, not showing any horizon or anything. It looks like your characters are standing on the edge of the world, which I don't think is intended.

As far as scripting style goes... it's basically a matter of personal preference combined with what's common. Stuff like module/class names are identical in almost every script (e.g. Scene_Base, instead of SCENE_BASE or scenebase), and so are variables (e.g. @example_variable, not @examplevariable or @exampleVariable) and constants (e.g. THIS_IS_A_CONSTANT, not This_Is_A_Constant or ThisIsAConstant).
As I said, doing it differently doesn't make your script bad at all, however it makes it less understandable and possibly confusing. In conjunction with bad method/module/class/variable names, you'll have the problem of identifying stuff very soon. For example, SHOP might be a constant (my assumption), a class, a module, a local variable or a method of an included class/module... you see, it get's confusing ^^ (which is why Scene_Shop wold be a much better name and is instantly recognizeable).
Note that proper naming helps, but SCENE_SHOP still looks like a constant that might hold a boolean to activate/deactivate the shop, or something (while you shouldn't change constants at runtime, Ruby allows you to do so, so you have an additional uncertainty factor).

There's thousands of other things, but really... asking someone else for how you should do it won't work. Instead, like you said, get some pointers here and there, and create your own style. Personally, my priorities are on a well-understandable and 80% efficient code (meaning if there's a slightly more efficient way, but only a handful people know what that is, I'll use the a but less efficient way). Think of your priorities, and work accordingly. Some stuff like what I hinted you on before you should pay attention to, though - you'll quickly loose focus yourself otherwise.
Always keep in mind that not everything a language allows you to do is actually a good thing to do - think PHP (you don't have to put a semicolon after the very last line of code) or CSS (again, last element of your current definition doesn't need a closing semicolon). Ruby allows you to use semicolons as line seperators, however using them is actually not too smart unless for the very last day of development, where you can replace all your line breaks with these to cut your scripts down in size.

You'll figure something out ^^
Bummer. I thought this script would be more popular. I made it thinking that other people might actually use it, but I guess it's a script one too many. That is, it's been done before, perhaps not as nicely and well-documented, perhaps not these three particular scripts put together, but it's been done nonetheless.

Will have to see if my Final Fantasy XIII Menu script is a bigger deal. I think I'll release it on stages, since it's actually a bunch of very different classes and scenes bundled together.
I can only suggest you the same thing I suggested plague a while ago: Host your projects somewhere you can track the downloads (own webspace, or box.net, which is my favourite hoster), and see how many people actually download it and are interested in it. Not everyone leaves a comment, so judging upon posts left is not really the way to go if you ask me... especially these days, where the scripting-interested part of the community went south over the winter and never came back.
Also, you made it for yourself, so no reason to be disappointed - you need it anyways ^^

Most importantly, keep your chin up ^^
Thank you! That was a really nice and optimistic comment. By the way, I've followed some of your advice when writing my new script.
I had this idea one time.. where.. you could use a mode 7 map as the battle background... basically.. you would walk around with a more overhead view, then the screen would zoom in and the ground would bend back in kinda this sort of perspective up close as a battle backdrop.
I even had this idea for some how using something like this to make first person dungeons like in Phantasy Star 1
MGCaladtogel, the creator of the Mode 07 script, is currently working on a new version of the script called H-Mode 07. This is more like real 3D, but created with a 2D editor. It's very promising and I think would best suit your ideas. He also made a First Person Labyrinth Engine (FPLE) and an isometric engine. Behemoth, on the other hand, made a ray-casting engine, similar to MGCaladtogel's FPLE. He even made a Doom-like first person shooter, The Corps. I believe the project has a thread in the projects forum. You would be surprised how good it is.



As for my script, I doubt it would do anything for your needs. Actually, I doubt any of these engines would at all be useful in battle, simply because these engines alter the Scene_Map class, which extends to a bunch of other classes such as Game_Actor, Game_Party, Game_Event, and Spriteset_Map, which have absolutely nothing to do with battle engines, which alter the Scene_Battle class.

That is to say, your Phantasy Star idea has been realized, by the FPLE and Behemoth's raycasting script, but your battle add-on idea would be difficult to accomplish, unless the battle took place in the map, like in most action games. It definitely can be done. I'm not suggesting I would do it, but I'm letting you know it's possible.
It's not needs, no worries.. i was just blurting that out..
I update the script and the demo.

The script now features Kristovski's Add-on, which is a patch MGCaladtogel wrote for H-Mode 07 that reorients the game controls in accordance to the rotation of the camera. That is to say, if your character is looking down, and you rotate your camera 180º so that your character is looking up, if you press it will look as if your character is going up when in reality he's going down on the map.

I know this is difficult to understand. That's why I made a new demo, featuring the add-on. Try it out.
I added a video. Now you can see how awesome this script is. Also, I wrote the music for the video. I hope you guys like it.
Dude this is a really nice script you have going here and im sure a lot of people will find it useful.

I personally havent downloaded the script but I have a few questions:

do you have to use every feature or can you just use the zoom feature or the 8 directional movement by themselves?

Does it lag like the video or is that just the video?
You definitely don't have to use all features together, and the script doesn't lag, at least on my PC.

EDIT: Actually, you'll notice the script has a lot of patches and add-ons. If you want to use the New Mode 7, you need the New Mode 7 patch, and so on.
This is probably really bad of me because I've only just dug out RMXP after months of not using it, and are still downloading this demo...

But I remember that this Mode7 script had about two or three major issues. One specifically I wonder about is the auto-tiles one. If the frame-count of the autotiles did not match Grasslands (first one has 4, others 1) then the script would crash.

I'm wondering if that's been sorted?
First and foremost, I did not write the New Mode 7 script. MGCaladtogel did. However, I do believe in this last version he managed to sort out various issues. He's an active member at http://www.save-point.org, if you care to ask him personally. I would also like to point out that what I did write is the movement script, and a patch for the New Mode 7 script. If you have any questions regarding these, I would be more than happy to answer them for you.

EDIT: Personally, I don't use autotiles. But I did some research for you, and there does seem to be a bug with animated autotiles. This can be avoided by not using the [A] tag. However, your autotiles won't be animated.

Check the original thread at:
http://www.save-point.org/showthread.php?tid=2313
I've downloaded everything from Angevon, and I'm trying to put together my own sprite sheets using your "Custom Movement" script as a stand alone.

I did the math, and according to the 1050 x 784 sample you posted in the first post, the dimensions of each frame should be 75 x 98, but when I try to make a template, I end up with extra space at the edges of the picture.

Could you possibly tell me the correct dimensions for each frame? Are the idle and sitting stances different dimensions from the movement frames?

Thanks in advance, this script is great, and your game looks like it's going to be very nice looking. :D

(I'm also interested in using your License Board, but I don't have any questions about that yet.)
The answer is quite simple, the frames should be as small as possible. I, myself, am not spriter, and also have difficulty with this process. The simplest way is to use an image editing software, such as Adobe Photoshop, and figure out which pose has the largest width, and which pose has the largest height.
As I'm not sure that answers the question, lemme give you a hand... what you/Luminescense want to know is the size of one frame, however there's no such value. The spritesheet gets cut in several pieces, depending on the setup within the script that you can take yourself.
The default setup looks like:

[ Idle ][ 8x Walking ][ Looking Right ][ Looking Left ][ Sitting, Looking Right ][ Sitting ][ Sitting, Looking Left ]

That equals a number of 14 frames in each row, so whichever width your file might have, it'd get sliced in 14 columns (and 8 rows, if you use 8-way). For a sheet width of 1050, that is indeed 75px, so what I think happened is that you aligned the sprites wrong. If you got RO sprites, it's easiest to align them by the head, both vertically and horizontally.
I took your advice and aligned them by their head, after I finally got the grid aligned properly. Animates perfectly now.

If I set the IDLE part of the script to false, I can leave those frames blank, yes?

I also don't see an actual use of the head turning and sitting animations in the script, would I be able to leave those blank as well if I just want the 8-directional movement frames and nothing else?

EDIT: Nevermind, it misaligned the frame when I set standing to FALSE, but I still don't see where the head turning and sitting come in, so that question still stands.
Depending on the way the script handles the sprites (I'm not familiar with it, and I'm not in the mood to check), setting TOTAL_FRAMES to 8 should work if you just want the walking sprites, if you have idle set to false.

In case the script requires you to have those frames, you can leave them 100% transparent - if you save the sprite as PNG with alpha layer, yu won't get a single byte additionally - just like the graphic would be cut. Not exactly the clean solution, but yeah... a workaround for the time being? ^^
I actually just left them blank, I figured out that the head turning and sitting animations aren't used unless you call them in the event, so I figured I'll leave them blank in case I decide to add other animations for NPCs and such, I also went ahead and put the idle animations in.

I only got one sheet finished, was busy today, lot more to go, since I plan to actually use a job system, and I'll be putting a different sprite for each job, along with 4 characters that can all turn into every job, so that's... quite a lot of sprite sheets to do, not including NPCs.

I'm also trying to find a battle system that I could use RO sprites with, which would probably be Minkoff, but I can't find the darn script, it seems it's been removed from every link that I find.
You can set the total number of poses at the beginning of the script, this way, you don't need to have the additional sitting and looking poses, and your image files can be a tad smaller.
Ok. I've cut it down to 9 frames, it's working wonderfully.

Now, the only thing I can't seem to figure out, is how to make an event stand diagonally? I've tried the 8 frames that the character graphic selection will allow me to choose, they're just stepping frames in the 4 normal directions.
What you need is a little snippet that's already integrated in the script supplied, though... being this:
  1.  def move_random
  2.     case rand(8)
  3.     when 0  # Move down
  4.       move_down(false)
  5.     when 1  # Move left
  6.       move_left(false)
  7.     when 2  # Move right
  8.       move_right(false)
  9.     when 3  # Move up
  10.       move_up(false)
  11.     when 4  # Move lower left
  12.       move_lower_left
  13.     when 5  # Move lower right
  14.       move_lower_right
  15.     when 6  # Move upper left
  16.       move_upper_left
  17.     when 7  # Move upper right
  18.       move_upper_right
  19.     end
  20.   end
Expand to see the code.

Make sure there's no second move_random method after this and before Main, so that this one doesn't get overwritten.
Luminescence wrote:
Ok. I've cut it down to 9 frames, it's working wonderfully.

Now, the only thing I can't seem to figure out, is how to make an event stand diagonally? I've tried the 8 frames that the character graphic selection will allow me to choose, they're just stepping frames in the 4 normal directions.


You know, I never actually thought about this before. Also, I'm not sure I understand what Blue Scope means.
BlueScope, I wasn't talking about how to make an event -walk- diagonally, it does that fine. I'm asking how to make an NPC, such as a shop keeper, that doesn't move from their location, stand in a diagonal facing position.
I suppose this could be possible with the turn_downright, turn_upright, turn_downleft and turn_upleft methods, although I have not tested this yet. You have to consider there is a boolean variable called turn_enabled, which needs to be enabled for a character to look into a particular direction. This should work alright.

EDIT: I've tested the methods and they work fine. What you want to do is, in the event movement command, go to script and type the following line(s).
  1. self.turn_upleft
  2. self.turn_upright
  3. self.turn_downleft
  4. self.turn_downright
Expand to see the code.
Awesome. :D Thanks a bunch, now I think I've got everything perfect as far as this script goes.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=73234