[Fixed] sys.changePokeNum - Stats of the previous Pokemon hold

Discussion in 'Solved Bugs' started by Alipio, Jan 1, 2017.

  1. Alipio

    Alipio -Sab-

    Joined:
    Apr 3, 2015
    Messages:
    11
    Likes Received:
    3
    PO Trainer Name:
    -Sab-
    Client Type: PC - Windows.
    Client Version: v2.6.2.1
    When did you first notice the bug?: Today.
    Have you been able to reproduce the bug?: Yes.
    Information: I'm working on a new Tier, whose name is "Metroshed". So basically I create a command to change the pokemon of my team, around this function:
    sys.changePokeNum(player_id, team, pokeSlot, pokeNum) Changes the Pokémon in that slot (eg 150 = Mewtwo), slots range from 0 to 5.
    [Reference: https://github.com/po-devs/pokemon-online/wiki/Server-Script-Functions ]

    The problem is that the stats (HP, ATK, etc) of the new pokemon doesn´t change at all.

    Here is the code:
    // This command change your team to Metroshed (Full Shedinjas)
    for (i = 0; i < 6; i++) {
    sys.changePokeNum(ID,0,i,292); // Shedinja.
    sys.changePokeName(ID,0,i,sys.pokemon(292));
    for (j = 0; j < 6; j++) { // Reseteador de EVs.
    sys.changeTeamPokeEV(ID,0,i,j,0);
    sys.changeTeamPokeDV(ID,0,i,j,0);
    }
    // Not Important.
    }
    sys.changeTier(ID,0,"Metroshed"); sys.updatePlayer(ID);
    sys.sendMessage(ID,"Se cambio su Team a la tier Metroshed!",Canal);
    return;
    // A command to watch my own team
    var Msj = "Pokemon: "+sys.teamPoke(ID,0,0)+" ("+sys.pokemon(sys.teamPoke(ID,0,0))+") ";
    Msj += ("HP: "+sys.teamPokeStat(ID,0,0,0)+" ATK: "+sys.teamPokeStat(ID,0,0,1));
    Msj += (" DEF: "+sys.teamPokeStat(ID,0,0,2)+" SPA: "+sys.teamPokeStat(ID,0,0,3));
    Msj += (" SPD: "+sys.teamPokeStat(ID,0,0,4)+" SPE: "+sys.teamPokeStat(ID,0,0,5));
    sys.sendMessage(ID,Msj,Canal);
    return true;
    Here is the result.
    [​IMG]

    I would be grateful if you could tell me if there is any way to solve this problem.

    Thanks in advance.
     
  2. sulcata

    sulcata stéphane curry best waifu Forum Moderator Server Administrator Forum Moderator Server Administrator

    Joined:
    Jun 13, 2012
    Messages:
    968
    Likes Received:
    744
    Try changing the level too, i.e. set it to 100 or whatever it's supposed to be. I'm pretty sure I fixed this at some point, but maybe it's an old server version or we never released a version since then. There were some issues that caused stats to not be recalculated every time.

    stats should really be calculated on the fly :v
     
  3. Alipio

    Alipio -Sab-

    Joined:
    Apr 3, 2015
    Messages:
    11
    Likes Received:
    3
    PO Trainer Name:
    -Sab-
    Oh! Thank! sys.changePokeLevel(ID, Team, Poke, Level) Totally works.