- Joined
- Nov 14, 2016
- Messages
- 136
- Reaction score
- 72
- First Language
- English
If I use:
this.addState(VAR);
to apply a state to an actor, do I need to take some action to refresh the actor's data structure?
I am writing a gender plugin that sets gender and applies states automatically to male and female actors. You can set gender either by notetag or by plugin command. (The idea of the plugin commands is for games that allow the player to customise their character at the start of a new game.)
When testing with an event that uses the plugin commands to change the gender of an actor, I found that the first change of gender for an actor always applies the state selected in the parameters after setting gender. Rlepeated changes of gender without moving the party don't. If I change an actor's gender, move the party a very short distance and return to the event, then change an actor's gender again, the state is applied as intended.
It seems to me that some kind of update or refresh happens whenever the party is moved. Is there anything that I could include to make adding the state more reliable?
The bit that I use to do the gender change is below:
this.addState(VAR);
to apply a state to an actor, do I need to take some action to refresh the actor's data structure?
I am writing a gender plugin that sets gender and applies states automatically to male and female actors. You can set gender either by notetag or by plugin command. (The idea of the plugin commands is for games that allow the player to customise their character at the start of a new game.)
When testing with an event that uses the plugin commands to change the gender of an actor, I found that the first change of gender for an actor always applies the state selected in the parameters after setting gender. Rlepeated changes of gender without moving the party don't. If I change an actor's gender, move the party a very short distance and return to the event, then change an actor's gender again, the state is applied as intended.
It seems to me that some kind of update or refresh happens whenever the party is moved. Is there anything that I could include to make adding the state more reliable?
The bit that I use to do the gender change is below:
Game_Actor.prototype.changeGender = function (newGender) {
this.removeState(maleActorState);
this.removeState(femaleActorState);
this.gender = newGender;
if (this.gender == 2) {
this.addState(maleActorState);
};
if (this.gender == 3) {
this.addState(femaleActorState);
};
};