Tons of new infos (thank you veterans!)
I tried your script and I have to inform that the Trihan's script works fine but heals only the first actor in party (In my solution I used a "target" state to get the target partymember, so it can be solved easily adding that piece of code and it works great!)
Solar_flare script does not work for some reason I don't know very well:
JavaScript:
// First script command (don't include this line)
var healStates = [4, 5, 6, 7];
this.choiceStates = [];
this.choices = [];
healStates.forEach(state => {
this.target = $gameParty.menuActor();
if(this.target.isStateAffected(state)) {
var name = $dataStates[state].name;
this.choices.push(name);
this.choiceStates.push(state);
}
});
// Second script command (don't include this line)
var states = this.choiceStates, target = this.target;
$gameMessage.setChoices(this.choices, 0);
$gameMessage.setChoiceCallback(index => target.removeState(choiceStates[index]));
// Optional - clean up variables.
delete this.target;
delete this.choices;
delete this.choiceStates;
I also modified the script to avoid all the error messages it gave me in a game test and went up with this:
JavaScript:
// comment - first Script block
var healStates = [4, 5, 6, 7];
this.choiceStates = [];
this.choices = [];
healStates.forEach(state => {
this.target = $gameParty.menuActor();
if (this.target.isStateAffected(state)) {
var name = $dataStates[state].name;
this.choices.push(name);
this.choiceStates.push(state);
};
});
// comment - second Script block
var states = this.choiceStates, target = this.target, stateName = this.choices;
$gameMessage.setChoices(this.choices, 0);
$gameMessage.setChoiceCallback(index => target.removeState(stateName[index]));
delete this.target;
delete this.choices;
delete this.choiceStates;
and a screenshot of the common event page called by the item:
But this one, that gets no error in test phase, doesn't heal the state of any of the partymembers...
I'm not really sure I understood all the code the veteran used (i did by best but I'm Noob eheh) but I think the problem is in the targeting system of this script. I'm working on it but if someone gets it working could he please post the solution?