• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Player_classlevelstats

Status
Not open for further replies.

yvoms

Exalted Member
hmm, so i thought i was smart and tried making an Sql query like

Code:
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`)
    select 1, l.level, 8121 * pow(1.05, l.level - 81), 0
    from player_classlevelstats l
    where l.level >= 81 and l.level <= 255

However it does not insert it, any idea on what i've done wrong here?

/* Affected rows: 0 Gevonden rijen: 0 Waarschuwingen: 0 Duur van 1 query: 0,016 sec. */
 

Rochet2

Moderator / Eluna Dev
You cant select and insert to same table. Or at least update and select, but probably applies to insert too.

Create a temporary copy of the table like this:
Code:
DROP TABLE IF EXISTS player_classlevelstats_copy;
CREATE TABLE player_classlevelstats_copy AS (SELECT * FROM player_classlevelstats);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`)
    select 1, l.level, 8121 * pow(1.05, l.level - 81), 0
    from player_classlevelstats_copy l
    where l.level >= 81 and l.level <= 255;
DROP TABLE IF EXISTS player_classlevelstats_copy;


ps.
Does the select query even return anything?
Code:
select 1, l.level, 8121 * pow(1.05, l.level - 81), 0
    from player_classlevelstats l
    where l.level >= 81 and l.level <= 255;
 
Last edited:

yvoms

Exalted Member
Select query doesn't return anything i guess that may have been the issue hehe.

However
Code:
select 1, l.level, 8121 * pow(1.05, l.level - 1), 0
    from player_classlevelstats l
    where l.level >= 1 and l.level <= 255;
Does return value's :eek:

All im' trying to do is add stats from level 80 ->255 and adding 0.70%HP/Mana on each level.
For all classes, 1 t/m 11
 
Last edited:

Rochet2

Moderator / Eluna Dev
You could .. execute this 175 times
Code:
INSERT INTO player_classlevelstats (class, `level`, basehp, basemana)
SELECT class, `level`+1, basehp*1.7, basemana*1.7 from player_classlevelstats WHERE `level` = (select max(`level`) from player_classlevelstats);
Seems the mana and hp column types dont allow it though. The range for basehp and mana is too small to be increased by 70% on every level.

And apparently select is allowed in insert into, just not update.
 
Last edited:
Status
Not open for further replies.
Top