MV Preventing some actors to use and being targets from specific items

Hello!

I'm trying to prevent an actor to use some items in my game. I've found something in my attemps, but I just can't manage this. Yanfly's Item Requirements is close to what I'm looking for, I can prevent actor "A" to use a potion, but any other actor can use it on "A".

If my character is supposed to be allergic to potions, how can I do it so potions cannot be used on him?
(I dont want to make potions poisonous for him or whatever, I want to prevent any use of potions on the actor. Only a buzz sound when you try to use it on him would be awesome).

Thanks!
Yanfly's Selection Core can do this with;
<Cannot Select: Item x>

You'll also need Target Core (Selection is based on it). As long as the potion is not "User only", the potion won't work on the character with that notetag. IIRC you won't even be able to try and select the actor in question, they'll just get skipped over.
Yanfly's Selection Core can do this with;
<Cannot Select: Item x>

You'll also need Target Core (Selection is based on it). As long as the potion is not "User only", the potion won't work on the character with that notetag. IIRC you won't even be able to try and select the actor in question, they'll just get skipped over.
You are my hero, it worked perfectly!!
Thank you very much

But...
How can I do it so the player can't use the potion on the actor through the main menu?
I mean, the same but out of battle?? I still can use potions on him in the map. Other actors should be able but not him:asad:
Thanks again!
How can I do it so the player can't use the potion on the actor through the main menu?
I was just thinking about this and came back to expand on things. Does Item Requirements NOT help this? I haven't used that plugin yet, but that does sound like exactly what it is for.

If it doesn't work, then you probably need to use some Damage Formula trickery. You'd want to check if the target is that actor (or has a certain state if you go that route). If so, make the 'bad' sound, heal them for 0, and give you that potion (so it doesn't get used up), otherwise the potion works as intended. You could even normally do this without Selection Core, but then it would take a turn in battle. Mind, I don't know how to add the 'bad' sound there, my apologies.

The far, far less complicated but only sort of solution is to just make the potion only usable in battle. Which I assume isn't something you want, but could be considered (maybe potions only work when adrenaline is high).
I was just thinking about this and came back to expand on things. Does Item Requirements NOT help this? I haven't used that plugin yet, but that does sound like exactly what it is for.

If it doesn't work, then you probably need to use some Damage Formula trickery. You'd want to check if the target is that actor (or has a certain state if you go that route). If so, make the 'bad' sound, heal them for 0, and give you that potion (so it doesn't get used up), otherwise the potion works as intended. You could even normally do this without Selection Core, but then it would take a turn in battle. Mind, I don't know how to add the 'bad' sound there, my apologies.

The far, far less complicated but only sort of solution is to just make the potion only usable in battle. Which I assume isn't something you want, but could be considered (maybe potions only work when adrenaline is high).
Yes, Item Requierements is for that, but only works in battle, and other actors can apply items to the allergic one.

I thought Battle Sequences may work, but i can't use it on items i think, and i don't know how to check if the target is said actor.

Thanks anyway, maybe i just make them usable in battle.
Looking through other Yanfly plugins, there's an odd sort of way to solve this. First, use Buff & States Core. Instead of having the potion directly heal someone, the potion will give the target a specified state (I'll call this Potion Follow Up or PFU) without being a consumable. PFU has a built in condition that when it is applied (using Custom Apply Effect) that it heals the user, removes a potion from the inventory, and removes the state. Then make sure the actor in question is immune to PFU. This way when they get targeted out of battle (they can't in battle due to Selection Core) the potion has no effect and doesn't get lost.

Of course, this assumes this works out of battle. If that doesn't work, I'll try to come up with something else.
Looking through other Yanfly plugins, there's an odd sort of way to solve this. First, use Buff & States Core. Instead of having the potion directly heal someone, the potion will give the target a specified state (I'll call this Potion Follow Up or PFU) without being a consumable. PFU has a built in condition that when it is applied (using Custom Apply Effect) that it heals the user, removes a potion from the inventory, and removes the state. Then make sure the actor in question is immune to PFU. This way when they get targeted out of battle (they can't in battle due to Selection Core) the potion has no effect and doesn't get lost.

Of course, this assumes this works out of battle. If that doesn't work, I'll try to come up with something else.
Ok, let me analize this step by step, and see if i got it well. my lunatic mode is kinda noob mode when it comes to scripting.

get the Buff & States Core
make a state that adds when the potion is used, the PFU;
create a potion that does nothing but adding the PFU;
in the PFU note tags, put something like this maybe?

<Custom Apply Effect>
(i dont know the code to heal the target player of the potion)
$gameParty.gainItem($dataItems[2], -1); -Remove potion
$gameActors.actor(actorId).removeState(n); -Remove PFU but how can the script know that the actorId has to be the target of the potion?

</Custom Apply Effect>

make actor "a" inmune to PFU

Sorry if i can't explain better, my brains hurts already
my lunatic mode is kinda noob mode when it comes to scripting.
(i dont know the code to heal the target player of the potion)
If you check near the bottom of the Buff & States Core page, it has tons of examples of how to use it because it is so complicated. Curada in particular will likely help. Just skimming over it;

Code:
// Gain the missing HP
  user.gainHp(missingHp);
// Start a damage popup
  user.startDamagePopup();

should give an idea of how to heal HP.

-Remove PFU but how can the script know that the actorId has to be the target of the potion?
From the same state;

Code:
// If it is, then remove the state
  user.removeState(stateId);

Sorry if i can't explain better, my brains hurts already
I think you got exactly what I was going for 🙂
If you check near the bottom of the Buff & States Core page, it has tons of examples of how to use it because it is so complicated. Curada in particular will likely help. Just skimming over it;

Code:
// Gain the missing HP
  user.gainHp(missingHp);
// Start a damage popup
  user.startDamagePopup();

should give an idea of how to heal HP.


From the same state;

Code:
// If it is, then remove the state
  user.removeState(stateId);


I think you got exactly what I was going for 🙂
Thank you very much, it just works.

Everytime i try to use the potion on the actor, it doesn't disappear, doesn't heal, but works as usual with the other actors.
The only problem is the sound... the sound it makes is the used item sound. If i can make a buzz sound instead it would be just Perfect. (or maybe force the menu to close and make the actor say something like "hey, i cant take those, remember?")

But I can work with this just fine, is exaclty what I wanted.
Thank you very much for your time!!:LZSexcite:
Glad it worked out! As for the sound, I don't think it would be possible to change it without another plugin that I'm not even aware of. There might be some trickery by removing the use item sound and then have every item individually use the 'use item' sound with this one making a sound based on what happens, but I'm not quite sure how I'd do that.

Original thread: https://forums.rpgmakerweb.com/threads/preventing-some-actors-to-use-and-being-targets-from-specific-items.151975/