Save-Point
Atoa ACBS, Equipment Set Add-on Error - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Atoa ACBS, Equipment Set Add-on Error (/thread-10271.html)

Pages: 1 2


Atoa ACBS, Equipment Set Add-on Error - Solitaire - 10-13-2024

Hi all!

I have another question about the Atoa ACBS script, in the demo, I was testing out some of the various neat add-ons that are included. But I ran across one that gave back an error despite me not touching or editing it in any way.

It's called "Equipment Set" (Well, technically "Equipament Sets") and whenever I enable it (As I said, in the demo. Completely unaltered) it crashes the game during battle, the first time someone attacks : (screenshot of the error + section in the script where the error is supposed to be happening)
I'm not familiar with a lot of scripting stuff, and I'm at a loss of what to do, as after searching online I couldn't find any posts talking about this specific issue. But did find some general ruby-related info about "fixnum" errors that didn't really shed any light on things either.

I hope someone can make sense of it, any help would be greatly appreciated. Thanks.


RE: Atoa ACBS, Equipment Set Add-on Error - DerVVulfman - 10-13-2024

Vic had this issue with working on things, but then didn't go back to account for ... possibilities... after an upgrade. He likely didn't touch this script after upgrading ACBS to its current state.

NOW!!!.... let's look at the section... 331 you said?

Code:
#--------------------------------------------------------------------------
  # * Get Critical Hit Rate
  #--------------------------------------------------------------------------
  alias crt_equiset crt
  def crt
    return crt_equiset + @set_crt
  end

Ah, I see. Well, this section gives the attacker an extra "oomph" to his critical hit rate. But he didn't account that the Equipment set didn't GIVE any bonus... aka, the @set_crt value being 'nil'.

We can change this method like so:

Code:
#--------------------------------------------------------------------------
  # * Get Critical Hit Rate
  #--------------------------------------------------------------------------
  alias crt_equiset crt
  def crt
    value = crt_equiset
    value += @set_crt unless @set_crt.nil?
    return value
  end
  • Now here, we just 'snag' the already calculated critical hit damage, and store it into a value (suitably named 'value')(line 1)
  • Then we ONLY add the @set_crt value to it if the @set_crt value isn't nil (line 2)
  • And finally, we return that 'value' it so desired (line 3)

Its annoying, patching a patch. But it needed to be done since it likely wasn't updated or considered. And I felt, this was the easiest fix with the easiest explanation of what's going on.

FOR the record, look further down for THIS set of code
Code:
#--------------------------------------------------------------------------
  # * Get Critical Hit Evasion Rate
  #--------------------------------------------------------------------------
  alias rcrt_equiset rcrt
  def rcrt
    return rcrt_equiset + @set_rcrt
  end

Change it to THIS:

Code:
#--------------------------------------------------------------------------
  # * Get Critical Hit Evasion Rate
  #--------------------------------------------------------------------------
  alias rcrt_equiset rcrt
  def rcrt
    value = rcrt_equiset
    value += @set_rcrt unless @set_rcrt.nil?
    return value
  end

This bit handles the chance of evading a critical hit, and again.... needs to be patched.

While playtesting, these two methods were the only ones that I ran into with issues. I didn't run into any others that gave me problems. BUT, if the others run into 'nil' issues, the fix is pretty simple in design.


RE: Atoa ACBS, Equipment Set Add-on Error - kyonides - 10-13-2024

Oh come on, Wulfo! It's way easier than that set of changes!

Just copy and paste this below the add-ons.

Code:
# * ATOA CBS - Equipment Set Variables Patch * #
#  Scripter : Kyonides Arkanthes
#  2024-10-13

class Game_Actor
  alias :kyon_atoa_eqset_patch_gm_act_setup :setup
  def setup(actor_id)
    equipment_set_vars
    kyon_atoa_eqset_patch_gm_act_setup(actor_id)
  end

  def equipment_set_vars
    @set_eva  = 0
    @set_hit  = 0
    @set_crt  = 0
    @set_dmg  = 0
    @set_rcrt = 0
    @set_rdmg = 0
  end
end



RE: Atoa ACBS, Equipment Set Add-on Error - DerVVulfman - 10-13-2024

NOPE, but almost. Creating the instance values and zero-ing them out when the actor is made seems viable, but the bonuses or penalties will not properly reset when the player changes equipment. You were SO close... it had to be when the data resets:

Code:
# * ATOA CBS - Equipment Set Variables Patch * #
#  Scripter : Kyonides Arkanthes
#  2024-10-13

class Game_Actor
  alias :kyon_atoa_eqset_patch_gm_act_reset_set_status :reset_set_status
  def reset_set_status
    equipment_set_vars
    kyon_atoa_eqset_patch_gm_act_reset_set_status
  end

  def equipment_set_vars
    @set_crt  = 0
    @set_dmg  = 0
    @set_rcrt = 0
    @set_rdmg = 0
  end
end

Just changing over from Setup to the reset_set_status method does the trick. The values reset to 0 just before any 'new' equipment sets are calculated... if any at all.

AND DAMMIT, I KNEW SOMETHING WAS WRONG! VIC WROTE ANOTHER SCRIPT!!!!

IF you were to add "Add | New Status", this script adds the so-mentioned critical hits and damage values and takes care of the issues with the screwed up crt values on its own. That is, if you want to add the four new values to your equipment.

IF you don't care about critical hit bonuses, critical hit resistance and/or critical damage bonuses, use the script snippet above.

IF you want them, use the script that gives the new statuses.

VICTOR SANT!!!!! IT WOULDA BEEN GREAT IF YOU MENTIONED THAT IN THE SCRIPTS!!!!!


RE: Atoa ACBS, Equipment Set Add-on Error - kyonides - 10-13-2024

DerVVulfman Wrote:AND DAMMIT, I KNEW SOMETHING WAS WRONG! VIC WROTE ANOTHER SCRIPT!!!!

That explains it all. Serious
Sadly, Victor Sant never considered he had to remove / alter the previous one from the demo. Sarcasm

There might be another (partial?) solution...

IGNORE THIS POST AND JUMP TO POST #7!

EDIT #3:

Code:
class Game_Actor
  def apply_set_efect(set_id)
    return if Set_Effect[set_id].nil?
    set = Set_Effect[set_id].dup
    if set['status'] != nil
      for st in Set_Effect[set_id]['status']
        eval("@set_#{st[0]} += #{st[0] ? st[1] || 0}")
      end
    end
    @set_equipment_skills << set['skills'] if set['skills'] != nil
    @set_elemental_resist << set['elements'] if set['elements'] != nil
    @set_state_resist << set['states'] if set['states'] != nil
    @set_auto_states << set['auto states'] if set['auto states'] != nil
    @set_auto_states.flatten!
    @set_auto_states.uniq!
    gain_set_skill
  end
end

Edit #4

This would be the full version of my patch.

Code:
# * ATOA CBS - Equipment Set Variables Patch * #
#  Scripter : Kyonides Arkanthes
#  2024-10-13

class Game_Actor
  alias :kyon_atoa_eqset_patch_gm_act_setup :setup
  def setup(actor_id)
    equipment_set_vars
    kyon_atoa_eqset_patch_gm_act_setup(actor_id)
  end

  def equipment_set_vars
    @set_eva  = 0
    @set_hit  = 0
    @set_crt  = 0
    @set_dmg  = 0
    @set_rcrt = 0
    @set_rdmg = 0
  end

  def apply_set_efect(set_id)
    return if Set_Effect[set_id].nil?
    set = Set_Effect[set_id].dup
    if set['status'] != nil
      for st in Set_Effect[set_id]['status']
        eval("@set_#{st[0]} += #{st[0] ? st[1] || 0}")
      end
    end
    @set_equipment_skills << set['skills'] if set['skills'] != nil
    @set_elemental_resist << set['elements'] if set['elements'] != nil
    @set_state_resist << set['states'] if set['states'] != nil
    @set_auto_states << set['auto states'] if set['auto states'] != nil
    @set_auto_states.flatten!
    @set_auto_states.uniq!
    gain_set_skill
  end
end



RE: Atoa ACBS, Equipment Set Add-on Error - DerVVulfman - 10-13-2024

Afraid not. It would not reset the values back to 0 if no set was worn, nor reset them if a set was removed. That only functions upon detection and application of a set. It is solely executed within the 'update_equip_set' method. and only when a set detected worn within the Equip_Set iteration loop.


RE: Atoa ACBS, Equipment Set Add-on Error - kyonides - 10-13-2024

Detective Did you really check the update_equip_set method?
There you can see several calls to apply_set_efect.

And yes, it's spelled apply_set_efect with a single f. What a funny typo! Laughing

Posted while Wulfo was editing his previous post!

Keep in mind that update_equip_set is called from equip and level_change.



Actually...

Code:
  def reset_set_status
    status = ['maxhp','maxsp','atk','pdef','mdef','str','dex','int','agi','eva','hit']
    status << ['crt','dmg','rcrt','rdmg'] if $atoa_script['Atoa New Status']
    status.flatten!
    for st in status
      eval("@set_#{st} = 0")
    end
    @set_equipment_skills = []
    @set_auto_states = []
    @set_elemental_resist = []
    @set_state_resist = []
    forget_set_skills
  end

That piece of code should have set all values to 0... but it fails to do so while running the demo. Confused
The reason is that Atoa New Status script is not included... and that makes it an epic fail because those values should be set even if nobody includes the other script at all.

So the actual fix would be a way shorter than all the previous ones:

THE FIX

Code:
# * ATOA CBS - Equipment Set Variables Patch * #
#  Scripter : Kyonides Arkanthes
#  2024-10-13

class Game_Actor
  def reset_set_status
    status = ['maxhp','maxsp','atk','pdef','mdef','str','dex','int','agi','eva','hit']
    status += ['crt','dmg','rcrt','rdmg']
    for st in status
      eval("@set_#{st} = 0")
    end
    @set_equipment_skills = []
    @set_auto_states = []
    @set_elemental_resist = []
    @set_state_resist = []
    forget_set_skills
  end
end



RE: Atoa ACBS, Equipment Set Add-on Error - DerVVulfman - 10-13-2024

The 'update_equip_set' method is indeed called within 'setup', 'level_change' and 'equip'. That I grant you.

But the content within the 'update_equip_set' method that executes the 'apply_set_efect' is thus:

Code:
...
      apply_set_efect(set[0]) if armors_set and weapons_set
    ...
The triggers for valid armor and weapon sets must both be true for any given equipment set.

The code looks a bit whacked, but it iterates each set. If a set has a weapon, it will only flag the weapons_set value true if equipped, or false if not. But if the set has no weapon, it is set to true so it would pass. And the same goes for armor.

And if no set is equipped, this method is not reached,



EDIT: You added a fix WHILE I was typing

THAT would do it. Yep. That he set up values to be added to other conditions in the script, but not even initialized or set (and thus nil and error causing) unless another script in place was a big oof.


RE: Atoa ACBS, Equipment Set Add-on Error - kyonides - 10-13-2024

While reading the reset_set_status method I noticed the main issue was the condition that mentioned the other script you were talking about. It was the Atoa New Status script. Now it should set all values regardless of the presence of that script if the OP applies my latest patch found in post #7, IMHO.

Wulfo Wrote:EDIT: You added a fix WHILE I was typing

THAT would do it. Yep. That he set up values to be added to other conditions in the script, but not even initialized or set (and thus nil and error causing) unless another script in place was a big oof.

Just a big oof? Laughing
Anyway, now that it's fixed, it's time for some Pizza guys!


RE: Atoa ACBS, Equipment Set Add-on Error - DerVVulfman - 10-13-2024

Says you.  It takes me HOURS to type the gazette. 

I'm getting soup... and that's all I can have while working on it.

... we have no soup emote.  Head-desk Thud