Storing item target's ID as a variable and preventing a certain Actor from being targeted

I've made an item that's designed to have a different effect depending on who the item targets (it can only be used in the Menu screen, so the User of the item is always the Player, that's why it needs to get the target's ID and not the user's ID). It also can only be used on characters that aren't the player (Actor 1). 


First, is there a script (or plugin) that allows me to store the ActorID of the item's target to Variable 15?


I've tried $gameVariables.setValue(15, b.actorId());


in the damage formula box, but it brings up an error saying "Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 3 is non-finite", which I'm pretty sure means "your damage formula is broken".
Bump?
Hey! I was trying to find it as well and through testing I did!


Try this to return the target actor id of the last item used:


$gameParty._targetActorId //Will return the id of the actor the last item or skill used by the party targeted
$gameParty._lastItem._itemId //Use this to return the id of the last item used by the party


I haven't tested those in battle so I don't know if they work or not, but they should.
Ah, brilliant, thank you very much! That really reduces the amount of eventing I need.
Hey, I wanted to do the same, but unfortunately I don't get it.

$gameParty._targetActorId //Will return the id of the actor the last item or skill used by the party targeted
$gameParty._lastItem._itemId //Use this to return the id of the last item used by the party

Can you say me where I have to write this in? I tried the damage formula box, but this didn't work. Do I have to do something else?


My item is a skill book, so it's only usable once in Menu screen and has no damage effects.
Hey, I wanted to do the same, but unfortunately I don't get it.


Can you say me where I have to write this in? I tried the damage formula box, but this didn't work. Do I have to do something else?


My item is a skill book, so it's only usable once in Menu screen and has no damage effects.



Try it in a common event called upon using the item.


Use a control variable: script.

Original thread: https://forums.rpgmakerweb.com/threads/storing-item-targets-id-as-a-variable-and-preventing-a-certain-actor-from-being-targeted.63269/