@ATT_Turan - Thanks for your reply, but it still the same, even with a $gamePlayer.refresh(); sandwiched between a pair of this.refresh(); before and after the old states are removed, and after the new state is added.
All other plugins are turned off on the project I use for testing and development. The male female states just show icons.
Edit: I have just tried making a new project in case the one that I have been using for development was an older version of MV. Still the same.
Edit2: This is a plugin that I can't put out for other people because I nicked a lot of code from other authors, particularly on the script calls for conditional branches and control variable editor commands. As it is for my own use, at worse, I can disable the plugin commands applying states, and only apply states when the player chooses "Okay" for "Are you happy with this character you have just created?". (My intention is to have other states applied depending upon choices the player makes during character creation.)
I will investigate further, and if I find anything out, mention it here, or on a later post if the forum has a time limit on editing posts. Thanks again to ATT_Turan for your help.
Edit3: I used a couple of events to compare the editor commands and script boxes. Using the editor commands to remove and add states always works, even if a series of changes are done within the same event on the same visit to the event.
With scripts, things are a little more complicated. Doing one change at a time for each visit to the event works. Code used to add state 11 to Harold, below, in spoiler if I can get the formatting right:
Code to add state
$gameActors.actor(1).addState(11);
$gameActors.actor(1).refresh();
$gamePlayer.refresh();
However, several changes to the state (applying and removing) whether in the same script boxes or multiple script boxes doesn't apply the state.
Edit 4 - Looks as if I may had done it! I tested it and the states went on as intended. Will report back if it doesn't prove reliable
I added:
this.clearResult();
to near the end of the function that changes an actor's gender. It now looks like:
[ICODE]
Game_Actor.prototype.changeGender = function (newGender) {
this.gender = newGender;
if (this.gender == 1) {
if (this.isStateAffected(femaleActorState))
this.removeState(femaleActorState);
if (this.isStateAffected(maleActorState))
this.removeState(maleActorState);
}
if (this.gender == 2) {
if (this.isStateAffected(femaleActorState))
this.removeState(femaleActorState);
this.addState(maleActorState);
};
if (this.gender == 3) {
if (this.isStateAffected(maleActorState))
this.removeState(maleActorState);
this.addState(femaleActorState);
};
this.clearResult();
};
[/ICODE]