Player Turning in Place before moving

Discussion in 'RGSS Script Requests' started by Crydsch, Jan 24, 2014.

  1. Crydsch

    Crydsch Warper Member

    Messages:
    3
    Likes Received:
    0
    Location:
    Bavaria
    First Language:
    german
    Hello everybody,

    ich need a way to let the player turn in place before he moves to another coordinate.
    I think there is no other way than doing it via a Script ... and all i found were VX or VX ACE Scripts which didn´t work in XP

    My problem is, that i work on a harvest moon like game and if youre on a big field it´s really anoying that the charakter runs to next coordinate, even if you just wantet to turn around!

    Therefore I need a Script that does exactly this.


    Some Example´s:
    1. If the charakter is facing up and the Player just presses the right arrow-key -> then the charakter should only turn right rather than move to the next right field

    2. If the charakter is facing up and the Player hold down the right arrow-key -> then the charakter should move to the next right field and so on (as normally)

    If out there is someone, who can help me or found a similar Script. I would be really thankfull...

    In hope,

    Crydsch
     
    #1
  2. Bloodmorphed

    Bloodmorphed Dungeon Fanatic Veteran

    Messages:
    1,466
    Likes Received:
    143
    Location:
    Dallas, Texas United States
    First Language:
    English
    #2
  3. Kes

    Kes Global Moderators Global Mod

    Messages:
    21,076
    Likes Received:
    10,710
    First Language:
    English
    Primarily Uses:
    RMVXA
    That script is for Ace, and he wants XP.
     
    #3
  4. Bloodmorphed

    Bloodmorphed Dungeon Fanatic Veteran

    Messages:
    1,466
    Likes Received:
    143
    Location:
    Dallas, Texas United States
    First Language:
    English
    Oh, so he does. Oops. lol
     
    #4
  5. Crydsch

    Crydsch Warper Member

    Messages:
    3
    Likes Received:
    0
    Location:
    Bavaria
    First Language:
    german
    Thanks for your fast replies, but as ksjp17 said these dont work in XP....
     
    #5
  6. MobiusXVI

    MobiusXVI Game Maker Veteran

    Messages:
    362
    Likes Received:
    84
    First Language:
    English
    I took SirBilly's script and converted it to XP.

    Code:
    # Code by Mobius XVI# Based on SirBilly's Player Turn & Move script for VX Ace# Requested by Crydsch# Causes player to turn before movingclass Game_Player < Game_Character  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    @wait_time = 0    super  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  # Alias old method  alias mobius_turn_step_update update  # Redefine update  def update    # Decrease wait time    @wait_time -= 1    # Remember whether or not moving in local variables    last_moving = moving?    # If moving, event running, move route forcing, and message window    # display are all not occurring    unless moving? or $game_system.map_interpreter.running? or           @move_route_forcing or $game_temp.message_window_showing      # Move player in the direction the directional button is being pressed      case Input.dir4      # When Down      when 2        if Input.trigger?(Input::DOWN) and self.direction == 2          move_down        elsif Input.trigger?(Input::DOWN)          @wait_time = 7         turn_down       elsif @wait_time <= 0         move_down       end      # When Left      when 4        if Input.trigger?(Input::LEFT) and self.direction == 4          move_left        elsif Input.trigger?(Input::LEFT)           @wait_time = 7          turn_left        elsif @wait_time <= 0          move_left        end      # When right      when 6        if Input.trigger?(Input::RIGHT) and self.direction == 6          move_right        elsif Input.trigger?(Input::RIGHT)          @wait_time = 7         turn_right       elsif @wait_time <= 0         move_right       end      # When Up      when 8        if Input.trigger?(Input::UP) and self.direction == 8          move_up        elsif Input.trigger?(Input::UP)          @wait_time = 7         turn_up       elsif @wait_time <= 0         move_up        end      end    end    # Remember coordinates in local variables    last_real_x = @real_x    last_real_y = @real_y    super    # If character moves down and is positioned lower than the center    # of the screen    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y      # Scroll map down      $game_map.scroll_down(@real_y - last_real_y)    end    # If character moves left and is positioned more let on-screen than    # center    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X      # Scroll map left      $game_map.scroll_left(last_real_x - @real_x)    end    # If character moves right and is positioned more right on-screen than    # center    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X      # Scroll map right      $game_map.scroll_right(@real_x - last_real_x)    end    # If character moves up and is positioned higher than the center    # of the screen    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y      # Scroll map up      $game_map.scroll_up(last_real_y - @real_y)    end    # If not moving    unless moving?      # If player was moving last time      if last_moving        # Event determinant is via touch of same position event        result = check_event_trigger_here([1,2])        # If event which started does not exist        if result == false          # Disregard if debug mode is ON and ctrl key was pressed          unless $DEBUG and Input.press?(Input::CTRL)            # Encounter countdown            if @encounter_count > 0              @encounter_count -= 1            end          end        end      end      # If C button was pressed      if Input.trigger?(Input::C)        # Same position and front event determinant        check_event_trigger_here([0])        check_event_trigger_there([0,1,2])      end    end  end  end # Class End
     
    #6
    Pink Peach likes this.
  7. Crydsch

    Crydsch Warper Member

    Messages:
    3
    Likes Received:
    0
    Location:
    Bavaria
    First Language:
    german
    Thank´s alot,

    This Script works perfectly fine, just what i searched for :D

    Thanks for that!

    I´ll definetly credit you :)

    Thankfully Crydsch
     
    #7

Share This Page