If you're trying to save the actor's ID, why are you sticking it inside $gameActors.actor() to retrieve the entire actor object?
It should just be BattleManager._action._subjectActorId
that's because I already tried;
Code:
If: Script: $gameParty.inBattle()
$gameVariables.setValue(7, BattleManager._action._subjectActorId)
Else:
$gameVariables.setValue(7, $gameParty._targetActorId)
and it didn't work. It doesn't return an error message or anything, but it doesn't actually store the ID of the actor to variable #7; variable #7 is still 0.
Edit: I've just discovered that this bit of code somehow breaks what I had, because it is returning a TypeError whenever I try to use the item on the map;
Cannot read property '_subjectActorId' of undefined
Edit 2: correction,
both of these are returning this same error when I try to use the item on the map screen. I've only just noticed, and I can't remember which version of this code didn't do that.
Edit 3: I'm starting to think maybe the first line of code is the issue;
Code:
If: Script: $gameParty.inBattle()
that's because I already tried;
Code:
If: Script: $gameParty.inBattle()
$gameVariables.setValue(7, BattleManager._action._subjectActorId)
Else:
$gameVariables.setValue(7, $gameParty._targetActorId)
and it didn't work. It doesn't return an error message or anything, but it doesn't actually store the ID of the actor to variable #7; variable #7 is still 0.
Edit: I've just discovered that this bit of code somehow breaks what I had, because it is returning a TypeError whenever I try to use the item on the map;
Edit 2: correction,
both of these are returning this same error when I try to use the item on the map screen. I've only just noticed, and I can't remember which version of this code didn't do that.
Edit 3: I'm starting to think maybe the first line of code is the issue;
Code:
If: Script: $gameParty.inBattle()
Okay, so I've just tested a theory and used each line of code by itself. When it is just;
Code:
$gameVariables.setValue(7, BattleManager._action._subjectActorId)
it works as intended in battle. likewise, when it is just;
Code:
$gameVariables.setValue(7, $gameParty._targetActorId)
it works as intended on the map screen. This must mean that their is something wrong with the if/else part of the code.