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

Probably the fastest and best way to update instances

Tok124

Respected Member
To learn more about the health calculation check rochet2's first comment !
Hello,

I had an idea on how to update instance mobs by percentage, So the health and mana and stuff gets updated. But instead of going inside each instance and do .npc info for each mob to find their entry and then go in DB and update them one by one. I had a better idea... I made a inner join query so the query will join creature table to select the creatures by their Map ID. So now with this query all you have to do is to go inside the instance and do .gps, You will see the Map ID for the instance. So then add the MapID to the query and run the query and wollah ! All mobs in the instance have been updated

Upgrade Query


Keep in mind that if you use this query and update the level to 255 then the creature will get lower health if you dont have edited anything in creature_classlevelstats. But you can run the query multiple times or choose a higher percentage value.

If you want to downgrade the mobs in the instance you can use this query
Downgrade Query



This query will downgrade the mobs by percentage, So if you set the health to 10 for this query then it will downgrade health by 10

Good luck with the query, Let me know if you want me to edit anything, Like adding more columns or something
 
Last edited:

Rochet2

Moderator / Eluna Dev
The health calculation depends on the basehp from creature_classlevelstats and the modifier.
You dont use the basehp in the calculations, so if the levels stay the same and only HP is changed, you simply are dividing or multiplying the HP multiplier.
This means its impossible for you to actually calculate a 10 hp change without assuming what the basehp actually is.

So if the basehp is 10000, the modifier is 15.5, so hp is 155000
after multiplying (using first script with default settings) the modifier is 155, so hp is increased to 1550000
after dividing (using second script with default settings) the modifier is 1.55, so hp is decreased to 15500

The increase and decrease was not 10% or 10 hp, it was a lot more.
A 10% HP loss would be calculated like so: health_mod * (1-0.1)
which means if the modifier is 1 (100% of basehp) it will be multiplied by 0.9, so 1*0.9, which is 90%, so 10% was lost.
Based on this I say your script by default increases or decreases the HP by 1000%


So you can do % changes and the code is good, but I wouldnt agree with the math there, and changing level will alter the HP completely, so I would leave that out if the intention is to change HP by %.
 

Tok124

Respected Member
The health calculation depends on the basehp from creature_classlevelstats and the modifier.
You dont use the basehp in the calculations, so if the levels stay the same and only HP is changed, you simply are dividing or multiplying the HP multiplier.
This means its impossible for you to actually calculate a 10 hp change without assuming what the basehp actually is.

So if the basehp is 10000, the modifier is 15.5, so hp is 155000
after multiplying (using first script with default settings) the modifier is 155, so hp is increased to 1550000
after dividing (using second script with default settings) the modifier is 1.55, so hp is decreased to 15500

The increase and decrease was not 10% or 10 hp, it was a lot more.
A 10% HP loss would be calculated like so: health_mod * (1-0.1)
which means if the modifier is 1 (100% of basehp) it will be multiplied by 0.9, so 1*0.9, which is 90%, so 10% was lost.
Based on this I say your script by default increases or decreases the HP by 1000%


So you can do % changes and the code is good, but I wouldnt agree with the math there, and changing level will alter the HP completely, so I would leave that out if the intention is to change HP by %.
Thanks for the reply rochet. I will try improve the query to add basehp aswell so that the health scales correctly :) But i know the the health calculation depends on the basehp from creature_classlevelstats. i just need to find a good way to code it :)

- - - Updated - - -

Maybe you could give me a little hint here hehe :)
 

Tok124

Respected Member
But yeah, You might be right. It's probably better to skip the level increment, But most devs who customize instances increase the level aswell. Usually to 255. I have not seen many level 80 funserver with custom gear and custom instances with high stats
 

mcraider

Illustrious Member
this is cool i wish i had this a week ago i had edited all the mobs in the Scarlet instances to level 100 and set there health each one mob at a time lol
 

Tok124

Respected Member
this is cool i wish i had this a week ago i had edited all the mobs in the Scarlet instances to level 100 and set there health each one mob at a time lol
Hehe yeah, It takes time to update them one by one, Maybe you could use my query for your next Custom Instance hehe
 

mcraider

Illustrious Member
Hehe yeah, It takes time to update them one by one, Maybe you could use my query for your next Custom Instance hehe

was gonna use this to update a instance and i get this error
Code:
SQL Error (1054): Unknown column 't.Health_mod' in 'fielt list'
 

mcraider

Illustrious Member
changed t.Health_mod to t.HealthMultiplier get this error

Code:
SQL Error (1054): Unknown column 't.HealthMultiplier' in 'fielt list'

so i looked in the DB and saw it was HealthModifier lol and mana to ManaModifier and it worked
 
Last edited:

Marko

Enthusiast
lost data

Hello there again, seems that as this forum has changed some posts were lost. Here was a nice code on how to also update mindmg and maxdmg. I'm sure i copied this code to some note but can't find it now. Can you if it is not bothersome write it again?
i'm guessing i should just add it to code myself so it would look like this:

SET
@Health = 50,
@Mana = 50,
@minlevel = 85,
[MENTION=401]Max[/MENTION]level = 85,
@mindmg = 10
[MENTION=401]Max[/MENTION]dmg = 22
@MapID = 732;

UPDATE creature_template AS t
INNER JOIN creature AS c
ON t.entry = c.id
SET
t.Health_mod = t.health_mod * @Health, t.minlevel = @minlevel, t.maxlevel = [MENTION=401]Max[/MENTION]level, t.Mana_mod = t.Mana_mod * @Mana, t.mindmg = @mindmg, t.maxdmg = [MENTION=401]Max[/MENTION]dmg
WHERE
c.map = @MapID;


this for example should edit all creatures in tol barad but i seem to have messed it up.

2 queries executed, 1 success, 1 errors, 0 warnings

Query: SET @Health = 50, @Mana = 50, @minlevel = 85, [MENTION=401]Max[/MENTION]level = 85, @mindmg = 10 [MENTION=401]Max[/MENTION]dmg = 22 @MapID = 732

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near [MENTION=401]Max[/MENTION]dmg = 22
@MapID = 732' at line 7

Execution Time : 0 sec
Transfer Time : 0 sec
Total Time : 0.134 sec
--------------------------------------------------

Query: UPDATE creature_template AS t INNER JOIN creature AS c ON t.entry = c.id SET t.Health_mod = t.health_mod * @Health, t.minlevel =...

0 row(s) affected

Execution Time : 0.137 sec
Transfer Time : 0.001 sec
Total Time : 0.138 sec


not sure why the maxdmg column is not written correctly.. in any case, thnx for your attention

oh and site automatically adds link to user max whenever max is written, so ignore that :D i tried to correct it and deleted the mentioning code but it just gets added automatically.
 
Last edited:

Tok124

Respected Member
Hello there again, seems that as this forum has changed some posts were lost. Here was a nice code on how to also update mindmg and maxdmg. I'm sure i copied this code to some note but can't find it now. Can you if it is not bothersome write it again?
i'm guessing i should just add it to code myself so it would look like this:

SET
@Health = 50,
@Mana = 50,
@minlevel = 85,
[MENTION=401]Max[/MENTION]level = 85,
@mindmg = 10
[MENTION=401]Max[/MENTION]dmg = 22
@MapID = 732;

UPDATE creature_template AS t
INNER JOIN creature AS c
ON t.entry = c.id
SET
t.Health_mod = t.health_mod * @Health, t.minlevel = @minlevel, t.maxlevel = [MENTION=401]Max[/MENTION]level, t.Mana_mod = t.Mana_mod * @Mana, t.mindmg = @mindmg, t.maxdmg = [MENTION=401]Max[/MENTION]dmg
WHERE
c.map = @MapID;


this for example should edit all creatures in tol barad but i seem to have messed it up.

2 queries executed, 1 success, 1 errors, 0 warnings

Query: SET @Health = 50, @Mana = 50, @minlevel = 85, [MENTION=401]Max[/MENTION]level = 85, @mindmg = 10 [MENTION=401]Max[/MENTION]dmg = 22 @MapID = 732

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near [MENTION=401]Max[/MENTION]dmg = 22
@MapID = 732' at line 7

Execution Time : 0 sec
Transfer Time : 0 sec
Total Time : 0.134 sec
--------------------------------------------------

Query: UPDATE creature_template AS t INNER JOIN creature AS c ON t.entry = c.id SET t.Health_mod = t.health_mod * @Health, t.minlevel =...

0 row(s) affected

Execution Time : 0.137 sec
Transfer Time : 0.001 sec
Total Time : 0.138 sec


not sure why the maxdmg column is not written correctly.. in any case, thnx for your attention

oh and site automatically adds link to user max whenever max is written, so ignore that :D i tried to correct it and deleted the mentioning code but it just gets added automatically.


That should work
 
Last edited:

Marko

Enthusiast
hmm it does not unfortunatelly

2 queries executed, 1 success, 1 errors, 0 warnings

Query: SET @health = 10, @mana = 10, @minlevel = 90, [MENTION=401]Max[/MENTION]level = 90, @mindmg = 4, [MENTION=401]Max[/MENTION]dmg = 4, @MapID = 967

0 row(s) affected

Execution Time : 0.115 sec
Transfer Time : 0 sec
Total Time : 0.116 sec
--------------------------------------------------

Query: UPDATE creature_template SET HealthModifier = HealthModifier * @health, ManaModifier = ManaModifier * @mana, minlevel = @minleve...

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near [MENTION=401]Max[/MENTION]dmg = maxdmg * [MENTION=401]Max[/MENTION]dmg
WHERE entry IN (SELECT id FROM creatures WHERE map = ' at line 2

Execution Time : 0 sec
Transfer Time : 0 sec
Total Time : 0.117 sec


i remember when last time u added this code for min and max dmg it worked, before the forum got updated and data lost.
 

Tok124

Respected Member
hmm it does not unfortunatelly

2 queries executed, 1 success, 1 errors, 0 warnings

Query: SET @health = 10, @mana = 10, @minlevel = 90, [MENTION=401]Max[/MENTION]level = 90, @mindmg = 4, [MENTION=401]Max[/MENTION]dmg = 4, @MapID = 967

0 row(s) affected

Execution Time : 0.115 sec
Transfer Time : 0 sec
Total Time : 0.116 sec
--------------------------------------------------

Query: UPDATE creature_template SET HealthModifier = HealthModifier * @health, ManaModifier = ManaModifier * @mana, minlevel = @minleve...

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near [MENTION=401]Max[/MENTION]dmg = maxdmg * [MENTION=401]Max[/MENTION]dmg
WHERE entry IN (SELECT id FROM creatures WHERE map = ' at line 2

Execution Time : 0 sec
Transfer Time : 0 sec
Total Time : 0.117 sec


i remember when last time u added this code for min and max dmg it worked, before the forum got updated and data lost.
Sorry mate, I made a mistake. Try this
 

Tok124

Respected Member
now says Error Code: 1146
Table 'world.creatures' doesn't exist

strange

Sorry mate, Just change this
WHERE entry IN (SELECT id FROM creatures WHERE map = @MapID);
to this
WHERE entry IN (SELECT id FROM creature WHERE map = @MapID);
 

Marko

Enthusiast
Hehe thanks, if i had more free time would have noticed the spelling error. :)

after a few corrections more i got the code to finally work like this:

SET
@health = 1,
@mana = 1,
@minlevel = 90, [MENTION=401]Max[/MENTION]level = 90,
@mindmg = 4, [MENTION=401]Max[/MENTION]dmg = 6,
@MapID = 861;

UPDATE creature_template
SET Health_mod = health_mod * @Health, minlevel = @minlevel, maxlevel = [MENTION=401]Max[/MENTION]level, Mana_mod = Mana_mod * @Mana, minlevel = @minlevel, maxlevel = [MENTION=401]Max[/MENTION]level, mindmg = mindmg * @mindmg, maxdmg = maxdmg * [MENTION=401]Max[/MENTION]dmg
WHERE entry IN (SELECT id FROM creature WHERE map = @MapID);

(this edits molten front in firelands) :)
Now finally code is complete again :)
 

qtt

Enthusiast
^ you have to edit query so it fits in the correct column then, just edit the name..

Side note.. Thank you for releasing, this saves a ton of time =]
 
Top