States that forbid using items

I found that state may stun the character or lock its equipment slots and skills but it still may use items from inventory. That may look funny as mummified character can use healing potions. It is still helpful but it is weird.
How to make a state that forbids using items? I found some solutions but the fitting one was created for VX Ace whil I am using MZ and MV.
Really? I thought that "cannot move" would disable all action, to be honest.
I'd have to test this to see it that is true, but...
Well, I think "cannot move" is the one you're looking for. Maybe you tried to do this with traits or something?

1724063632215.png
I am using MZ and MV.
Which, specifically?

MV has Yanfly's Item Requirements which can do what you want, whereas MZ has VisuStella's Item Core.

Your game only has one code, it can't be both MV and MZ.
Really? I thought that "cannot move" would disable all action, to be honest.
I'd have to test this to see it that is true, but...
Well, I think "cannot move" is the one you're looking for. Maybe you tried to do this with traits or something?

View attachment 315107
I want to make a state that allows the character to use skills like 'healing' or 'mana transfer' but forbids using items for it. And of course target other while the user is in the state. "Cannot move" restriction forces the character to do nothing.

For now I am working with MZ.
Oh... Yeah in that case, cannot move wouldn't be the answer.
For now I am working with MZ.
Then you use the plugin I told you in my previous reply. The notetags to forbid you from using items on targets with a specific state are right in the instructions.
Then you use the plugin I told you in my previous reply. The notetags to forbid you from using items on targets with a specific state are right in the instructions.
If I understand correctly then I have to use the next script in an item's notetags?
<JS Item Enable>
user.isStateAffected(id) then
enabled = false
else
enabled = true;
</JS Item Enable>
No.

1 - That is not JavaScript syntax. I don't know where you got it from, but if it's valid for anything, it's some other programming language.

2 - You don't want to prevent the user from doing anything, you don't want it used on someone (e.g. a mummy). (unless your item only has a scope of The User to begin with)

That being said, I was wrong - I thought the VisuStella Item Core incorporated the content from Yanfly's Item Requirements, but it does not. It appears that VisuStella doesn't have anything to support those effects.

So you'd use VisuStella Battle Core, instead. If you want the item to be able to target living party members that don't have your mummy state - we'll say that's ID 42 - you'd give the item this:
Code:
<JS Targets>
targets = $gameParty.aliveMembers().filter(actor => !actor.isStateAffected(42));
</JS Targets>

I believe this also only works in battle, so if the item can be used from the menu and you want to control that, you'll have to come up with another solution. I've seen threads with little plugins for it, I think that portion of the code should be the same between MV and MZ so you can try anything you find with a Google.
According to my idea, the user (actor, of course) can be targeted by other actors and enemies but the user cannot use items not on other actors neither on enemies. I want to prevent user from using items on others. It would be better if the user cannot use items at all as long as it is affected by specific state!
So I have checked Items and Equips Core, found "JavaScript Notetags: Item Accessibility" and took the example from there.
<JS Item Enable>
code
code
enabled = code;
</JS Item Enable>

- Used for: Item Notetags
- Determines the enabled status of the item based on JavaScript code.
- If the actor this is disabled for is the only party member, it will not be
visible in the item list unless the VisuStella Battle Core is installed.
- If the VisuStella Battle Core is installed, then all battle scope items
will be visible even if they're disabled.
- Replace 'code' to determine the type enabled status of the item.
- The 'enabled' variable returns a boolean (true/false) to determine if the
item will be enabled or not.
- The 'user' variable refers to the user with the item.
- The 'item' variable refers to the item being checked.
- All other item conditions must be met in order for this to code to count.
Perhaps I have wrote wrong scripts or conditions. Unfortunately I am not pretty good with this stuff.
I also thought that I have use Skills and States Core, make a passive state that disables item using whenever actor is affected by another placeholder state.
Or maybe make a state with "On add" custom effect.
According to my idea, the user (actor, of course) can be targeted by other actors and enemies but the user cannot use items not on other actors neither on enemies.
I see. In that case, you don't need that whole VisuStella plugin. Just paste the below into a text editor, save as a *.js file, include as a plugin.

Code:
Window_ActorCommand.prototype.addItemCommand = function() 
{
    this.addCommand(TextManager.item, "item", !this._actor.isStateAffected(42));
};

Again, replace 42 with the ID of your mummified state. That should cause the entire Item command to be greyed out while they have the state on.

Original thread: https://forums.rpgmakerweb.com/threads/states-that-forbid-using-items.171217/