RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Help?] Apparent Script conflicts

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 71
RMRK Junior
Having what seems to be some compatibility issues with this here script. I know for sure it works, but for some reason, it isn't playing nicely with something I'm using. The recharge triggers and makes the abilities unusable, but the charges never seem to count down and the ability is never usable again. Can anyone with some scripting knowledge take a look and see if they can find anything that could cause a problem? (Thinking maybe there's a variable or something in here that might be referenced and in conflict with something else or something). I *can* post all the scripts I'm making use of, but.... there's a LOT of them..... Would prefer not to if I don't have to.

Code: [Select]
#==============================================================================
#    Recharge Skills
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: December 11, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This allows you to make it so that skills can be set to need to recharge
#   after use. In other words, you can make it so that once an actor uses Heal,
#   he or she cannot use Heal again for x number of turns. This script will
#   also allow you to make items, weapons, and states that can increase or
#   reduce the amount of time it takes to recharge a skill, as well as create
#   items and skills that can immediately recharge any skills that are charging
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in its own slot in the Script Editor (F11), above Main
#   but below any other custom scripts you might have.
#
#    Configuration is fairly easy. To specify how long a skill needs to take to
#   recharge, all you need to do is place the following code in its notebox:
#      \charge[x]
#   where x is the number of turns you want it to be unavailable for after
#   using it. It must be a positive integer.
#
#    Example:
#      \recharge[2]   # Will wait two turns before you can use this skill again
#
#    To set either an item or skill so that, when used, it will refresh all
#   skills and get rid of any remaining charges so that all skills will be
#   available, all you need to do is put the following code in the notebox:
#      \refresh
#
#    To set a weapon, armor, state, or enemy to reduce or increase the default
#   charge times of a skill, all you need to do is use the following code:
#      \recharge[x]
#
#    You can also specify recharge modifiers by class or actor. See the
#   Configurable Region at line 57 for instructions on setting those up. All
#   recharge modifiers stack, so if your class normally adds 1 and an armor the
#   actor wears adds 2, then it will take 3 extra turns to recharge the skill.
#   Also, recharge mods will only add to skills that have a recharge time to
#   begin with.
#==============================================================================

#==============================================================================
# *** RPG
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    New Constants - CLASS_RECHARGE_MODS, ACTOR_RECHARGE_MODS
#    Modified classes - UsableItem, Skill, Weapon, Armor, State, Enemy
#==============================================================================

module RPG

#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  CONFIGURABLE REGION
#``````````````````````````````````````````````````````````````````````````````
#    Here, you can set recharge modifiers for classes and actors, thus allowing
#   the recharge times to be different depending on which actor and what class.
#   They both work the same basic way:
#
#  CLASS_RECHARGE_MODS
#    Each line should look as follows (omitting the < and >):
#
#    <class ID> => <modifier>,
#
#       class ID : the ID of the class you want to modify. So, by default,
#         1 would be Paladin, 2 would be Warrior, 3 would be Priest, etc...
#       modifier : this can either be an integer or a positive decimal number.
#         If an integer, it will add it to the number of turns. If a decimal
#         number, it will multiply it by the number of turns.
#
#  If you don't do a line for a class, then it defaults to 0 modifier.
#  Remember to put a comma after EVERY one of these lines, except the last.
#
#  EXAMPLES:
#    2 => 1,
#      Whenever an actor with class 2 uses a skill, it will take one extra turn
#      to recharge than it would normally. So, if a skill should take 3 turns
#      to recharge, it will take 4 turns for actors with this class.
#    7 => 0.5,
#      Whenever an actor with class 7 uses a skill, it will take only half as
#      long to recharge as it would normally. If a skill takes 6 turns
#      normally, it will take 3 turns to recharge for actors with this class.
#
#  ACTOR_RECHARGE_MODS
#    This works the same way, except with actor ID instead of class ID:
#
#    <actor ID> => <modifier>,
#       actor ID : the ID of the actor. So, by default, 1 would be Ralph,
#         2 would be Ulrika, etc...
#       modifier : same as at line 71.
#
#  If you don't do a line for a class, then it defaults to 0 modifier.
#  Remember to put a comma after EVERY one of these lines, except the last.
#
#  EXAMPLES:
#    4 => -2,
#      Whenever Actor 4 uses a skill, it takes 2 less turns to charge. So if
#      the skill normally takes 5 turns, it will take only 3 turns for actor 4.
#    7 => 2.5,
#      Whenever Actor 7 uses a skill it 250% longer to recharge. So if a skill
#      normally takes 2 turns, it will take 5 turns for actor 7.
#
#  You can also change an actor's recharge modifier in game with a script call:
#    $game_actors[<actor ID>] = <modifier>
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CLASS_RECHARGE_MODS = { # <- Do not touch.
  1 => 0,
  2 => 1.0,
} # <- Do not touch.
ACTOR_RECHARGE_MODS = { # <- Do not touch.
  1 => 0,
  2 => 1.0,
} # <- Do not touch.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  END CONFIGURABLE REGION
#//////////////////////////////////////////////////////////////////////////////
CLASS_RECHARGE_MODS.default = 0
ACTOR_RECHARGE_MODS.default = 0
 
#==============================================================================
# ** UsableItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - refresh_charges?
#==============================================================================

class UsableItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh_charges?
    return (self.note[/\\REFRESH/i] != nil)
  end
end

#==============================================================================
# ** Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - charge_time
#==============================================================================

class Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Charge Time
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_time
    return self.note[/\\CHARGE\[(\d+)\]/i] != nil ? $1.to_i : 0
  end
end

#==============================================================================
# ** Weapon, Armor, State, Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - recharge_mod
#    aliased method - ma_reset_note_values (if have Note Editor)
#==============================================================================

["Weapon", "Armor", "State", "Enemy"].each { |class_name|

RS_REGEXP = "/\\\\RECHARGE\\[(-?\\d+)(%?)\\]/i"

CLDEF = <<__END__
class #{class_name}
  def recharge_mod
    if !@recharge_mod
      if self.note[#{RS_REGEXP}] != nil
        if $2.empty?
          @recharge_mod = $1.to_i
        else
          x = $1.to_f / 100.0
          @recharge_mod = x >= 0 ? x : -1*x
        end
      else
        @recharge_mod = 0
      end
    end
    return @recharge_mod
  end
  if self.method_defined? (:ma_reset_note_values)
    alias ma_rchrg_restnot_8ik3 ma_reset_note_values
    def ma_reset_note_values (*args)
      ma_rchrg_restnot_8ik3 (*args) # Run Original Method
      @recharge_mod = nil
    end
  end
end
__END__

eval (CLDEF)

}

end

#==============================================================================
# ** Game_Battler
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize; skill_can_use?; skill_test; skill_effect;
#      item_test; item_effect
#    new methods - set_skill_recharge; update_skill_recharge; recharge_mod
#==============================================================================

class Game_Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_skilchrg_initz_5tg2 initialize
  def initialize (*args)
    @sc_turns_count = {}
    @sc_turns_count.default = 0
    ma_skilchrg_initz_5tg2 (*args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check if Can Use Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgbr_chrgskil_canus_9dv4 skill_can_use?
  def skill_can_use? (skill, *args)
    return false if @sc_turns_count[skill.id] > 0
    return malgbr_chrgskil_canus_9dv4 (skill, *args) # Return Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Skill Test
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mal_rchrgskl_tst_4wp9 skill_test
  def skill_test (user, skill, *args)
    return true if skill.refresh_charges? && !@sc_turns_count.empty?
    return mal_rchrgskl_tst_4wp9 (user, skill, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Skill Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mgba_rchrgskil_efct_2ok7 skill_effect
  def skill_effect (user, skill, *args)
    @sc_turns_count.clear if skill.refresh_charges?
    mgba_rchrgskil_efct_2ok7 (user, skill, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item Test
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mogb_rchrg_itmtest_6yh2 item_test
  def item_test (user, item, *args)
    return true if item.refresh_charges? && !@sc_turns_count.empty?
    return mogb_rchrg_itmtest_6yh2 (user, item, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malga_rechrge_itmeffect_5th3 item_effect
  def item_effect (user, item, *args)
    @sc_turns_count.clear if item.refresh_charges?
    malga_rechrge_itmeffect_5th3 (user, item, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Charge
  #  skill : the skill used
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_skill_recharge (skill)
    return if skill.recharge_time == 0
    @sc_turns_count[skill.id] = skill.recharge_time
    direct, percent = recharge_mod
    @sc_turns_count[skill.id] += direct
    @sc_turns_count[skill.id] = (@sc_turns_count[skill.id] * percent).round
    @sc_turns_count[skill.id] += 1
    @sc_turns_count.delete (skill.id) if @sc_turns_count[skill.id] < 1
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Charges
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_skill_recharge
    for i in @sc_turns_count.keys
      @sc_turns_count[i] -= 1
      @sc_turns_count.delete (i) if @sc_turns_count[i] <= 0
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Recharge Mod
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_mod
    direct, percent = 0, 1.0
    states.each { |state|
      x = state.recharge_mod
      x.is_a? (Float) ? percent *= x : direct += x
    }
    return direct, percent
  end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - setup
#    redefined super method - recharge_mod
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :base_recharge
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Actor Setup
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgb_rechrg_initz_8ik2 setup
  def setup (*args)
    malgb_rechrg_initz_8ik2 (*args) # Run Original Method
    @base_recharge = RPG::ACTOR_RECHARGE_MODS[@actor_id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Recharge Mod
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_mod
    direct, percent = super
    class_mod = RPG::CLASS_RECHARGE_MODS[class_id]
    class_mod.is_a? (Float) ? percent *= class_mod : direct += class_mod
    @base_recharge.is_a? (Float) ? percent *= @base_recharge : direct += @base_recharge
    equips.compact.each { |equip|
      x = equip.recharge_mod
      x.is_a? (Float) ? percent *= x : direct += x
    }
    return direct, percent
  end
end

#==============================================================================
# ** Game_Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    redefined super method - recharge_mod
#==============================================================================

class Game_Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Recharge Mod
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_mod
    direct, percent = super
    x = enemy.recharge_mod
    x.is_a? (Float) ? percent *= x : direct += x
    return direct, percent
  end
end

#==============================================================================
# ** Scene_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - execute_action_skill; turn_end
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Execute Battle Action: Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modrn_chrg_exactskil_5th3 execute_action_skill
  def execute_action_skill (*args)
    modrn_chrg_exactskil_5th3 (*args) # Run Original Method
    @active_battler.set_skill_recharge (@active_battler.action.skill)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * End Turn
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias morba_chrgskl_endturn_4tx1 turn_end
  def turn_end (*args)
    if args[0] && args[0].is_a? (Game_Battler) # Tankentai ATB Compatibility
      args[0].update_skill_recharge
    else
      ($game_troop.members + $game_party.members).each { |battler| battler.update_skill_recharge }
    end
    morba_chrgskl_endturn_4tx1 (*args) # Run Original Method
  end
end[\code]

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Okay, I did look into this after you sent me that PM. I found no conflict between my script and this script, so chances are there's another script causing the problem. You could probably upload a blank project with your scripts set up and let someone find the problem.
it's like a metaphor or something i don't know

***
Rep:
Level 71
RMRK Junior
and you don't see anything in particular within this script that could conflict with anything else?

I figured your's probably wasn't causing any issues, but it seems like right around when I added your's to my game that it f?cked up, so idk.

More likely than not, I'm just retarded and screwed something up, but still, it's a ton of info to go through and double-check ><
« Last Edit: October 07, 2011, 05:28:23 AM by zerothedarklord »


***
Rep:
Level 71
RMRK Junior
no ideas?

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Sorry, I was unable to download before. I'll take a look soon.
Holy crap that's a lot of scripts.
« Last Edit: October 08, 2011, 08:15:22 AM by Pacman »
it's like a metaphor or something i don't know

***
Rep:
Level 71
RMRK Junior
rofl, yeah, I use 1 or 2.

***
Rep:
Level 71
RMRK Junior
finding anything man?

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
No. It's pretty weird. It was annoying doing all the cross-referencing, but I checked just about every method that MA's script refers to with all your other scripts, and everything seems fine. I think you'd be better off simply without my script.
it's like a metaphor or something i don't know

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Thanks for all your help Pacman. I appreciate the work you do to help others with my scripts; I know how annoying it can be to scan through a bunch of scripts in order to look for incompatibilities, and it's all the more tedious when it isn't for your own script.

Anyway, methinks the problem is cozzie's Show Slip Damage script overwrites the turn_end method of Scene_Battle (bad Cozzie! :P).

Since the Recharge Skills script updates cooldowns through aliasing that method, that is why you are receiving that problem. To fix it, put Recharge Skills below the Show Slip Damage script.

You should also put Jens009's Enemy Health Windows below the Show Slip Damage script, though you would only see a problem there if you turned the ALWAYS_UPDATE option to false.
« Last Edit: October 08, 2011, 12:27:43 PM by modern algebra »

***
Rep:
Level 71
RMRK Junior
Alright, thanks dude, I'll try that right now.

***
Rep:
Level 71
RMRK Junior
Alright, nice, thanks man, it worked.