Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Changing max stats

Initiate Mage
Joined
May 21, 2022
Messages
2
Reaction score
0
Hello, does anyone know how to limit max stats points per class?

Example, BK have 32767 each attributes, strength, agility, vitality and energy, if we combine it all, it will sum as 131,068.
I want to limit it as 80,000 only not 131,068.

Same like this script but this is not working.

Code:
UPDATE Character
SET LevelUpPoint=0
Where Strenght+Dexterity+Vitality+Energy= 80000
and class = 0

Thank in advance.
 
Initiate Mage
Joined
Sep 8, 2011
Messages
67
Reaction score
251
Hi, I dont normally do Mu but, Ideally, you'd want to limit it through source probs. Not sure how Mu works, but generally the data just gets thrown in to the db while a player is already active and the data doesn't get repulled, so data may end up mismatching from client/server, and db.

The issue with the sql script, it doesn't check >= 80000, so LevelUpPoint won't get set to 0.
 
C++ Developer
Joined
Oct 8, 2006
Messages
643
Reaction score
221
I think you can make a SQL Trigger in your SQL database to be triggered when a special event is occurring or if you have access to the DataServer source code, you can do the UPDATE when the level up event is happening. This way you don't need to always execute the UPDATE query which you are trying to use. Search for SQL Trigger syntax and try to understand how to create one for your database.

It can be something like
Code:
[COLOR=#000000][FONT='inherit'][FONT=inherit]DROP [/FONT][FONT=inherit]TRIGGER [/FONT][FONT=inherit]IF [/FONT][FONT=inherit]EXISTS[/FONT][FONT=inherit] check_max_stats[/FONT][FONT=inherit];[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]GO[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]CREATE [/FONT][FONT=inherit]TRIGGER[/FONT][FONT=inherit] check_max_stats [/FONT][FONT=inherit]ON[/FONT][FONT=inherit] [MuOnline].Characters AFTER UPDATE[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]AS [/FONT][FONT=inherit]BEGIN[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]DECLARE [/FONT][FONT=inherit]@ AccID [/FONT][FONT=inherit]INT[/FONT][FONT=inherit];[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT=inherit]DECLARE @ Strength [/FONT]INT;
    [FONT=inherit]DECLARE @ Dexterity[/FONT] INT;
    DECLARE @ Vitality INT;
    DECLARE @ Energy INT;
    DECLARE @ Leadership INT;

    DECLARE @ maxstatPoints INT;
    SET @ maxstatPoints = 80000;

[/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]SELECT [/FONT][FONT=inherit]@AccID[/FONT][FONT=inherit]=[/FONT][FONT=inherit] updt.AccountID [/FONT][FONT=inherit]FROM UPDATE updt;[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]SELECT [/FONT][/FONT][/COLOR]@ Strength[COLOR=#000000][FONT='inherit'][FONT=inherit] = updt.Strength FROM UPDATE updt;
    SELECT [/FONT][/FONT][/COLOR]@ Dexterity[FONT=inherit][COLOR=#000000] = updt.Dexterity FROM UPDATE updt;[/COLOR]
[COLOR=#000000]    SELECT [/COLOR]@ Vitality[/FONT][FONT=inherit][COLOR=#000000] = updt.Vitality FROM UPDATE updt;[/COLOR]
[COLOR=#000000]    SELECT [/COLOR]@ Energy[/FONT][FONT=inherit][COLOR=#000000] = updt.Energy FROM UPDATE updt;[/COLOR]
[COLOR=#000000]    SELECT [/COLOR]@ Leadership [/FONT][COLOR=#000000][FONT='inherit'][FONT=inherit]= updt.Leadership FROM UPDATE updt;
    [/FONT][/FONT][/COLOR]
[FONT=inherit][COLOR=#000000]IF ( [/COLOR]@ Strength [/FONT][FONT=inherit][COLOR=#000000]+ [/COLOR]@ Dexterity[/FONT][FONT=inherit][COLOR=#000000] + [/COLOR]@ Vitality[/FONT][FONT=inherit][COLOR=#000000] + [/COLOR]@ Energy[/FONT][FONT=inherit][COLOR=#000000] + [/COLOR]@ Leadership[/FONT][COLOR=#000000][FONT='inherit'][FONT=inherit]) > @ maxstatPoints[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]        //DO SOMETHING WHEN SUM IS HIGHER THAN MAXSTATPOINTS
        [/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]ELSE[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]THROW[/FONT][FONT=inherit]51000[/FONT][FONT=inherit],[/FONT][FONT=inherit]'Error: Can not update character'[/FONT][FONT=inherit],[/FONT][FONT=inherit]1[/FONT][FONT=inherit];[/FONT][/FONT][/COLOR]
[COLOR=#000000][FONT='inherit'][FONT=inherit]END[/FONT][FONT=inherit];

[/FONT][/FONT][/COLOR]

Sorry for the format. The forum doesn't allow me to use some specific annotations under CODE tag. Delete the space between @ and variable name.
Most importantly is to get the idea from it.
 
Last edited:
Initiate Mage
Joined
Jul 13, 2019
Messages
60
Reaction score
16
Hello, does anyone know how to limit max stats points per class?

Example, BK have 32767 each attributes, strength, agility, vitality and energy, if we combine it all, it will sum as 131,068.
I want to limit it as 80,000 only not 131,068.

Same like this script but this is not working.

Code:
UPDATE Character
SET LevelUpPoint=0
Where Strenght+Dexterity+Vitality+Energy= 80000
and class = 0

Thank in advance.

if you are using a muemu server, you can limit the points in the server's configuration, every time the character adds more than the allowed amount, the server will refuse and return the added points.


swBPNe8.png
ByDfRHEAgLNzAAAAAElFTkSuQmCC
 
C++ Developer
Joined
Oct 8, 2006
Messages
643
Reaction score
221
It's okay with the config as you've mentioned but only if you want to limit the max number per attribute. He wants a max stats value for overall stats so when he sums up every attribute it won't be greater than the value he needs.

E.g. If you want to have the attribute value sum = 80000, in the config you need 20000 for each. But if you want 40000 str and 20000 agi and 20000 ene? The sum is 80000, but the config won't allow to have a value greater than 20000 for str.
 
Initiate Mage
Joined
Jul 13, 2019
Messages
60
Reaction score
16
with customizations, I think should be made from source, you can do more things
 
Back
Top