Way to stop characters from using certain items

Is there a way to check who an item is being used on? For instance, in my game, I have a skill that kills the caster (Shinzu) and buffs a target character. But I want Shinzu to stay dead until the battle ends, then be revivable. I would prefer if a revive item is impossible to use on Shinzu until the battle ends, but I also wonder if killing Shinzu again after being revived in the same battle would work.
Is there a way to check if the revive item is being used on Shinzu after they used the skill so it can revive them fine until they use the skill, and so that it can revive other characters just fine?

I imagine it could be possible with states but I can't quite figure it out.

Also sorry if this is very confusing to read, it was hard for me to explain.
there are two ways, the default way and one that requires a plugin and javascript.

the default way would be to have the item use a common event as well as an invisible target state.
then in the common event check all actors for the target state to see which actor it is, and give different effects for different actors. would probably need additional use of a switch to remember skill use.

the other way is to add a plugin that enables skill use conditions, and use javascript in those conditions to check everything. not recommended unless you have some experience with javascript in RM.
Sorry this took a while,
there are two ways, the default way and one that requires a plugin and javascript.

the default way would be to have the item use a common event as well as an invisible target state.
then in the common event check all actors for the target state to see which actor it is, and give different effects for different actors. would probably need additional use of a switch to remember skill use.

the other way is to add a plugin that enables skill use conditions, and use javascript in those conditions to check everything. not recommended unless you have some experience with javascript in RM.
How do I make a common event check all actors for a specific state, I thought I was on to something with variables, but I couldn't figure it out.
Thanks
you have a conditional branch with the option <actor> is affected by <state>.
you need one such branch for every actor in your game.

yes, that can be a lot if you have a lot of actors, but by defaulot and without scripts that is the onlx way.
How is Shinzu being "killed" upon using this skill? Would it make sense to not "kill" Shinzu upon using this skill, and instead give him/her a state (let's call it "Drained" for example) that:

Grants immortality
Restriction: cannot move
[SV] Motion: dead (if you're using sideview battles)
Sets HP to 0 (this is just for esthetics so is not necessary I suppose)
...and has as removal condition "remove at battle end"?

Since revive items can only target "dead" allies, Shinzu with "drained" status should not be a viable target. Sorry if I'm misunderstanding your situation.
The problem with @werzaque s suggestion would be that enemies would still see the "dead" shinzu as a target and waste their turns attacking him, so you'd also need a way to stop them from doing that. Maybe by giving the "Drained" State a trait that sets the target rate to 0.
The problem with @werzaque s suggestion would be that enemies would still see the "dead" shinzu as a target and waste their turns attacking him
Good catch!
How is Shinzu being "killed" upon using this skill? Would it make sense to not "kill" Shinzu upon using this skill, and instead give him/her a state (let's call it "Drained" for example) that:

Grants immortality
Restriction: cannot move
[SV] Motion: dead (if you're using sideview battles)
Sets HP to 0 (this is just for esthetics so is not necessary I suppose)
...and has as removal condition "remove at battle end"?

Since revive items can only target "dead" allies, Shinzu with "drained" status should not be a viable target. Sorry if I'm misunderstanding your situation.
This is actually genius! it also fixes a different similar problem I had that led up to this one, so I will definitely be using this for that problem. However, wouldn't this just shift my original problem slightly? What I mean is, now revive items won't work on Shinzu when they have this state, but wouldn't healing items still be able to be used on them? It's really not a big issue, but I don't want players to accidentally waste healing items and not realize it. Maybe I could combine this suggestion and the previous one.
Sorry, I'm really new to RPG Maker so if there's something obvious I'm missing that's probably why, and thanks for this suggestion!
Correct. Ideally you'd want Shinzu to count both as dead and alive but I don't think there's a (non-plugin) solution for that...
Correct. Ideally you'd want Shinzu to count both as dead and alive but I don't think there's a (non-plugin) solution for that...
Okay, I believe that I can use @Andar 's common event suggestion to make healing items unusable while Shinzu has this state.
Thank you all for helping me, I really wanted this idea to get in the game somehow and you guys made it happen!
I'm not exactly sure what Andar's solution is, but unless I'm reading this wrong this will still result in the item being consumed. I would suggest to try a plugin. For example:


The instructions are in Japanese but it should work if you specify in the item notes:

<RTS_Script:this.isStateAffected(x)> where x is the state number. Wait, let me test that first. EDIT: Okay, I had tested in MZ and it seems to work... sort of... but the item is auto-re-targeted to another actor. Let me stop being lazy and test in MV... EDIT2: in MV it works. I've added notetags to the items:
<RTS_Script:this.isStateAffected(5)>
<RTS_Script:this.isStateAffected(6)>


1691220107383.png
but unless I'm reading this wrong this will still result in the item being consumed.
not neccessarily - the branch where the player is checked can also replace the item or simply do not remove it, depending on consumable yes or no.
not neccessarily - the branch where the player is checked can also replace the item or simply do not remove it, depending on consumable yes or no.
Ah, I see. I guess it would work but you would have to do this for each actor and for each spell and item that heals. Having said that... the above plugin probably will still not prevent Shinzu from being healed by group healing items and spells.

Original thread: https://forums.rpgmakerweb.com/threads/way-to-stop-characters-from-using-certain-items.159403/