Changing max stats

Results 1 to 7 of 7
  1. #1
    Novice ReaperKID is offline
    MemberRank
    May 2022 Join Date
    2Posts

    Changing max stats

    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.


  2. #2
    Novice Fenris is offline
    MemberRank
    Sep 2011 Join Date
    RE:ℓσα∂Location
    69Posts
    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.

  3. #3
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts
    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:
    DROP TRIGGER IF EXISTS check_max_stats;
    GO
    CREATE TRIGGER check_max_stats ON [MuOnline].Characters AFTER UPDATE
    AS BEGIN
    DECLARE @ AccID INT;
    DECLARE @ Strength INT;
        DECLARE @ Dexterity INT;
        DECLARE @ Vitality INT;
        DECLARE @ Energy INT;
        DECLARE @ Leadership INT;
    
        DECLARE @ maxstatPoints INT;
        SET @ maxstatPoints = 80000;
    
    
    SELECT @AccID= updt.AccountID FROM UPDATE updt;
    SELECT @ Strength = updt.Strength FROM UPDATE updt;
        SELECT @ Dexterity = updt.Dexterity FROM UPDATE updt;
        SELECT @ Vitality = updt.Vitality FROM UPDATE updt;
        SELECT @ Energy = updt.Energy FROM UPDATE updt;
        SELECT @ Leadership = updt.Leadership FROM UPDATE updt;
        
    IF ( @ Strength + @ Dexterity + @ Vitality + @ Energy + @ Leadership) > @ maxstatPoints
            //DO SOMETHING WHEN SUM IS HIGHER THAN MAXSTATPOINTS
            
    ELSE
    THROW51000,'Error: Can not update character',1;
    END;
    
    
    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 by zipper20032; 2 Weeks Ago at 05:41 AM.

  4. #4
    Member son1xx2 is offline
    MemberRank
    Jul 2019 Join Date
    50Posts
    Quote Originally Posted by ReaperKID View Post
    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.




  5. #5
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts
    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.

  6. #6
    Member son1xx2 is offline
    MemberRank
    Jul 2019 Join Date
    50Posts
    with customizations, I think should be made from source, you can do more things

  7. #7
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts
    Quote Originally Posted by son1xx2 View Post
    with customizations, I think should be made from source, you can do more things
    That's right. Coding this into the DataServer source code when distributing points into an attribute would do the trick.



Advertisement