Ruby/RGSSx questions that don't deserve their own thread

Wondering if anything along these lines is possible for RPG Maker VX Ace using the script event command.
$game_actors[id].learn_armortype(id)
$game_actors[id].learn_weapontype(id)
Looking to emulate adding Database/Actors/(id)/Features/Equip/EquipWeapon-Armor/(id), except mid-game via a skill book that would teach a char about a new weapon type or armour type.
Appologies in advance, I've zero RGSSX knowledge.
I believe the only way to do that is to use seal equip type command which is normally controlled by states, so you could have the state on the actor from the beginning and remove it later, but you would also have to have something to keep states after death. Otherwise this would likely be a script.
In case you only need to add or remove a given actor's equip types or equip features, check out my new thread called EkuipFeatures ACE once it is approved by a moderator.
In case you only need to add or remove a given actor's equip types or equip features, check out my new thread called EkuipFeatures ACE once it is approved by a moderator.
Thanks for the script, its exactly what I was looking for!
dang 1 underscore off and I would have've had it...
Thanks for the script, its exactly what I was looking for!
Just keep in mind that those methods had never existed till I started working on a viable solution...
Just keep in mind that those methods had never existed till I started working on a viable solution...
I see, I didn't notice the scroll bar for your script when I first looked.
What script needs to be written so that 1 save file in the game files has a separate name, unlike others of the type: "Save2.rvdata"?
You will need to provide us with some context to answer your question properly. And better do that on a thread of its own.
What script needs to be written so that 1 save file in the game files has a separate name, unlike others of the type: "Save2.rvdata"?
DataManager.save_file()
and track down save_without_rescue(index), you'll get to the instruction:
sprintf("Save%02d.rvdata2", index + 1)

that's what you modify if you want to change the string, but it's important that you know why it's there and how to get to it.
Apologies if this has been resolved somewhere else but I've had no luck finding a solution.
Is it possible to include equipped items in the ItemList draw? Something similar to this:
earthbound.jpg

I'm not too fussed about having an "equipped" icon right now - I just want a player's entire inventory visible, including currently equipped items. I was hoping there'd be a bool I could flick in ItemList or maybe Game_Party but no dice.

edit: just a quick edit to clarify. Unlike the above Earthbound example - my game doesn't have multiple party members with individual inventories or anything like that. I just want to include Actor 1's equipped items in the Item List. Thanks!
Apologies if this has been resolved somewhere else but I've had no luck finding a solution.
Is it possible to include equipped items in the ItemList draw? Something similar to this:
View attachment 270074
I'm not too fussed about having an "equipped" icon right now - I just want a player's entire inventory visible, including currently equipped items. I was hoping there'd be a bool I could flick in ItemList or maybe Game_Party but no dice.

edit: just a quick edit to clarify. Unlike the above Earthbound example - my game doesn't have multiple party members with individual inventories or anything like that. I just want to include Actor 1's equipped items in the Item List. Thanks!
This should have been it's own thread.

Are you showing how many of that item you have? If you only have one axe and it is equipped then it will show 0 for quantity.
Ruby:
class Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  alias :r2_add_leader_item_equip :make_item_list
  def make_item_list
    r2_add_leader_item_equip
    @data += $game_party.leader.equips.each.select { |eq| include?(eq) unless @data.include?(eq) }
  end
end
This should have been it's own thread.

Are you showing how many of that item you have? If you only have one axe and it is equipped then it will show 0 for quantity.
Ruby:
class Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  alias :r2_add_leader_item_equip :make_item_list
  def make_item_list
    r2_add_leader_item_equip
    @data += $game_party.leader.equips.each.select { |eq| include?(eq) unless @data.include?(eq) }
  end
end
My apologies - I'd assumed it was too small an issue (and one I figured had been covered before somewhere in the archive) to deserve its own thread. That snippet does the trick - thanks so much!
image_2023-07-20_163540798.png

It lists everything including the equip now. The 0 quantity thing isn't an issue as the inventory prints the accurate total count, which is all that really matters. Thanks again!
My apologies - I'd assumed it was too small an issue (and one I figured had been covered before somewhere in the archive) to deserve its own thread. That snippet does the trick - thanks so much!
I said that simply because this could have easily turned into a multi part request.
But since the snippet works then its all good.
Is it possible to add a state onto an actor before hit calculation happens? I've tried doing it in the damage formula but that requires the attack to hit first.
Is it possible to add a state onto an actor before hit calculation happens? I've tried doing it in the damage formula but that requires the attack to hit first.
This works but doesn't show the state until the attack happens, but it is applied for the damage.
At least that's my test, I haven't had an unsuccessful hit to test that part.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Pre attack state             ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Add a state to the battler        ╠════════════════════╣
# ║   before the attack is calculated   ║    25 Nov 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: nil                                            ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Add state before attack is calculated                    ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   put in the skill note box                              ║
# ║   <preatkstapply: X>                                     ║
# ║   preatkstapply = pre attack state apply                 ║
# ║   X = the state id                                       ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - 25 Nov 2023 - Script finished                     ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker except nudity             ║
# ╚══════════════════════════════════════════════════════════╝

class Game_Battler < Game_BattlerBase
  alias r2_item_apply_state_test  item_test
  def item_test(user, item)
    if user.is_a?(Game_Actor)
      item.note.split(/[\r\n]+/).each { |line|
        case line
        when /<preatkstapply:[ -_](\d+)>/i
          user.add_state($1.to_i)
        end
      }
    end
    r2_item_apply_state_test(user, item)
  end
end
Is it possible to add a state onto an actor before hit calculation happens? I've tried doing it in the damage formula but that requires the attack to hit first.
common event?

or, still in the damage formula with the attack set to always hit, and move the chance to hit to the damage formula itself.
battler.add_state(id); IF (try > chance) return [damage];
common event?
Common event is executed after the damage.

or, still in the damage formula with the attack set to always hit, and move the chance to hit to the damage formula itself.
battler.add_state(id); IF (try > chance) return [damage];
There are several problems with this
- If they use any popup, it won't show missed/evaded, but NULL or zero damage.
- Like a popup, the item/skill is still registered as a hit, which may also used somewhere else.
- Try/chance calculation won't include item success rate.

Roninator2 script snippet is the best solution to this.
Roninator2 script snippet is the best solution to this.
Thanks, but I still couldn't figure out how to have the state icon show up before the attack animation occurred.
Thanks, but I still couldn't figure out how to have the state icon show up before the attack animation occurred.
You need to refresh the status window when that happens. Depending on the script used, it is refresh_status or status_redraw_target if using YEA from Scene_Battle

Also the animation is played before the item check, so you might need to add status at show animation instead of item test lol.
Also the animation is played before the item check, so you might need to add status at show animation instead of item test lol.
That helped. Thanks. Then processing the check in scene battle is better.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Pre attack state             ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Add a state to the battler        ╠════════════════════╣
# ║   before the attack is calculated   ║    25 Nov 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: nil                                            ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Add state before attack is calculated                    ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   put in the skill note box                              ║
# ║   <preatkstapply: X>                                     ║
# ║   preatkstapply = pre attack state apply                 ║
# ║   X = the state id                                       ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - 25 Nov 2023 - Script finished                     ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker except nudity             ║
# ╚══════════════════════════════════════════════════════════╝

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Execute Battle Actions
  #--------------------------------------------------------------------------
  alias r2_item_apply_state_action    execute_action
  def execute_action
    if @subject.is_a?(Game_Actor)
      item = @subject.current_action.item
      item.note.split(/[\r\n]+/).each { |line|
        case line
        when /<preatkstapply:[ -_](\d+)>/i
          @subject.add_state($1.to_i)
          refresh_status
        end
      }
    end
    r2_item_apply_state_action
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/