Ajuda com Script para NetMaker Hitskin_logo Hitskin.com

Isto é uma pré-visualização de um tema em Hitskin.com
Instalar o temaVoltar para a ficha do tema

Aldeia RPG
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Ajuda com Script para NetMaker

4 participantes

Ir para baixo

Ajuda com Script para NetMaker Empty Ajuda com Script para NetMaker

Mensagem por Manticora Sex Nov 24, 2017 2:37 pm

Achei um script de movimento em 8 direções para RPG Maker XP alguém pode adaptá-lo para o NetMaker 1.0.2 !

Código:
#============================================================================
# ** Advanced 8-D Movement
#----------------------------------------------------------------------------
# Draycos Goldaryn
# Version 3.01
# 4-30-07
# SDK Version : 2.2 - Parts 1, 2, 3
#------------------------------------------------------------------------------
# This script allows for a more extensive 8 directional movement system than
# comes default with RMXP. It also improves the diagonal sprite movements.
# This script also affects events as well as the player. It also has the option
# to toggle between five different methods of movement:
#  Default 4-directional Movement
#    Using the arrow keys and numberpad, the player can move in only four
#    directions.
#  Default 8-directional Movement
#    Using the arrow keys and numberpad, the player can move in all eight
#    directions.
#  Point and Click Movement
#    Using Near_Fantastica's Mouse Module along with his Pathfinding Script,
#    and Aleworks Input Module the player may move his character with the
#    mouse.
#  Axial Movement
#    The player turns 45? using the left and right arrows and move forward or
#    backward using the up or down arrow respectively.
#    This is ideal for airships, boats, or other vehicles. It can also be used
#    with numpad movement and/or mouse movement
#  Movement Control using Numpad
#    The player uses the numpad to move in all 8 directions according to the
#    following diagram:
#        \  |  /
#          7 8 9
#        -4  6-
#          1 2 3
#        /  |  \
#    This is ideal in case you wish to use the arrow keys for something other
#    than movement or if you want to use axial movement also.
#
# Also, character sprites now must include 8 poses: one for each direction, in
# the following order:
#  Lower Left
#  Down
#  Lower Right
#  Left
#  Right
#  Upper Left
#  Up
#  Upper Right
#------------------------------------------------------------------------------
# Syntax:
#  To toggle the different methods of movement on, call the following scripts:
#    Default 8-directional movement  : $game_system.default_movement = true
#    Point and Click movement        : $game_system.mouse_movement = true
#    Axial Movement                  : $game_system.axial_movement = true
#    Movement Control using Numpad  : $game_system.numpad_movement = true
#
#  If you want to use only 4-directional movement, then set all the previous
#  mentioned variables to false.
#  NOTE: Triggering Axial Movement will disable both Default Movements. This
#        is to avoid conlficts between them.
#=============================================================================

#-----------------------------------------------------------------------------
# * SDK Log Script
#-----------------------------------------------------------------------------
SDK.log('Advanced 8-D Movement', 'Draycos Goldaryn', 3.01, '4-30-07')
SDK.check_requirements(2.20, [1, 2, 3], {'Aleworks Keys Module' => 1.10,
                                      'Path Finding' => 1.5,
                                      'Mouse Input' => 5})

#-----------------------------------------------------------------------------
# * Begin SDK Enable Test
#-----------------------------------------------------------------------------
if SDK.enabled?('Advanced 8-D Movement')

#-----------------------------------------------------------------------------
# * Module Input
#-----------------------------------------------------------------------------
module Input
  def Input.axial_dir8
    return 1 if Input.press?([[Keys::DOWN, Keys::LEFT]])
    return 3 if Input.press?([[Keys::DOWN, Keys::RIGHT]])
    return 7 if Input.press?([[Keys::UP, Keys::LEFT]])
    return 9 if Input.press?([[Keys::UP, Keys::RIGHT]])
    return 2 if Input.press?(Keys::DOWN)
    return 4 if Input.press?(Keys::LEFT)
    return 6 if Input.press?(Keys::RIGHT)
    return 8 if Input.press?(Keys::UP)
    0
  end
end

#-----------------------------------------------------------------------------
# * SDK::Scene Base
#-----------------------------------------------------------------------------
class SDK::Scene_Base
  alias_method(:advanced_8d_movement_scene_base_update, :update)
  def update
    Mouse.update
    advanced_8d_movement_scene_base_update
  end
end

#-----------------------------------------------------------------------------
# * Game System
#-----------------------------------------------------------------------------
class Game_System
  attr_accessor :wait
  #Setup movement input type toggles
  attr_accessor :default_movement #Toggles Default Movement
  attr_accessor :mouse_movement  #Toggles Mouse Movement
  attr_accessor :axial_movement  #Toggles Axial Movement
  attr_accessor :numpad_movement  #Toggles Numpad Movement

  alias_method (:advanced_8d_movement_game_system_initialize, :initialize)
  def initialize
    advanced_8d_movement_game_system_initialize
    @wait = 0
    #Set the movement input type toggles to default (true = on, false = off)
    @default_movement = true
    @mouse_movement = false
    @axial_movement = false
    @numpad_movement = false
  end
end

#-----------------------------------------------------------------------------
# * Game System
#-----------------------------------------------------------------------------
class Game_Character
  #--------------------------------------------------------------------------
  # * SDK Log Overwritten Methods
  #--------------------------------------------------------------------------
  SDK.log_overwrite(:Game_Character, :move_lower_left)
  SDK.log_overwrite(:Game_Character, :move_lower_right)
  SDK.log_overwrite(:Game_Character, :move_upper_left)
  SDK.log_overwrite(:Game_Character, :move_upper_right)
  SDK.log_overwrite(:Game_Character, :move_random)
  SDK.log_overwrite(:Game_Character, :move_forward)
  SDK.log_overwrite(:Game_Character, :move_backward)
  SDK.log_overwrite(:Game_Character, :move_toward_player)
  SDK.log_overwrite(:Game_Character, :move_away_from_player)
  SDK.log_overwrite(:Game_Character, :jump)
  SDK.log_overwrite(:Game_Character, :turn_right_90)
  SDK.log_overwrite(:Game_Character, :turn_left_90)
  SDK.log_overwrite(:Game_Character, :turn_180)
  SDK.log_overwrite(:Game_Character, :turn_right_or_left_90)
  SDK.log_overwrite(:Game_Character, :turn_random)
  SDK.log_overwrite(:Game_Character, :turn_toward_player)
  SDK.log_overwrite(:Game_Character, :turn_away_from_player)
  #--------------------------------------------------------------------------
  # * Move Lower Left
  #--------------------------------------------------------------------------
  def move_lower_left(turn_enabled = true)
    # Turn up
    if turn_enabled
      turn_lower_left
    end
    # When a down to left or a left to down course is passable
    if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
      (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
      # Update coordinates
      @x -= 1
      @y += 1
      # Increase steps
      increase_steps
    # If impassable
    else
      # Determine if touch event is triggered
      check_event_trigger_touch(@x-1, @y+1)
    end
  end
  #--------------------------------------------------------------------------
  # * Move Lower Right
  #--------------------------------------------------------------------------
  def move_lower_right(turn_enabled = true)
    # Turn up
    if turn_enabled
      turn_lower_right
    end
    # When a down to right or a right to down course is passable
    if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
      (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
      # Update coordinates
      @x += 1
      @y += 1
      # Increase steps
      increase_steps
    # If impassable
    else
      # Determine if touch event is triggered
      check_event_trigger_touch(@x+1, @y+1)
    end
  end
  #--------------------------------------------------------------------------
  # * Move Upper Left
  #--------------------------------------------------------------------------
  def move_upper_left(turn_enabled = true)
    # Turn up
    if turn_enabled
      turn_upper_left
    end
    # When an up to left or a left to up course is passable
    if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
      (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
      # Update coordinates
      @x -= 1
      @y -= 1
      # Increase steps
      increase_steps
    # If impassable
    else
      # Determine if touch event is triggered
      check_event_trigger_touch(@x-1, @y-1)
    end
  end
  #--------------------------------------------------------------------------
  # * Move Upper Right
  #--------------------------------------------------------------------------
  def move_upper_right(turn_enabled = true)
    # Turn up
    if turn_enabled
      turn_upper_right
    end
    # When an up to right or a right to up course is passable
    if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
      (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
      # Update coordinates
      @x += 1
      @y -= 1
      # Increase steps
      increase_steps
    # If impassable
    else
      # Determine if touch event is triggered
      check_event_trigger_touch(@x+1, @y-1)
    end
  end
  #--------------------------------------------------------------------------
  # * Move at Random
  #--------------------------------------------------------------------------
  def move_random
    case rand(8)
    when 0  # Move down
      move_down
    when 1  # Move left
      move_left
    when 2  # Move right
      move_right
    when 3  # Move up
      move_up
    when 4
      move_lower_left
    when 5
      move_lower_right
    when 6
      move_upper_left
    when 7
      move_upper_right
    end
  end
  #--------------------------------------------------------------------------
  # * Move toward Player
  #--------------------------------------------------------------------------
  def move_toward_player
    # Get difference in player coordinates
    sx = @x - $game_player.x
    sy = @y - $game_player.y
    # If coordinates are equal
    if sx == 0 and sy == 0
      return
    end
    # Get absolute value of difference
    abs_sx = sx.abs
    abs_sy = sy.abs
    #get diagonal differences
    sh = (abs_sx / 2) - abs_sy
    sv = (abs_sy / 2) - abs_sx
    # Is the player more towards a 45? angle?
    if abs_sx == abs_sy || (sv < 0 and sh < 0)
      if $game_player.y > @y
        #if the player is lower left
        if $game_player.x < @x
          move_lower_left
        #If the player is lower right
        else
          move_lower_right
        end
      else
        #if the player is upper left
        if $game_player.x < @x
          move_upper_left
        #if the player is upper right
        else
          move_upper_right
        end
      end
    # If horizontal distance is longer
    elsif abs_sx > abs_sy
      # Move towards player, prioritize left and right directions
      sx > 0 ? move_left : move_right
      if not moving? and sy != 0
        sy > 0 ? move_up : move_down
      end
    # If vertical distance is longer
    else
      # Move towards player, prioritize up and down directions
      sy > 0 ? move_up : move_down
      if not moving? and sx != 0
        sx > 0 ? move_left : move_right
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Move away from Player
  #--------------------------------------------------------------------------
  def move_away_from_player
    # Get difference in player coordinates
    sx = @x - $game_player.x
    sy = @y - $game_player.y
    # If coordinates are equal
    if sx == 0 and sy == 0
      return
    end
    # Get absolute value of difference
    abs_sx = sx.abs
    abs_sy = sy.abs
    #get diagonal differences
    sh = (abs_sx / 2) - abs_sy
    sv = (abs_sy / 2) - abs_sx
    # Is the player more towards a 45? angle?
    if abs_sx == abs_sy || (sv < 0 and sh < 0)
      if $game_player.y > @y
        #if the player is lower left
        if $game_player.x < @x
          move_upper_right
        #If the player is lower right
        else
          move_upper_left
        end
      else
        #if the player is upper left
        if $game_player.x < @x
          move_lower_right
        #if the player is upper right
        else
          move_lower_left
        end
      end
    # If horizontal distance is longer
    elsif abs_sx > abs_sy
      # Move away from player, prioritize left and right directions
      sx > 0 ? move_right : move_left
      if not moving? and sy != 0
        sy > 0 ? move_down : move_up
      end
    # If vertical distance is longer
    else
      # Move away from player, prioritize up and down directions
      sy > 0 ? move_down : move_up
      if not moving? and sx != 0
        sx > 0 ? move_right : move_left
      end
    end
  end
  #--------------------------------------------------------------------------
  # * 1 Step Forward
  #--------------------------------------------------------------------------
  def move_forward
    case @direction
    when 2
      move_down(false)
    when 4
      move_left(false)
    when 6
      move_right(false)
    when 8
      move_up(false)
    when 1 #lower left
      move_lower_left(false)
    when 3 #lower right
      move_lower_right(false)
    when 7 #upper left
      move_upper_left(false)
    when 9 #upper right
      move_upper_right(false)
    end
  end
  #--------------------------------------------------------------------------
  # * 1 Step Backward
  #--------------------------------------------------------------------------
  def move_backward
    # Remember direction fix situation
    last_direction_fix = @direction_fix
    # Force directino fix
    @direction_fix = true
    # Branch by direction
    case @direction
    when 2  # Down
      move_up(false)
    when 4  # Left
      move_right(false)
    when 6  # Right
      move_left(false)
    when 8  # Up
      move_down(false)
    when 1 #lower left
      move_upper_right(false)
    when 3 #lower right
      move_upper_left(false)
    when 7 #upper left
      move_lower_right(false)
    when 9 #upper right
      move_lower_left(false)
    end
    # Return direction fix situation back to normal
    @direction_fix = last_direction_fix
  end
  #--------------------------------------------------------------------------
  # * Jump
  #    x_plus : x-coordinate plus value
  #    y_plus : y-coordinate plus value
  #--------------------------------------------------------------------------
  def jump(x_plus, y_plus)
    # If plus value is not (0,0)
    if x_plus != 0 or y_plus != 0
      # If horizontal distnace is longer
      if x_plus.abs > y_plus.abs
        # Change direction to left or right
        x_plus < 0 ? turn_left : turn_right
      # If vertical distance is longer
      elsif x_plus.abs < y_plus.abs
        # Change direction to up or down
        y_plus < 0 ? turn_up : turn_down
      # if distances are equal
      else
        if x_plus < 0
          if y_plus < 0
            turn_upper_left
          else
            turn_lower_left
          end
        else
          if y_plus < 0
            turn_upper_right
          else
            turn_lower_right
          end
        end
      end
    end
    # Calculate new coordinates
    new_x = @x + x_plus
    new_y = @y + y_plus
    # If plus value is (0,0) or jump destination is passable
    if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
      # Straighten position
      straighten
      # Update coordinates
      @x = new_x
      @y = new_y
      # Calculate distance
      distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
      # Set jump count
      @jump_peak = 10 + distance - @move_speed
      @jump_count = @jump_peak * 2
      # Clear stop count
      @stop_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Turn Lower Left
  #--------------------------------------------------------------------------
  def turn_lower_left
    unless @direction_fix
      @direction = 1
      @stop_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Turn Lower Right
  #--------------------------------------------------------------------------
  def turn_lower_right
    unless @direction_fix
      @direction = 3
      @stop_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Turn Upper Left
  #--------------------------------------------------------------------------
  def turn_upper_left
    unless @direction_fix
      @direction = 7
      @stop_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Turn Upper Right
  #--------------------------------------------------------------------------
  def turn_upper_right
    unless @direction_fix
      @direction = 9
      @stop_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Turn 90? Right
  #--------------------------------------------------------------------------
  def turn_right_90
    case @direction
    when 2
      turn_left
    when 4
      turn_up
    when 6
      turn_down
    when 8
      turn_right
    when 1
      turn_upper_left
    when 3
      turn_lower_left
    when 7
      turn_upper_right
    when 9
      turn_lower_right
    end
  end
  #--------------------------------------------------------------------------
  # * Turn 90? Left
  #--------------------------------------------------------------------------
  def turn_left_90
    case @direction
    when 2
      turn_right
    when 4
      turn_down
    when 6
      turn_up
    when 8
      turn_left
    when 1
      turn_upper_right
    when 3
      turn_upper_left
    when 7
      turn_lower_right
    when 9
      turn_lower_left
    end
  end
  #--------------------------------------------------------------------------
  # * Turn 180?
  #--------------------------------------------------------------------------
  def turn_180
    case @direction
    when 2
      turn_up
    when 4
      turn_right
    when 6
      turn_left
    when 8
      turn_down
    when 1
      turn_upper_left
    when 3
      turn_lower_left
    when 7
      turn_upper_right
    when 9
      turn_lower_right
    end
  end
  #--------------------------------------------------------------------------
  # * Turn 90? Right or Left
  #--------------------------------------------------------------------------
  def turn_right_or_left_90
    if rand(2) == 0
      turn_right_90
    else
      turn_left_90
    end
  end
  #--------------------------------------------------------------------------
  # * Turn at Random
  #--------------------------------------------------------------------------
  def turn_random
    case rand(8)
    when 0
      turn_up
    when 1
      turn_right
    when 2
      turn_left
    when 3
      turn_down
    when 4
      turn_lower_left
    when 5
      turn_lower_right
    when 6
      turn_upper_left
    when 7
      turn_upper_right
    end
  end
  #--------------------------------------------------------------------------
  # * Turn 45? Right
  #--------------------------------------------------------------------------
  def turn_right_45
    case @direction
    when 2
      turn_lower_left
    when 4
      turn_upper_left
    when 6
      turn_lower_right
    when 8
      turn_upper_right
    when 1
      turn_left
    when 3
      turn_down
    when 7
      turn_up
    when 9
      turn_right
    end
  end
  #--------------------------------------------------------------------------
  # * Turn 45? Left
  #--------------------------------------------------------------------------
  def turn_left_45
    case @direction
    when 2
      turn_lower_right
    when 4
      turn_lower_left
    when 6
      turn_upper_right
    when 8
      turn_upper_left
    when 1
      turn_down
    when 3
      turn_right
    when 7
      turn_left
    when 9
      turn_up
    end
  end
  #--------------------------------------------------------------------------
  # * Turn 45? Right or Left
  #--------------------------------------------------------------------------
  def turn_right_or_left_45
    if rand(2) == 0
      turn_right_45
    else
      turn_left_45
    end
  end
  #--------------------------------------------------------------------------
  # * Turn Forward Right
  #--------------------------------------------------------------------------
  def turn_forward_right
    turn_right_45
    move_forward
  end
  #--------------------------------------------------------------------------
  # * Turn Forward Left
  #--------------------------------------------------------------------------
  def turn_forward_left
    turn_left_45
    move_forward
  end
  #--------------------------------------------------------------------------
  # * Turn Backward Right
  #--------------------------------------------------------------------------
  def turn_backward_right
    turn_right_45
    move_backward
  end
  #--------------------------------------------------------------------------
  # * Turn Backward Left
  #--------------------------------------------------------------------------
  def turn_backward_left
    turn_left_45
    move_backward
  end
  #--------------------------------------------------------------------------
  # * Turn Towards Player
  #--------------------------------------------------------------------------
  def turn_toward_player
    # Get difference in player coordinates
    sx = @x - $game_player.x
    sy = @y - $game_player.y
    # If coordinates are equal
    if sx == 0 and sy == 0
      return
    end
    # Get absolute value of difference
    abs_sx = sx.abs
    abs_sy = sy.abs
    #get diagonal differences
    sh = (abs_sx / 2) - abs_sy
    sv = (abs_sy / 2) - abs_sx
    # If the diagonal distance is equal
    if (sh == 0 or sv == 0) &&
      ((abs_sx != 1 and abs_sy != 0) or (abs_sx != 0 and abs_sy != 1))
      return
    end
    # Is the player more towards a 45? angle?
    if abs_sx == abs_sy || (sv < 0 and sh < 0)
      if $game_player.y > @y
        #if the player is lower left
        if $game_player.x < @x
          turn_lower_left
        #If the player is lower right
        else
          turn_lower_right
        end
      else
        #if the player is upper left
        if $game_player.x < @x
          turn_upper_left
        #if the player is upper right
        else
          turn_upper_right
        end
      end
    # If horizontal distance is longer
    elsif abs_sx > abs_sy
      # Turn to the right or left toward player
      sx > 0 ? turn_left : turn_right
    # If vertical distance is longer
    else
      # Turn up or down toward player
      sy > 0 ? turn_up : turn_down
    end
  end
  #--------------------------------------------------------------------------
  # * Turn Away from Player
  #--------------------------------------------------------------------------
  def turn_away_from_player
    # Get difference in player coordinates
    sx = @x - $game_player.x
    sy = @y - $game_player.y
    # If coordinates are equal
    if sx == 0 and sy == 0
      return
    end
    # Get absolute value of difference
    abs_sx = sx.abs
    abs_sy = sy.abs
    #get diagonal differences
    sh = (abs_sx / 2) - abs_sy
    sv = (abs_sy / 2) - abs_sx
    # If the diagonal distance is equal
    if (sh == 0 or sv == 0) &&
      ((abs_sx != 1 and abs_sy != 0) or (abs_sx != 0 and abs_sy != 1))
      return
    end
    # Is the player more towards a 45? angle?
    if abs_sx == abs_sy || (sv < 0 and sh < 0)
      if $game_player.y > @y
        #if the player is lower left
        if $game_player.x < @x
          turn_upper_right
        #If the player is lower right
        else
          turn_upper_left
        end
      else
        #if the player is upper left
        if $game_player.x < @x
          turn_lower_right
        #if the player is upper right
        else
          turn_lower_left
        end
      end
    # If horizontal distance is longer
    elsif abs_sx > abs_sy
      # Turn to the right or left away from player
      sx > 0 ? turn_right : turn_left
    # If vertical distance is longer
    else
      # Turn up or down away from player
      sy > 0 ? turn_down : turn_up
    end
  end
end

#-----------------------------------------------------------------------------
# * Game Player
#-----------------------------------------------------------------------------
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * SDK Log Overwritten and Aliased Methods
  #--------------------------------------------------------------------------
  SDK.log_overwrite(:Game_Player, :check_event_trigger_there)
  alias_method(:advanced_8d_movement_game_player_update_player_movement,
              :update_player_movement)
  #--------------------------------------------------------------------------
  # * Front Event Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_there(triggers)
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # Calculate front event coordinates
    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 :
                  @direction == 1 ? -1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
                  @direction == 9 ? +1 : 0)
    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 :
                  @direction == 1 ? +1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
                  @direction == 9 ? -1 : 0)
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      if event.x == new_x and event.y == new_y and
        triggers.include?(event.trigger)
        # If starting determinant is front event (other than jumping)
        if not event.jumping? and not event.over_trigger?
          event.start
          result = true
        end
      end
    end
    # If fitting event is not found
    if result == false
      # If front tile is a counter
      if $game_map.counter?(new_x, new_y)
        # Calculate 1 tile inside coordinates
        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 :
                  @direction == 1 ? -1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
                  @direction == 9 ? +1 : 0)
        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 :
                  @direction == 1 ? +1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
                  @direction == 9 ? -1 : 0)
        # All event loops
        for event in $game_map.events.values
          # If event coordinates and triggers are consistent
          if event.x == new_x and event.y == new_y and
            triggers.include?(event.trigger)
            # If starting determinant is front event (other than jumping)
            if not event.jumping? and not event.over_trigger?
              event.start
              result = true
            end
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Player Movement
  #--------------------------------------------------------------------------
  def update_player_movement
    #if none of the movement input types are toggled
    unless $game_system.default_movement || $game_system.mouse_movement ||
          $game_system.axial_movement || $game_system.numpad_movement ||
      #use the standard four directional movement
      advanced_8d_movement_game_player_update_player_movement
    end
    # Turn player using left/right and forward/backward using up/down
    if $game_system.axial_movement
      case Input.axial_dir8
      when 1
        turn_backward_right
      when 2
        move_backward
      when 3
        turn_backward_left
      when 4
        turn_left_45
        $game_system.wait = 5
      when 6
        turn_right_45
        $game_system.wait = 5
      when 7
        turn_forward_left
      when 8
        move_forward
      when 9
        turn_forward_right
      end
    #Use the default 8-directional movement method
    elsif $game_system.default_movement
      case Input.dir8
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      when 1
        move_lower_left
      when 3
        move_lower_right
      when 7
        move_upper_left
      when 9
        move_upper_right
      end
    end
    # Move player using the Mouse
    if $game_system.mouse_movement
      if Input.press?(Keys::MOUSE_LEFT)
        unless Mouse.pos == nil
          if Mouse.pos[0].between?(-1, 640) && Mouse.pos[1].between?(-1, 480)
            x =  Mouse.grid[0]
            y =  Mouse.grid[1]
            # checks to see if an event occupies the map tile
            while $game_map.check_event(x,y).is_a?(Numeric)
              return #does nothing | can edit this later to do something else
            end
            $game_player.find_path(x,y) # moves the player if there is no event
          end
        end
      end
    end
    # Move player using the numpad
    if $game_system.numpad_movement
      if Input.press?(Keys::NUMPAD1)
        move_lower_left
      end
      if Input.press?(Keys::NUMPAD2)
        move_down
      end
      if Input.press?(Keys::NUMPAD3)
        move_lower_right
      end
      if Input.press?(Keys::NUMPAD4)
        move_left
      end
      if Input.press?(Keys::NUMPAD6)
        move_right
      end
      if Input.press?(Keys::NUMPAD7)
        move_upper_left
      end
      if Input.press?(Keys::NUMPAD8)
        move_up
      end
      if Input.press?(Keys::NUMPAD9)
        move_upper_right
      end
    end
  end
end

#-----------------------------------------------------------------------------
# * Sprite Character
#-----------------------------------------------------------------------------
class Sprite_Character < RPG::Sprite
  SDK.log_overwrite(:Sprite_Character, :update)
  def update
    super
    # If tile ID, file name, or hue are different from current ones
    if @tile_id != @character.tile_id or
      @character_name != @character.character_name or
      @character_hue != @character.character_hue
      # Remember tile ID, file name, and hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      # If tile ID value is valid
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
                                      @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      # If tile ID value is invalid
      else
        self.bitmap = RPG::Cache.character(@character.character_name,
                                          @character.character_hue)
        @cw = bitmap.width / 4
        @ch = bitmap.height / 8
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
    # Set visible situation
    self.visible = (not @character.transparent)
    # If graphic is character
    if @tile_id == 0
      # Set rectangular transfer
      sx = @character.pattern * @cw
      if @character.direction >= 6
        sy = (@character.direction - 2 ) * @ch
      else
        sy = (@character.direction - 1 ) * @ch
      end
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    # Set sprite coordinates
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z(@ch)
    # Set opacity level, blend method, and bush depth
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    # Animation
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
end

#-----------------------------------------------------------------------------
# * Scene Map
#-----------------------------------------------------------------------------
class Scene_Map
  alias_method (:advanced_8d_movement_scene_map_update, :update)
  def update
    if $game_system.wait > 0
      $game_system.wait -= 1
      return
    end
    advanced_8d_movement_scene_map_update
  end
end

#-----------------------------------------------------------------------------
# * Window Base
#-----------------------------------------------------------------------------
class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Graphic
  #    actor : actor
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    cw = bitmap.width / 4
    ch = bitmap.height / 8
    #set which direction to draw(draws down by default)
    dir = 2
    #interprets direction to frame
    if dir >= 6
      sy = (dir - 2 ) * ch
    else
      sy = (dir - 1 ) * ch
    end
    #draws the actor
    src_rect = Rect.new(0, sy, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
end

#-----------------------------------------------------------------------------
# * Window SaveFile
#-----------------------------------------------------------------------------
class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # Draw file number
    self.contents.font.color = normal_color
    name = "File#{@file_index + 1}"
    self.contents.draw_text(4, 0, 600, 32, name)
    @name_width = contents.text_size(name).width
    # If save file exists
    if @file_exist
      # Draw character
      for i in 0...@characters.size
        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        cw = bitmap.rect.width / 4
        ch = bitmap.rect.height / 8
        #set which direction to draw(draws down by default)
        dir = 2
        #interprets direction to frame
        if dir >= 6
          sy = (dir - 2 ) * ch
        else
          sy = (dir - 1 ) * ch
        end
        src_rect = Rect.new(0, sy, cw, ch)
        x = 300 - @characters.size * 32 + i * 64 - cw / 2
        self.contents.blt(x, 68 - ch, bitmap, src_rect)
      end
      # Draw play time
      hour = @total_sec / 60 / 60
      min = @total_sec / 60 % 60
      sec = @total_sec % 60
      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 8, 600, 32, time_string, 2)
      # Draw timestamp
      self.contents.font.color = normal_color
      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
      self.contents.draw_text(4, 40, 600, 32, time_string, 2)
    end
  end
end

#-----------------------------------------------------------------------------
# * End SDK Enable Test
#-----------------------------------------------------------------------------
end

_________________
Ajuda com Script para NetMaker Sem_tz10
Manticora
Manticora
Membro Ativo
Membro Ativo

Mensagens : 261
Créditos : 62

Ficha do personagem
Nível: 1
Experiência:
Ajuda com Script para NetMaker Left_bar_bleue0/0Ajuda com Script para NetMaker Empty_bar_bleue  (0/0)
Vida:
Ajuda com Script para NetMaker Left_bar_bleue30/30Ajuda com Script para NetMaker Empty_bar_bleue  (30/30)

Ir para o topo Ir para baixo

Ajuda com Script para NetMaker Empty Re: Ajuda com Script para NetMaker

Mensagem por Paulo Soreto Sex Nov 24, 2017 5:45 pm

Esse script contém algumas dependencias, pra usar primeiro precisaria instalar elas (tenho quase certeza de que o script SDK é incompatível com o NetMaker).

_________________
Ajuda com Script para NetMaker FwYnoXI
Paulo Soreto
Paulo Soreto
Lenda
Lenda

Mensagens : 1980
Créditos : 367

Ficha do personagem
Nível: 1
Experiência:
Ajuda com Script para NetMaker Left_bar_bleue0/0Ajuda com Script para NetMaker Empty_bar_bleue  (0/0)
Vida:
Ajuda com Script para NetMaker Left_bar_bleue30/30Ajuda com Script para NetMaker Empty_bar_bleue  (30/30)

https://www.aldeiarpg.com/

Ir para o topo Ir para baixo

Ajuda com Script para NetMaker Empty Re: Ajuda com Script para NetMaker

Mensagem por Valentine Sex Nov 24, 2017 6:10 pm

No lado do cliente, basta fazer uma modificação simples no script Game_Player, pois o Input já suporta 8 direções. Já no lado do servidor é que você pode ter um trabalho a mais.
Valentine
Valentine
Administrador
Administrador

Medalhas : Ajuda com Script para NetMaker ZgLkiRU
Mensagens : 5341
Créditos : 1164

https://www.aldeiarpg.com/

Ir para o topo Ir para baixo

Ajuda com Script para NetMaker Empty Re: Ajuda com Script para NetMaker

Mensagem por LeonM² Sex Nov 24, 2017 8:48 pm

Tem que ser levado também em conta o fator do ABS, já que ele utiliza quatro direções apenas para efetuar ataques, isso também leva em consideração o servidor, adaptar este script se torna praticamente impossível pelos fatores citados, seria mais fácil alguém criar do zero, acertando os controles junto ao ABS, se bem feito é possível até mesmo por gráficos para as demais direções, incluindo VE.
LeonM²
LeonM²
Lenda
Lenda

Mensagens : 1802
Créditos : 153

Ir para o topo Ir para baixo

Ajuda com Script para NetMaker Empty Re: Ajuda com Script para NetMaker

Mensagem por Manticora Sex Nov 24, 2017 10:20 pm

No caso eu queria igual ao do netplay master 5.0 !

Mover em 8 direções !

_________________
Ajuda com Script para NetMaker Sem_tz10
Manticora
Manticora
Membro Ativo
Membro Ativo

Mensagens : 261
Créditos : 62

Ficha do personagem
Nível: 1
Experiência:
Ajuda com Script para NetMaker Left_bar_bleue0/0Ajuda com Script para NetMaker Empty_bar_bleue  (0/0)
Vida:
Ajuda com Script para NetMaker Left_bar_bleue30/30Ajuda com Script para NetMaker Empty_bar_bleue  (30/30)

Ir para o topo Ir para baixo

Ajuda com Script para NetMaker Empty Re: Ajuda com Script para NetMaker

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos