[MOD]Set New Char Additional Attribute For Random

Place for sharing your game modifications for Life is Feudal: Your Own

Dtk001
True Believer
 
Posts: 4
Joined: 23 May 2016, 15:11

[MOD]Set New Char Additional Attribute For Random

Post by Dtk001 » 25 May 2016, 04:18

um, at first, i'm sorry for my english...

this mod can set new character additional attribute for random, you can add the following SQL statements to the database and run it

Code: Select all
DELIMITER //
CREATE DEFINER=`root`@`localhost` TRIGGER `A_TRI_attribute_after_insert` BEFORE INSERT ON `character` FOR EACH ROW BEGIN
   SET @RD = FLOOR(RAND()*8) + 3;
   SET NEW.Luck = @RD * 1000000;
   
   SET @FP = 50;
   SET @BP = 10;
   SET @NP = @FP;
   
   SET @RD = FLOOR((RAND()*(@FP-@BP+1))) + @BP;
   SET @NP = @NP - @RD;
   
   IF NEW.RaceID = 1 THEN
      SET NEW.Willpower = NEW.Willpower + @RD * 1000000;
   END IF;
   
   IF NEW.RaceID = 2 THEN
      SET NEW.Strength = NEW.Strength + @RD * 1000000;
   END IF;
   
   IF NEW.RaceID = 3 THEN
      SET NEW.Intellect = NEW.Agility + @RD * 1000000;
   END IF;
   
   WHILE @NP > 0 DO
      SET @T = FLOOR(RAND()*5 + 1);
      SET @RD = FLOOR(RAND()*(@NP+1));
      SET @NP = @NP - @RD;
      IF @T = 1 THEN
         SET NEW.Strength = NEW.Strength + @RD * 1000000;
         END IF;
      IF @T = 2 THEN
         SET NEW.Agility = NEW.Agility + @RD * 1000000;
         END IF;
      IF @T = 3 THEN
         SET NEW.Constitution = NEW.Constitution + @RD * 1000000;
         END IF;
      IF @T = 4 THEN
         SET NEW.Intellect = NEW.Intellect + @RD * 1000000;
         END IF;
      IF @T =5 THEN
         SET NEW.Willpower = NEW.Willpower + @RD * 1000000;
         END IF;
   END WHILE;
END //


@FP is total additional attribute, you can change it to 0~?
@BP is the minimum value added to the primary attribute, My setting is faceID 1 to increase willpower, faceID 2 to increase strength, faceID 3 to increase intellect, you can change it too

For example, if you want to assign all the Attribute to the main Attribute you set, set @BP = @FP

now eveything is ok, create character and test it~ :Yahoo!:

Return to Game mods