• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to update all players in the database

Nostalgian

Member
Joined
Mar 17, 2018
Messages
66
Reaction score
15
Hey everyone!

So, in my quest for world domination, I started asking myself this question.

This is all hypothetical, but I feel it would be good to know for the future, and surely I'm not the only one wondering this.

Say that right now in my server knights gain 30 hp per level. 3 months from now I decide that they really need 40 hp per level. What is the most efficient way to go about updating all of the existing knights to the correct amount of hp?
 
Solution
At the first you need to change the current given hp. Data->XML->vocation.xml:
XML:
gainhp="30"
Change the number from 30 to 40.

The second, you need to add the outstanding hp to players in the database:
SQL:
UPDATE `players` SET `healthmax` =  `healthmax` + ((`healthmax`*40 / `level`) - (`healthmax`*30 / `level`)) WHERE `vocation` = 4;

Dunno if it works(the first thought),but this is a hint.

Algorithm:
(`healthmax`*40 / `level`) - (`healthmax`*30 / `level`)

now you have max 500 hp and 5 lvl so:
(500 * 40 / 5) - (500 * 30 / 5) = 4 000 - 3 000 = 1 000 it's the outstanding hp.
At the first you need to change the current given hp. Data->XML->vocation.xml:
XML:
gainhp="30"
Change the number from 30 to 40.

The second, you need to add the outstanding hp to players in the database:
SQL:
UPDATE `players` SET `healthmax` =  `healthmax` + ((`healthmax`*40 / `level`) - (`healthmax`*30 / `level`)) WHERE `vocation` = 4;

Dunno if it works(the first thought),but this is a hint.

Algorithm:
(`healthmax`*40 / `level`) - (`healthmax`*30 / `level`)

now you have max 500 hp and 5 lvl so:
(500 * 40 / 5) - (500 * 30 / 5) = 4 000 - 3 000 = 1 000 it's the outstanding hp.
 
Last edited:
Solution
Back
Top