Help - Search - Members - Calendar
Full Version: [Solved] Problems with Omegazion's Roguelike BattleSystem
RPG RPG Revolution Forums > Scripting > Script Development and Support > RGSS2
Helios
Original script:
http://www.rpgrevolution.com/forums/index....showtopic=26314

Just found some bugs in this system that I'm currently using, and looks like Omegazion is not around anymore...

...So, is there anyone who can help me resolve this? Thanks in advance.

The particular bugs are:

1. Skill setup in the quickbar is not saved. When I load a saved game, the quickbar is empty and I have to re-assign everything again.
2. If a skill is put in the quickbar, then removed from character (by event or remove "equipment with skill"), the skill remain in quickbar and can still be used.
Kread-EX
This should solve both problems. Be sure to paste it below all ORBS scripts.
Clicky
CODE
class Game_System
  attr_accessor :orbs_hotkeys
  alias_method(:krx_orbs_fix_init, :initialize) unless $@
  def initialize
    krx_orbs_fix_init
    @orbs_hotkeys = []
  end
end

class Scene_Skill
  
  def update_skill_selection
    if @actor_index == 0
      for i in 1..(ORBS::NUMBER_OF_HOTKEYS)
        if Input.trigger?(Input::Numbers[i]) and (not @skill_window.skill.nil?) and
          (@skill_window.skill.occasion != 3)
          Sound.play_decision
          ORBS.hotkey_objects[i - 1] = @skill_window.skill
          @help_window.set_text(sprintf(ORBS::HOTKEY_SET_MESSAGE, i))
          30.times do
            Graphics.update
            Input.update
          end
          $game_system.orbs_hotkeys = ORBS.hotkey_objects.clone
          return
        end
      end
    end
    $game_system.orbs_hotkeys = ORBS.hotkey_objects.clone
    oz_rbs_hk_update_skill_select
  end
  
end

class << ORBS
  attr_accessor   :hotkey_objects
end
  
class Scene_File
  
  def read_save_data(file)
    oz_rbs_read_sav_dat(file)
    $game_members = Marshal.load(file)
    ORBS.hotkey_objects = $game_system.orbs_hotkeys.clone
  end
end

class Game_Player

  alias_method(:krx_orbs_fix_gp_update, :update)
  def update
    krx_orbs_fix_gp_update
    hks = []
    ORBS.hotkey_objects.each_index {|i|
      if ORBS.hotkey_objects[i] == nil
        hks[i] = nil
      elsif self.battler.skill_learn?(ORBS.hotkey_objects[i])
        hks[i] = ORBS.hotkey_objects[i]
      end
    }
    if ORBS.hotkey_objects != hks
      ORBS.hotkey_objects = hks.clone
    end
  end
end
Helios
Work like a charm! Thank you soooo much Kread-EX! pinch.gif

PS: I've also found and fixed a tiny bug my self...
Line 2499 should be
when 6 ; x, y = y , -x

PS.2:
An other bug which I have no clue.

According to the readme:
QUOTE
+---------------+
| set_direction |
+---------------+

Set the direction where the target character faces at.

Arguments:
1. Target - the character that will move it's sprite
0 - the user
1 - the character at the target tile
2 and above - the character at the the projectile tile n (for example,
3 will target projectile number 3, explained at command projectile_fire)
2. Direction - The direction to face.
-1 - Turn 90 Right
0 - Turn Back
1 - Turn 90 Left
2 - Down
4 - Left
6 - Right
8 - Up
10 - The user's direction
11 - character at target tile's direction
12+ - target at projectile(n - 10)'s direction (12 - proj.#2, 13 - proj.#3)

Syntax:

"ACTION_NAME" => ["set_direction", target, direction],

Example:

"TURN_BACK_USER" => ["set_direction", 0, 0],


The first 3 direction arguments, "-1, 0, 1" works fine.

When set to 2,4,6,8, like:
"FACE_UP" => ["set_direction", 1, 8],
Return "NoMethodError" at line 1004. "Undefined method `' for nil:NilClass"

When set to 10, like:
"FACE_SAME_AS_USER" => ["set_direction", 1, 10],
Return "ArgumentError" at line 2537. "Wrong number of arguments(4 for 1)"


However this is not a major issue as this function can be completely ignored without affecting gameplay.
So if you don't have time, feel free to ignore this post sweat.gif
Kread-EX
QUOTE
When set to 10, like:
"FACE_SAME_AS_USER" => ["set_direction", 1, 10],
Return "ArgumentError" at line 2537. "Wrong number of arguments(4 for 1)"

For this problem, check this at the line 2537-2538:
CODE
      _coords = evaluate_coords_to_use(@args[1] - 10,
        #@user, @target_tile, @projectiles])
And replace simply by this:
CODE
      _coords = evaluate_coords_to_use(@args[1] - 10)
It works normally after. I don't foresee any reason why it should cause other problems - the method needs an integer, and an array was provided instead, hence the error.

QUOTE
When set to 2,4,6,8, like:
"FACE_UP" => ["set_direction", 1, 8],
Return "NoMethodError" at line 1004. "Undefined method `' for nil:NilClass"

Line 2548, here:
CODE
else; target.set_direction(@args[2])
Replace the 2 with a 1.
Helios
Yes that fixed the problem laugh.gif I doubt if he tested all the functions... Anyway, thank you again Kread-EX, you are a great help!

============================================================================
Update: New bug found?

When trying to remove member from the party regardless if ORBS is active or not,
Line 2246
RGSS Error: disposed sprite

==============================================================================
Update: Again, new bug...

Line 2544, No method error
undefined method `rbs_char_obj' for #<ORBS::CharObj:0xf953d8>

I figured out this was caused by enemies running into each other.

Example: the crash will happen in 1 or 2 turns.



UPDATE:
At last I found the cause of this bug. The enemy here in this sample have a skill which cause target to turn towards himself. If this skill hits the target, nothing goes wrong. But if the skill is used when no target is in range...the error occurs cuz there's no target to turn therefore the action sequence cannot proceed. Character using this skill towards nothing result in the same error. Basically any action that cause target to change facing will crash when they miss.
Helios
Damn that last bug really puzzled me for some time.

Now there's only one bug, the game crash when member is removed from party.
Kread-EX
Line 2246, replace this:
CODE
@character_sprite.opacity = op unless @character_sprite.nil?

with this:
CODE
unless @character_sprite.nil? || @character_sprite.disposed?
    @character_sprite.opacity = op
end
Helios
Great, now I could focus on making the game. Much thanks Kread-EX! Couldn't have done it without you! pinch.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.