common event help

ok im trying to set up my revive item when used on the dead player it revives them and gives them a wounded state that can stack up to 5 times i am having problem with this this is what i have

Untitled-2.jpg
Untitled-1.jpg


it works out of combat but when i res someone in combat it crashes the game
and the other problem im having is how do i get the common event to only affect the targeted character in the change state it only lets me select entire party or i have to select a specific hero

thanks in advance
Force action then last target? then maybe make a skill thats designed to inflict the wounded state

Edit: the target of the skill would be the user
Please use Alt+PrintScreen to take screenshots - it will capture only the active window and not the entire desktop background behind it, making it easier to see/read what you have.

When it "crashes" the game, what error message does it give? What is in the console at that time?
The good news is that you can access the target actor within the Common Event. The bad news is that doing so will require a tiny bit of scripting. One of the issues that we will face is that every time a party member dies, all of their States are wiped clean. To get around that, I used variables to store the 'Wound' level of each party member (variable 60 + the ActorID stored in Variable 49).

So whenever they go to a hospital or whatnot to remove their 'Wound' levels, remember to not only remove all of the 'Wound' States but also reset their particular variable to zero as well.

Code:
◆Comment:// Determine if Party is in Battle
◆If:Script:$gameParty.inBattle()
  ◆Comment:// Party in Battle; store 'BattleManager._action._subjectActorId' into variable
  ◆Control Variables:#0049 = BattleManager._action._subjectActorId + 1
  ◆
:Else
  ◆Comment:// Party is on Map; store '$gameParty._targetActorId' into variable
  ◆Control Variables:#0049 = $gameParty._targetActorId
  ◆
:End
◆Comment:// Check For and Apply 'Wound' State
◆If:Script:$gameVariables.value(60 + $gameVariables.value(49)) === 0
  ◆Change State:{#0049}, + Wound Lv 1
  ◆Script:var variableId = 60 + $gameVariables.value(49);
  :      :$gameVariables.setValue(variableId, 1);
  ◆Exit Event Processing
  ◆
:End
◆If:Script:$gameVariables.value(60 + $gameVariables.value(49)) === 1
  ◆Change State:{#0049}, - Wound Lv 1
  ◆Change State:{#0049}, + Wound Lv 2
  ◆Script:var variableId = 60 + $gameVariables.value(49);
  :      :$gameVariables.setValue(variableId, 2);
  ◆Exit Event Processing
  ◆
:End
◆If:Script:$gameVariables.value(60 + $gameVariables.value(49)) === 2
  ◆Change State:{#0049}, - Wound Lv 2
  ◆Change State:{#0049}, + Wound Lv 3
  ◆Script:var variableId = 60 + $gameVariables.value(49);
  :      :$gameVariables.setValue(variableId, 3);
  ◆Exit Event Processing
  ◆
:End
◆If:Script:$gameVariables.value(60 + $gameVariables.value(49)) === 3
  ◆Change State:{#0049}, - Wound Lv 3
  ◆Change State:{#0049}, + Wound Lv 4
  ◆Script:var variableId = 60 + $gameVariables.value(49);
  :      :$gameVariables.setValue(variableId, 4);
  ◆Exit Event Processing
  ◆
:End
◆If:Script:$gameVariables.value(60 + $gameVariables.value(49)) === 4
  ◆Change State:{#0049}, - Wound Lv 4
  ◆Change State:{#0049}, + Wound Lv 5
  ◆Script:var variableId = 60 + $gameVariables.value(49);
  :      :$gameVariables.setValue(variableId, 5);
  ◆Exit Event Processing
  ◆
:End
◆If:Script:$gameVariables.value(60 + $gameVariables.value(49)) === 5
  ◆Change State:{#0049}, + Wound Lv 5
  ◆Exit Event Processing
  ◆
:End

Original thread: https://forums.rpgmakerweb.com/threads/common-event-help.112853/