Common Event Antidote/Potions

Hello,

I have a question, but most of it I figured out on my own.

Knowns
For a basic Antidote item a common event that checks if the target user has the poison state is called:
$game_party.target_actor.states.include?($data_states[2])

It then shows text user was healed along with a sound effect. (if the antidote is listed as non-consumable a flag that removes 1 antidote is implemented)

Else condition says "Nothing Happens" (if the antidote is listed as consumable it would be wasted)

Unknowns
For a HP healing item would this same strategy work?
Would I have to make make multiple common events for different healing items? or can this all be done in one common event?
HP healing doesn't need any common event, that is the basic function of the "damage" formula and type.
Just make a new project and check how HP Potions are done by default.

Oh - and it is better readable if you use the regular conditional branch for "has state inflicted" instead of a script line - the result would be the same, but using the regular check will allow you to read which state is checked for by name instead of by numbers.
Doesn't the regular check asks for a specific player? Not the target player?

Here's my logic:

use Item>check target actor state>one branch
use Item>check actor[] state>more branches per character?

For multiple items to use the same common event would making a check to see if the item was used work?
If so that line is?
The item is asking for a target when used - items don't have a "skill user", they only care about target - that is what makes the effects easier to use than a common event, because only with a common event you have the problem of identifying the target of the item.

And because of this, items are easier to use without a common event, you should only use common events for rare special cases where the default logic doesn't work.
Oh I see, I wanted it to show the text that the item had no effect. I disabled the 'can't select/use' sound the game normally has.

Can I make a common event that ask if the item was consumed then displays a message on if it was or not?
no, it has to be the other way around - you can set it to consume and then give one back in the common event if certain conditions were not met, or set it to not consume but remove it by event command in the common event.

I still think there is something off in your description due to you not telling things that you know but we can't read in your mind.
If you give a full description of what you want, we might be able to point you to a better solution.
All I want is for if and when an item can't or will not be used it gives a message saying nothing happened. This is only for outside of battle though.

Examples:
Player attempts to use antidote, select player who isn't poisoned. It returns the message "nothing happened".

Player attempts to use a potion, select player who has full health. Returns the message "nothing happened". Keeping the potion however like how it default doesn't consume if health is max.


I looked around on the site and found something that may help me however I can't seem to get it to show up correctly in any of my browsers.

Try this ^^

Spoiler
#==============================================================================# Different effects outside the battle# By Lecode#----------------------# Use <when_outside: x> on skills and items notetags.# When the party is outside, the effects of the skill/item with # the ID x w'll be used instead of the selected skill/item's effects#==============================================================================module Lecode_ItemOutside def self.get_outside_item(item) return item if $game_party.in_battle other_id = item.outside_item_id if other_id > 0 if item.is_a?(RPG::Skill) return $data_skills[other_id] elsif item.is_a?(RPG::Item) return $data_items[other_id] end end return item end endclass Scene_ItemBase def use_item_to_actors true_item = Lecode_ItemOutside.get_outside_item(item) item_target_actors.each do |target| true_item.repeats.times { target.item_apply(user, true_item) } end end endclass Game_Battler def use_item(item) pay_skill_cost(item) if item.is_a?(RPG::Skill) consume_item(item) if item.is_a?(RPG::Item) true_item = Lecode_ItemOutside.get_outside_item(item) true_item.effects.each {|effect| item_global_effect_apply(effect) } end endclass RPG::UsableItem def outside_item_id self.note =~ /<when_outside:[ ]?(.+)>/ ? $1.to_i : 0 end end
However, there may be some compatibility issues with the use_item method. Send me a PM if it's the case.

It allows an item to have two effects one in battle and one outside.

I'd set the outside one contain the common event that does a process similar to what you just said.
That code is the victim of a forum problem from about one or two years ago, then all script codes were condensed to single lines instead of being script listings - it cannot work in that form, but unfortunately it needs someone with programming knowledge to make it operational again by seperating the lines at the correct positions.

So basically you want to replace the default "buzzer" when health is max with a text message?
If that is the case, it might be easier to ask someone for a small plugin doing that
That's exactly what I'm looking for, in regard to health items.
The method I had above for antidotes is working well.

For the conditional check that checks if the party loses an item. Would any of the following work? This is just so I can make one common event for status items if they work or not.

$game_party.lose_item(item, 1) if item.is_a?(RPG::Item) && item.consumable

$game_party.lose_item(item, 1)
or
$game_party.gain_item(item, -amount, include_equip)


Also if anyone can decode those lines that would be great. I'll probably just PM the user who coded it.
I was never here.

Code:
#==============================================================================
# Different effects outside the battle
# By Lecode
#----------------------
# Use <when_outside: x> on skills and items notetags.
# When the party is outside, the effects of the skill/item with
# the ID x w'll be used instead of the selected skill/item's effects
#==============================================================================

module Lecode_ItemOutside
  def self.get_outside_item(item)
    return item if $game_party.in_battle
    other_id = item.outside_item_id
    if other_id > 0
      if item.is_a?(RPG::Skill)
        return $data_skills[other_id]
      elsif item.is_a?(RPG::Item)
        return $data_items[other_id]
      end
    end
    return item
  end
end

class Scene_ItemBase
  def use_item_to_actors
    true_item = Lecode_ItemOutside.get_outside_item(item)
    item_target_actors.each do |target|
      true_item.repeats.times {
        target.item_apply(user, true_item)
      }
    end
  end
end

class Game_Battler
  def use_item(item)
    pay_skill_cost(item) if item.is_a?(RPG::Skill)
    consume_item(item) if item.is_a?(RPG::Item)
    true_item = Lecode_ItemOutside.get_outside_item(item)
    true_item.effects.each {|effect|
      item_global_effect_apply(effect)
    }
  end
end

class RPG::UsableItem
  def outside_item_id
    self.note =~ /<when_outside:[ ]?(.+)>/ ? $1.to_i : 0
  end
end
Thanks a bunch!

Original thread: https://forums.rpgmakerweb.com/threads/common-event-antidote-potions.75723/