Jump to content
UncannyBoots

Compatibility issue between movement scripts

Recommended Posts

There's a severe compatibility issue between victor's rotational moving script and the "set_char" animation script call in galv's move route script.

I'm too defeated and tired to really go into detail but in a nutshell, galv's script relies on the default direction variable found in Game_CharacterBase, and victor's script completely changes how the direction variable works. This makes it so that when using "set_char" in a move route, it is impossible to select a different character direction.

Victor's script splits the direction variable into three different variables, "current_direction", "final_direction" and "direction". It's very confusing to me.

 

This is the area of galv's script that I believe needs fixing (and the "set_char" script call function is all I want from this script and is crucial):

  def set_char(name,index,pattern,direction)
    @gstop = true
    @direction = direction
    @pattern = pattern - 1
    @character_name = name
    @character_index = index - 1
  end

I'll just link the entirety of Galv's script here.

 

And here's the rotational moving script by Victor:

#==============================================================================
# ** Victor Engine - Rotational Turning
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
#  v 1.00 - 2011.12.23 > First release
#  v 1.01 - 2011.12.30 > Fixed get on and off vehicle glitch
#  v 1.02 - 2012.01.01 > Fixed initial event direction and added new tags
#  v 1.03 - 2012.01.04 > Compatibility with Character Control
#  v 1.04 - 2012.05.30 > Compatibility with Pixel Movement
#  v 1.05 - 2012.07.24 > Compatibility with Moving Platforms
#  v 1.06 - 2012.11.03 > Fixed issue with direction ladders
#                      > Fixed issue with direction after map transfer
#------------------------------------------------------------------------------
#  This scripts allows to set a different movement when the character changes
# the direction he is facing, instead of facing directly the new direction
# the character tunrs smoothly with a rotational movement.
#------------------------------------------------------------------------------
# Compatibility
#   Requires the script 'Victor Engine - Basic Module' v 1.05 or higher
#   If used with 'Victor Engine - Multi Frames' place this bellow it.
# 
# * Overwrite methods
#   class Game_CharacterBase
#     def set_direction(d)
#
# * Alias methods
#   class Game_CharacterBase
#     def init_private_members
#     def update
#
#   class Game_Event < Game_Character
#     def clear_page_settings
#     def setup_page_settings
#
#   class Game_Player < Game_Character
#     def initialize
#
#   class Game_Interpreter
#     def comment_call
#
#------------------------------------------------------------------------------
# Instructions:
#  To instal the script, open you script editor and paste this script on
#  a new section bellow the Materials section. This script must also
#  be bellow the script 'Victor Engine - Basic'
#
#------------------------------------------------------------------------------
# Comment calls note tags:
#  Tags to be used in events comment box, works like a script call.
#
#  <actor rotation on> 
#  <actor rotation off>
#   These tags allows to turn the rotation move on or off for the player.
#
#  <event i rotation on> 
#  <event i rotation off>
#   These tags allows to turn the rotation move on or off for events.
#     i : event ID
#
#------------------------------------------------------------------------------
# Comment boxes note tags:
#   Tags to be used on events Comment boxes. They're different from the
#   comment call, they're called always the even refresh.
#
#  <rotation move>
#    This tag allows the rotation move for events if VE_ROTATE_EVENTS = false
#    It enables the rotation move only for the page where the comment
#    is located
#
#  <block rotation>
#    This tag disable the rotation move for events if VE_ROTATE_EVENTS = true
#    It disable the rotation move only for the page where the comment
#    is located
#
#==============================================================================

#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
#   Setting module for the Victor Engine
#==============================================================================

module Victor_Engine
  #--------------------------------------------------------------------------
  # * Set rotational turning for events
  #    If true, automatically all events will have rotational turning.
  #    If false, you must add the rotational turning manually by adding the
  #    comment tag for rotational turn on it.
  #--------------------------------------------------------------------------
  VE_ROTATE_EVENTS = false
  #--------------------------------------------------------------------------
  # * Set wait time between the frame change during rotation
  #--------------------------------------------------------------------------
  VE_ROTATION_WAIT = 3
  #--------------------------------------------------------------------------
  # * required
  #   This method checks for the existance of the basic module and other
  #   VE scripts required for this script to work, don't edit this
  #--------------------------------------------------------------------------
  def self.required(name, req, version, type = nil)
    if !$imported[:ve_basic_module]
      msg = "The script '%s' requires the script\n"
      msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
      msg += "Go to http://victorenginescripts.wordpress.com/ to download this script."
      msgbox(sprintf(msg, self.script_name(name), version))
      exit
    else
      self.required_script(name, req, version, type)
    end
  end
  #--------------------------------------------------------------------------
  # * script_name
  #   Get the script name base on the imported value, don't edit this
  #--------------------------------------------------------------------------
  def self.script_name(name, ext = "VE")
    name = name.to_s.gsub("_", " ").upcase.split
    name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
    name.join(" ")
  end
end

$imported ||= {}
$imported[:ve_roatation_turn] = 1.06
Victor_Engine.required(:ve_roatation_turn, :ve_basic_module, 1.05, :above)

#==============================================================================
# ** Game_CharacterBase
#------------------------------------------------------------------------------
#  This class deals with characters. Common to all characters, stores basic
# data, such as coordinates and graphics. It's used as a superclass of the
# Game_Character class.
#==============================================================================

class Game_CharacterBase
  #--------------------------------------------------------------------------
  # * Overwrite method: set_direction
  #--------------------------------------------------------------------------
  def set_direction(d)
    @stop_count = 0
    return if @direction_fix || d == 0 || rotating? || (ladder_down? && d == 2)
    set_final_direction(d)
    @rotation_wait  = VE_ROTATION_WAIT
    @clock_rotation = rotation_direction
    @current_direction = @final_direction if !rotation_enabled? || tranfering?
    update_direction if tranfering?
  end
  #--------------------------------------------------------------------------
  # * Alias method: init_private_members
  #--------------------------------------------------------------------------
  alias :init_private_members_ve_roatation_turn :init_private_members
  def init_private_members
    init_private_members_ve_roatation_turn
    @final_direction   = 0
    @current_direction = 0
    @rotation_wait     = 0
  end
  #--------------------------------------------------------------------------
  # * Alias method: update
  #--------------------------------------------------------------------------
  alias :update_ve_roatation_turn :update
  def update
    update_rotation if rotating?
    update_ve_roatation_turn
    update_direction
  end
  #--------------------------------------------------------------------------
  # * New method: set_final_direction
  #--------------------------------------------------------------------------
  def set_final_direction(d)
    diag = $imported[:ve_diagonal_move] && diagonal_enabled? && diagonal?
    case d
    when 2 then @final_direction = diag ? 1 : 0
    when 4 then @final_direction = diag ? 3 : 2
    when 6 then @final_direction = diag ? 7 : 6
    when 8 then @final_direction = diag ? 5 : 4
    end
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_direction
  #--------------------------------------------------------------------------
  def rotation_direction
    clock = 0
    nclock = 8
    clock  += 1 while @final_direction != (@current_direction + clock) % 8
    nclock -= 1 while @final_direction != (@current_direction + nclock) % 8
    clock < (8 - nclock)
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_enabled?
  #--------------------------------------------------------------------------
  def rotation_enabled?
    @rotation_enabled
  end
  #--------------------------------------------------------------------------
  # * New method: rotating?
  #--------------------------------------------------------------------------
  def rotating?
    @final_direction != @current_direction
  end
  #--------------------------------------------------------------------------
  # * New method: update_rotation
  #--------------------------------------------------------------------------
  def update_rotation
    @pattern = @original_pattern
    return @rotation_wait -= 1 if @rotation_wait > 0
    @rotation_wait = VE_ROTATION_WAIT
    add = $imported[:ve_diagonal_move] ? 1 : 2
    dir = @current_direction
    dir = (dir + add) % 8 if @clock_rotation
    dir = dir - add if !@clock_rotation
    dir = $imported[:ve_diagonal_move] ? 7 : 6 if dir < 0
    @current_direction = dir
  end
  #--------------------------------------------------------------------------
  # * New method: update_direction
  #--------------------------------------------------------------------------
  def update_direction
    case @current_direction
    when 0 then @direction = 2; @diagonal = 0
    when 1 then @direction = 2; @diagonal = 1
    when 2 then @direction = 4; @diagonal = 0
    when 3 then @direction = 4; @diagonal = 7
    when 4 then @direction = 8; @diagonal = 0
    when 5 then @direction = 8; @diagonal = 9
    when 6 then @direction = 6; @diagonal = 0
    when 7 then @direction = 4; @diagonal = 3
    end
  end
  #--------------------------------------------------------------------------
  # * New method: update_clear_direction
  #--------------------------------------------------------------------------
  def update_clear_direction
    case @direction
    when 2 then @current_direction = @final_direction = 0
    when 4 then @current_direction = @final_direction = 2
    when 6 then @current_direction = @final_direction = 6
    when 8 then @current_direction = @final_direction = 4
    end
  end
  #--------------------------------------------------------------------------
  # * New method: get_final_direction
  #--------------------------------------------------------------------------
  def get_final_direction
    case @final_direction
    when 0 then [2, 0]
    when 1 then [2, 1]
    when 2 then [4, 0]
    when 3 then [4, 7]
    when 4 then [8, 0]
    when 5 then [8, 9]
    when 6 then [6, 0]
    when 7 then [4, 3]
    end
  end
  #--------------------------------------------------------------------------
  # * New method: ladder_down?
  #--------------------------------------------------------------------------
  def ladder_down?
    $game_map.ladder?(@x, @y + 1)
  end
  #--------------------------------------------------------------------------
  # * New method: transfer?
  #--------------------------------------------------------------------------
  def tranfering?
    $game_player.transfer? && (player? || follower?)
  end
end

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Alias method: clear_page_settings
  #--------------------------------------------------------------------------
  alias :clear_page_settings_ve_roatation_turn :clear_page_settings
  def clear_page_settings
    clear_page_settings_ve_roatation_turn
    @rotation_enabled = false
  end
  #--------------------------------------------------------------------------
  # * Alias method: setup_page_settings
  #--------------------------------------------------------------------------
  alias :setup_page_settings_ve_roatation_turn :setup_page_settings
  def setup_page_settings
    setup_page_settings_ve_roatation_turn
    @rotation_enabled  = VE_ROTATE_EVENTS || note =~ /<ROTATION MOVE>/i
    @rotation_enabled  = false if note =~ /<BLOCK ROTATION>/i
    set_final_direction(@direction)
    @current_direction = @final_direction
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_on
  #--------------------------------------------------------------------------
  def rotation_on
    @rotation_enabled = true
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_off
  #--------------------------------------------------------------------------
  def rotation_off
    @rotation_enabled = false
  end
end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias method: initialize
  #--------------------------------------------------------------------------
  alias :initialize_ve_roatation_turn :initialize
  def initialize
    initialize_ve_roatation_turn
    rotation_on
  end
  #--------------------------------------------------------------------------
  # * Alias method: get_on_off_vehicle
  #--------------------------------------------------------------------------
  alias :get_on_off_vehicle_ve_roatation_turn :get_on_off_vehicle
  def get_on_off_vehicle
    return if rotating?
    get_on_off_vehicle_ve_roatation_turn
  end
  #--------------------------------------------------------------------------
  # * Alias method: init_private_members
  #--------------------------------------------------------------------------
  alias :clear_transfer_info_ve_roatation_turn :clear_transfer_info
  def clear_transfer_info
    clear_transfer_info_ve_roatation_turn
    update_clear_direction
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_on
  #--------------------------------------------------------------------------
  def rotation_on
    @rotation_enabled = true
    @followers.rotation_on
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_off
  #--------------------------------------------------------------------------
  def rotation_off
    @rotation_enabled = false
    @followers.rotation_off
  end
end

#==============================================================================
# ** Game_Follower
#------------------------------------------------------------------------------
#  This class handles the followers. Followers are the actors of the party
# that follows the leader in a line. It's used within the Game_Followers class.
#==============================================================================

class Game_Follower < Game_Character
  #--------------------------------------------------------------------------
  # * New method: rotation_on
  #--------------------------------------------------------------------------
  def rotation_on
    @rotation_enabled = true
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_off
  #--------------------------------------------------------------------------
  def rotation_off
    @rotation_enabled = false
  end
end

#==============================================================================
# ** Game_Followers
#------------------------------------------------------------------------------
#  This class handles the followers. It's a wrapper for the built-in class
# "Array." It's used within the Game_Player class.
#==============================================================================

class Game_Followers
  #--------------------------------------------------------------------------
  # * New method: rotation_on
  #--------------------------------------------------------------------------
  def rotation_on
    each {|follower| follower.rotation_on }
  end
  #--------------------------------------------------------------------------
  # * New method: rotation_off
  #--------------------------------------------------------------------------
  def rotation_off
    each {|follower| follower.rotation_off }
  end
end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Alias method: comment_call
  #--------------------------------------------------------------------------
  alias :comment_call_ve_roatation_turn :comment_call
  def comment_call
    call_change_actor_rotation
    call_change_event_rotation
    comment_call_ve_roatation_turn
  end  
  #--------------------------------------------------------------------------
  # * New method: call_change_actor_rotation
  #--------------------------------------------------------------------------
  def call_change_actor_rotation
    if note =~ /<ACTOR ROTATION (ON|OFF)>/i
      $game_player.rotation_off if $1.upcase == "OFF"
      $game_player.rotation_on  if $1.upcase == "ON"
    end
  end 
  #--------------------------------------------------------------------------
  # * New method: call_change_event_rotation
  #--------------------------------------------------------------------------
  def call_change_event_rotation
    if note =~ /<EVENT (\d+) ROTATION (ON|OFF)>/i
      $game_map.events[$1.to_i].rotation_off if $2.upcase == "OFF"
      $game_map.events[$1.to_i].rotation_on  if $2.upcase == "ON"
    end
  end
end

 

If I can't get this solved then I will disappointingly need to remove the rotational moving script, but I've grown very accustomed to it and would prefer not to.

So if the direction variable in galv's script could be made to become compatible with victor's script, that'd be awesome... but in truth, I am completely stumped in how to do that.

 

Thank you for any support, truly

Share this post


Link to post
Share on other sites
6 hours ago, roninator2 said:

I just threw the two of those together in a test project and there does not seem to be any problem, other than stepping animation for the actor changed stops.

 

It's not an easy problem to explain but try using these script calls in a move route and see if the direction of the sprite changes. As far as I have tested, even in a new project (no other scripts) it doesn't change direction.

"set_char("Damage1",1,2,2)"

wait 60 frames

"set_char("Damage1",1,1,4)"

wait 60 frames

Edited by UncannyBoots

Share this post


Link to post
Share on other sites
3 minutes ago, UncannyBoots said:

it doesn't change direction

Does that mean that the character sprite always faces one direction? No matter which way you move.

This is not what it did for me.

Share this post


Link to post
Share on other sites

When you input the first script call, the frame selected will be in the first character on the sprite sheet, the direction facing down.

The second script call, when removing the rotational script, will then select a frame in the direction facing left (which, when using "Damage1" as an example, selects the blonde girl).

When the rotation script is on, it doesn't select the left direction, it stays in the down direction.

 

Updated the previous post, I made a typo that didn't demonstrate the script call properly.

And here's a sample project showing the issue. Play once with Victor's rotational script, and play once without it. https://mega.nz/#!rEpiAALL!tv_uCDSxWBIBcwgAfF8drQk3RU1yHz-i_f5L2uCTjjU

Edited by UncannyBoots

Share this post


Link to post
Share on other sites
14 hours ago, UncannyBoots said:

sample project

Thanks.

Here's the fix

class Game_Character < Game_CharacterBase
  alias r2_set_char_ve_dir  set_char
  def set_char(name,index,pattern,direction)
    r2_set_char_ve_dir(name,index,pattern,direction)
    set_direction(direction)
  end
end

put in a new script entry below galv's

Also your demo suggest to me that you are not putting your scripts in properly.

It should look like this

image.png.d9b3c6b707fff48e4af6636bfd7f9852.png

Edited by roninator2

Share this post


Link to post
Share on other sites
11 hours ago, roninator2 said:

 


class Game_Character < Game_CharacterBase
  alias r2_set_char_ve_dir  set_char
  def set_char(name,index,pattern,direction)
    r2_set_char_ve_dir(name,index,pattern,direction)
    set_direction(direction)
  end
end

put in a new script entry below galv's

Also your demo suggest to me that you are not putting your scripts in properly.

It should look like this

image.png.d9b3c6b707fff48e4af6636bfd7f9852.png

 

I don't know how I organized the scripts in that demo (I already deleted it from my pc) but I did it hastily. Did I put VE Engine above the bug fixes or something? (I just checked after redownloading the demo and yeah, that's what I did. It's not like that in my actual project tho)

 

I put your fix into my project, and the same error continues to happen. I assume it fixed the error for you though?

It might be my project so I'll redownload my demo and try it there.

...Yeah, it works in the sample project now (which is good!) but I must have yet another script in my project that is interfering with it. Sigh... I'll be looking for what it is. Thank you though!

 

EDIT: I ended up deleting every script to see what it was that was conflicting with it, and it turns out... none of them. So it must be that I edited one of the default scripts and that is making it not work. I checkd Game_CharacterBase, Character, and Player, and none of them seem to have any changes to the direction variable. Do you have any idea what script it might be?

 

No... it works. It was a very stupid error on my part. I fixed the typo a few posts back and I fixed it in the demo, but not in my game. Wow I'm dumb.

Thank you very much for the fix, I'm so glad it works now

Edited by UncannyBoots

Share this post


Link to post
Share on other sites

Actually, this topic here made me realize that I had the exact same error in script placement with the same two scripts in question.
It also will be helpful to grab the scriptlet provided...since I will be using the same movement script bits.

So, I'm glad I looked at this.
(addendum)
@UncannyBoots Probably should put entire scripts into spoilers so that they don't bloat the page...

Edited by PhoenixSoul

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×