Thread: player login changing to selected class

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 player login changing to selected class 
    Community Veteran

    Patawic's Avatar
    Join Date
    Dec 2006
    Age
    29
    Posts
    1,950
    Thanks given
    40
    Thanks received
    150
    Rep Power
    2463
    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]

    Reply With Quote  
     

  2. #2  
    Member player login changing to selected class Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    I think this is because its not loading the variable from the player save file.
    That is your problem.

    Also make sure you're calling checkClass after the loading method.

    Attached imageAttached image
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Sep 2008
    Posts
    2,219
    Thanks given
    148
    Thanks received
    204
    Rep Power
    1570
    What Luke said. Be sure to load it in your initialize method, or whatever.



    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Nov 2008
    Posts
    2,180
    Thanks given
    148
    Thanks received
    99
    Rep Power
    2004
    You need to do like: Loadgoblins(); inside Initialize, so which ever one they pick it saves in there char void which the Loadgloblins reads, but you MUST put it in initialize.
    Reply With Quote  
     

  5. #5  
    Community Veteran

    Patawic's Avatar
    Join Date
    Dec 2006
    Age
    29
    Posts
    1,950
    Thanks given
    40
    Thanks received
    150
    Rep Power
    2463
    i have my checkclass(); under the initialize void.

    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Nov 2008
    Posts
    2,180
    Thanks given
    148
    Thanks received
    99
    Rep Power
    2004
    Use an if statement if it's not right in initalize, for instance:
    if playerisgoblin
    isnpc 102;
    else {
    if playerisrabbit
    isnpc 103:
    else {
    blah blah blah blah, you just got fuck with it, then once you get it clean up the code
    Reply With Quote  
     

  7. #7  
    Community Veteran

    Patawic's Avatar
    Join Date
    Dec 2006
    Age
    29
    Posts
    1,950
    Thanks given
    40
    Thanks received
    150
    Rep Power
    2463
    thats what the checkClass void does. its because its not loading the variable of what the npc is meant to be from the player save file

    Reply With Quote  
     

  8. #8  
    Donator

    Ecstasy's Avatar
    Join Date
    Sep 2008
    Age
    29
    Posts
    5,031
    Thanks given
    324
    Thanks received
    596
    Rep Power
    843
    Do you have it in your initialize method

    Reply With Quote  
     

  9. #9  
    Community Veteran

    Patawic's Avatar
    Join Date
    Dec 2006
    Age
    29
    Posts
    1,950
    Thanks given
    40
    Thanks received
    150
    Rep Power
    2463
    yes its in my initialize method

    Reply With Quote  
     

  10. #10  
    Banned

    Join Date
    May 2009
    Posts
    1,387
    Thanks given
    21
    Thanks received
    14
    Rep Power
    0
    Quote Originally Posted by Ecstasy View Post
    Do you have it in your initialize method
    Quote Originally Posted by .:Patrick:. View Post
    i have my checkclass(); under the initialize void.
    Yes Ecstasy, he does, lol.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •