[RMVX ACE] [SCRIPTING] REVISING EQUIPMENT STORE READINGS TO REFLECT STAT CHANGES FROM EQUIPMENT.

Posts

Pages: 1
Okay, so, I intended for the game I'm working on not to rely on any original scripting, but the approach I've been using for weapons has resulted in an unintended problem which might need a scripting-based solution, and as far as I can tell there isn't an existing script to resolve this because it's not a problem that normally comes up in the first place.

In my game, rather than weapons having a numerical attack stat which is added to the user's attack power, weapons all use a parameter multiplier for the attack stat. So instead of a weapon upgrade going from +10 to +20 attack, it might go from *1.5 to *1.65 attack.

The problem is, when you shop for equipment, the system the engine uses for checking how much your stats will change is to check the difference in numerical scores, not the difference in your stats with one equipped versus the other, so the player can't tell how strong any of the weapons actually are without buying them.

Is there a way to change the game's mechanism for checking equipment stats so that stores will accurately reflect them?

Marrend
Guardian of the Description Thread
21781
So, this is the piece of code I'm mostly looking at:

class Window_ShopStatus < Window_Base
  def draw_actor_param_change(x, y, actor, item1)
    rect = Rect.new(x, y, contents.width - 4 - x, line_height)
    change = @item.params[param_id] - (item1 ? item1.params[param_id] : 0)
    change_color(param_change_color(change))
    draw_text(rect, sprintf("%+d", change), 2)
  end
end

However, the property you would want to compare would probably be @item.features, which is an array. Which item of that array is a little less certain. The logic in my head is that you'd compare @item.features[x].code, but, after doing a few tests, @item.features[x].data_id might be the data to compare. At least as far as the kind of stat to compare against. A raw value compare could look something like...

change = @item.features[x].value * actor.params[param_id] - (item1 ? item1.features[x].value * actor.params[param_id] : 0)

...that, but, I'm not entirely certain!

*Edit: After a bit more delving, the "data_id" of the "ATK*" feature is 1, whereas the "data_id" of "DEF*" is 2. The "code" for both of them is 21.

*Edit2: Another thing to note is that the "param_id" of ATK is 2 (MHP is 0 and MMP is 1, I think?), while the "param_id" of DEF is 3.
Thanks for the help, that definitely sounds like the right track for fixing the script.

I feel kind of dumb now though, because it only just occurred to me that there's a much simpler way I can give players the information to compare weapons without buying them. I could just put the multiplicative attack value in the item descriptions, and the player would know the difference in relative power without having to extrapolate from the numerical difference of their attack scores.

If I had tried implementing the items in a store and noticed the problem before writing up their descriptions, it should have occurred to me to just do it that way in the first place.
Marrend
Guardian of the Description Thread
21781
Now that I think on it, I believe doing it via the description is exactly what I did for a game that had only multipliers. The "Optimize" method needed some fine-tuning, but, I did the terrible thing, and let items with a higher ID have priority...

class Game_Actor < Game_Battler
  def optimize_equipments
    clear_equipments
    equip_slots.size.times do |i|
      next if !equip_change_ok?(i) || i == 4
      items = $game_party.equip_items.select do |item|
        item.etype_id == equip_slots[i] &&
        equippable?(item) && item.performance >= 0
      end
      change_equip(i, items.max_by {|item| item.id})
    end
  end
end


...as the multipliers tended to increase as the ID increased.
Pages: 1