[RMXP] Revive Item

Started by PrinceEndymion88, February 14, 2021, 01:05:40 pm

Previous topic - Next topic

PrinceEndymion88

Hi, in RMXP when I create a Revive item (Tools -> Database -> Items -> Scope -> One Ally (HP 0) or All allies (HP 0)) it can be used in battle also when no characters have 0 HP. It makes no sense... Is it possible to disable "revive items" from the item menu when no characters with 0 HP are available?

Thanks in advance :)

KK20

You can also think of it as being preparation for when you know your ally is going to fall that turn and you can immediately revive them (that's where slower actors tend to show their worth).

In any case, this should suffice:
class Game_Party
  alias check_for_0hp_use item_can_use?
  def item_can_use?(item_id)
    result = check_for_0hp_use(item_id)
    return result unless [5,6].include?($data_items[item_id].scope)
    result && $game_party.actors.any? { |actor| actor.hp0? }
  end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

PrinceEndymion88

it works like a charm but if, for example, I have two characters and only one is fainted I can use the Revive on the one that is not fainted... is there a way to avoid this and make selectable only the character fainted? :D However, always thanks for your precious help!

KK20

I can make it buzzer if you select a non-downed actor:
class Scene_Battle
  alias select_actor_for_revive_action update_phase3_actor_select
  def update_phase3_actor_select
    if Input.trigger?(Input::C) &&
    @active_battler.current_action.for_one_friend_hp0? &&
    !@actor_arrow.actor.hp0?
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    select_actor_for_revive_action
  end
end
Now it will behave similarly to using an item from the menu.

Limiting the actor selection options would require a rewrite of Arrow_Actor and some Scene_Battle methods that I don't want to look at.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

PrinceEndymion88

I tried it and it seems to work properly :) I'll do further test 😊😊😊 thanks again!!!