Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: PrinceEndymion88 on February 14, 2021, 01:05:40 pm

Title: [RMXP] Revive Item
Post by: PrinceEndymion88 on February 14, 2021, 01:05:40 pm
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 :)
Title: Re: [RMXP] Revive Item
Post by: KK20 on February 14, 2021, 03:17:40 pm
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
Title: Re: [RMXP] Revive Item
Post by: PrinceEndymion88 on February 14, 2021, 05:40:02 pm
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!
Title: Re: [RMXP] Revive Item
Post by: KK20 on February 14, 2021, 08:05:16 pm
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.
Title: Re: [RMXP] Revive Item
Post by: PrinceEndymion88 on February 15, 2021, 05:46:59 am
I tried it and it seems to work properly :) I'll do further test 😊😊😊 thanks again!!!