Use an item once per battle

I am trying make an item that can only be used once per battle, and I'm hitting a brick wall.

One option:
Switch turned on turn 0 of each battle. Item calls common event which checks if a particular switch is ON. If it is, does forced action on a skill, and turns that switch OFF. The problem is that Forced Action requires that I specify a particular actor to use the skill, but I cannot know which actor the player has chosen.

Another option:
Use the damage formula of the item itself. No problem about which actor it is - but I can see no way of preventing it being used again that battle.

Does anyone have any insight into how this might be done?

Thanks.
make the item set a state on the user, and have that state invisible (no message, no icon, no effect).
then in the common event, check which actor has that state and use a force action on that actor, remove the state after that.

you'll need one conditional branch for each actor in your game in the common event, but it will work without problems if you go that route - as long as you don't have too many actors.
You could use script and do a .select on the party members to filter out which one has the state and that will save you needing a conditional branch for every actor.
@Trihan Could you spell that out in baby steps? My head doesn't seem to be working well today, and I don't understand clearly what you mean.
item restriction scripts using !states.
use item normally but then common event adds state to all actors which blocks using that item
@Trihan Could you spell that out in baby steps? My head doesn't seem to be working well today, and I don't understand clearly what you mean.

$game_party.alive_members.select { |member| member.has_state?(id of state)}[0]
@Trihan Told you my head is not working - I didn't explain myself well.
I know about the .select script call, but what I can't work out is how to use that to inform the Force Action command which one it is. There is no option in that command except a named actor.
Sorry for being so slow on the uptake. Maybe I need more caffeine.
Oh, I was suggesting that you use the script call for forcing action rather than the event command.
@Trihan I think you are about to tear your hair out, because I still don't understand what you are saying.

The item inflicts state 155 on the user. In the common event which the item calls up I have the script call with that state id. (Not sure what the 0 at the end does, but still). How does that script call force the actor to use skill 110?
.select gives you an array of elements that meet the criteria. [0] gets the first element in that array.

You'd then store that in a variable and have the battler call the force action method:

Code:
actor =  $game_party.alive_members.select { |member| member.has_state?(155)}[0]
actor.force_action(110, target id here)
@Trihan Light is slowly dawning.
One last question. You have target id. How do I know which enemy the actor has chosen to target? I suppose it would be the equivalent of 'Last target' in the event command version, but I don't know the script call equivalent.
actor.last_target_index, or just enter -2 and the method will use the last target index itself.
@Trihan
So I did the script call like this (copy/pasting from your posts):
Code:
$game_party.alive_members.select { |member| member.has_state?(155)}[0]
actor.force_action(110, actor.last_target_index)

Which gives this error message

1598899994771.png
Sorry, I got the method wrong. It's just state?
@Trihan I changed it to member.state? and then got this.

1598900369505.png
You didn't put actor = at the beginning of the select line.
@Trihan And finally, gasping and panting, I stagger over the finishing line.

Thank you so much for all your help. You've shown the patience of a saint.
It's born of many long years of helping Kes with VX Ace queries. 😉
@Trihan Ouch!!
I deserve that.
I didn't mean that in a disparaging way at all, but I do tend to jump in immediately whenever you ask a question. 😛

Original thread: https://forums.rpgmakerweb.com/threads/use-an-item-once-per-battle.126514/