When you set the user "class" e.g goblin,human elf or dwarf. it saves the variable "Selection" to the player save file and turns the user into the specified npc.
But!, if i logout and login it turns the user back into a human again for some reason. ill give you my code for everything.
This is for the player turning into the npc. its in client.java
Code:
public void checkClass() {
if(selection == 1) {
updateRequired = true;
appearanceUpdateRequired = true;
} else if(selection == 2) {
npcId = 101;
npcId2 = 101;
isNpc = true;
updateRequired = true;
appearanceUpdateRequired = true;
} else if(selection == 3) {
npcId = 1184;
npcId2 = 1184;
isNpc = true;
updateRequired = true;
appearanceUpdateRequired = true;
} else if(selection == 4) {
npcId = 119;
npcId2 = 119;
isNpc = true;
updateRequired = true;
appearanceUpdateRequired = true;
} else {
updateRequired = true;
appearanceUpdateRequired = true;
}
}
This is for the buttons that are on the interface
Code:
case 43027:
c.sM("You have chosen the Human Class");
c.RemoveAllWindows();
c.selection = 1;
c.checkClass();
break;
case 43033:
c.sM("You have chosen the Goblin Class");
c.RemoveAllWindows();
c.selection = 2;
c.checkClass();
break;
case 43051:
c.sM("You have chosen the Elf Class");
c.RemoveAllWindows();
c.selection = 3;
c.checkClass();
break;
case 43052:
c.sM("You have chosen the Dwarf Class");
c.RemoveAllWindows();
c.selection = 4;
c.checkClass();
break;
When clicked it changes the variable "selection" to either 1,2,3 or 4.
That variable saves into the player file successfully. but if i logout and log back in again. The player turns back into the default character.
I think this is because its not loading the variable from the player save file.
Any ideas?
Heres one of my test save files. "character-class" is the class of the player.
character-username = Test
character-password = 91992774fa03d102cb57ffe1cab947a3
character-class = 3
[/code]