Change HP of... Variable?

So I'm actually not sure what this does or how to use it.

Under the "Change HP" event command though about half the Actor commands seem to list it, have a "Change by Variable" instead of "Actor".

Not entirely sure what that does.
It means that the actor whose ID will have their HP changed will be determined by the value in the variable you choose, rather than a specific actor in the dropdown.

For example, if you choose variable #4 for the operation, and at the time of executing the Change HP command that variable holds the value 6, then actor 6 in the database will be the one whose HP changes.
So, if I wanted an event interaction that roll to see which person it would damage, I would go;
Control Variable: #Name = Random 1..4
Change HP : {Damage}

This should roll a number, 1-4, and then damage the actor number that comes up.

Though, how would I do this if the actor has a chance to not be in the party.
You could try something like this~
Spoiler: Event example
Code:
◆Comment:Randomly pick index (a.k.a. position) 0~3
◆Control Variables:#0001 targetActor = Random 0..3
◆Comment:Replace with corresponding actor ID (Game Data > Party)
◆If:targetActor = 0
  ◆Control Variables:#0001 targetActor = Actor ID of the party member #1
  ◆
:Else
  ◆If:targetActor = 1
    ◆Control Variables:#0001 targetActor = Actor ID of the party member #2
    ◆
  :Else
    ◆If:targetActor = 2
      ◆Control Variables:#0001 targetActor = Actor ID of the party member #3
      ◆
    :Else
      ◆Control Variables:#0001 targetActor = Actor ID of the party member #4
      ◆
    :End
    ◆
  :End
  ◆
:End
◆Comment:Do 50 damage!
◆Change HP:{targetActor}, - 50
Alternatively (particularly if you don't have a preset number of actors in the party) you can get a random actor ID from the living party members using Control Variables > Script:
JavaScript:
$gameParty.aliveMembers()[Math.randomInt($gameParty.size())].actorId()
Then just use that value for the Change HP actor target~ 😤

Original thread: https://forums.rpgmakerweb.com/threads/change-hp-of-variable.125663/