[Resolved] Compatibility Issue with SBS Tankentai XP (thanks Jackolas!)

Started by Ravenith, April 16, 2010, 04:35:01 am

Previous topic - Next topic

Ravenith

Some time ago I wrote the algorithm for a script and Charly Lee helped me with the rgss syntax. It disallows reusing a skill for X turns after it is used.
It works like a charm with the DBS, but does not work with SBS Tankentai XP. ( http://www.hbgames.org/forums/viewtopic.php?f=11&t=60521 )
I know it is highly improbable to get help on this one, since Atoa already refused. The script itself is pretty simple, but the battle system is not, so I can't figure out this myself. From what I CAN figure out, the problem is in Scene_Battle (no rocket science here).
This script adds great functionality, and I'd really appreciate some help.
Thanks anyway :)

Spoiler: ShowHide

#SKILL REUSE BY CHARLY LEE & RAVENITH
 
SKILL_REUSE_DELAY={
1 => 10,
2 => 3
} # {skill_id => delay}
 
class Game_Actor
  attr_accessor :skill_reuse_delays
 
  alias srd_setup setup
  def setup(actor_id)
    srd_setup(actor_id)
    @skill_reuse_delays={}
  end
 
  # To be called at the beginning of a battle
  def reset_delays
    @skill_reuse_delays={}
  end
 
  def delay?(skill_id)
    if @skill_reuse_delays[skill_id]!=nil
      return @skill_reuse_delays[skill_id]
    end
    return 0
  end
 
  alias srd_skill_can_use? skill_can_use?
  def skill_can_use?(skill_id)
    if delay?(skill_id) > 0
      return false
    end
    return srd_skill_can_use?(skill_id)
  end
 
  def decrease_delays
    for k in @skill_reuse_delays.keys
      @skill_reuse_delays[k]=[@skill_reuse_delays[k]-1,0].max
    end
  end
 
  def skill_used(skill_id)
    return if SKILL_REUSE_DELAY[skill_id]==nil
    @skill_reuse_delays[skill_id]=SKILL_REUSE_DELAY[skill_id]
  end
end
 
class Scene_Battle
  alias srd_start_phase1 start_phase1
  def start_phase1
    srd_start_phase1
    for actor in $game_party.actors
      actor.reset_delays
    end
  end
 
  alias srd_start_phase4 start_phase4
  def start_phase4
    srd_start_phase4
    for actor in $game_party.actors
      actor.decrease_delays
    end
  end
 
  alias srd_make_skill_action_result make_skill_action_result
  def make_skill_action_result
    # Memorize current SP
    active_battler_sp = @active_battler.sp unless @active_battler.is_a?(Game_Enemy)
    srd_make_skill_action_result
    return if @active_battler.is_a?(Game_Enemy)
    if active_battler_sp != @active_battler.sp
      @active_battler.skill_used(@active_battler.current_action.skill_id)
    end
  end
end

Jackolas

April 16, 2010, 06:39:09 am #1 Last Edit: April 16, 2010, 09:32:32 am by Jackolas
will see

edit:
and next time do not add # to every row of the script... its an hell to remove
just use:
=begin

your script here

=end

will have the same effect.

Edit 2:
Put the script in the SBS Tankentai XP demo and loaded the game
script works like it should be...

remember to put your script all the way down between the « Optional Addons »

Ravenith

First of all, thank you VERY much for your time.
I noticed the #'s too late (must have been put there by some weird option in my editor), and by the time I got back from work to fix them, you had already looked into it.
Now, about it working as it is... I must have done something really (and repeatedly) dumb with the demo..  :^_^':
I'm very sorry... thanks again for your time.

*levels up*