Advertisement
Rochet2

Health/armor/mana setter Trinitycore

Sep 6th, 2012
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.69 KB | None | 0 0
  1. -- Instructions:
  2. -- Set the NPC Entry and stats you want it to have below.
  3. SET
  4. @NPC_ENTRY := 190020, -- This is your NPC's Entry
  5. @NPC_HEALTH := 1, -- This is the health value you want your NPC to have.
  6. @NPC_MANA := 0, -- This is the mana value you want your NPC to have.
  7. @NPC_ARMOR := 0; -- This is the armor value you want your NPC to have.
  8.  
  9. -- DO NOT CHANGE ANYTHING BELOW, UNLESS YOU KNOW WHAT YOU ARE DOING.
  10. -- Getting NPC datas:
  11. SET
  12. @NPC_CLASS := (SELECT `unit_class` FROM creature_template WHERE Entry = @NPC_ENTRY),
  13. @NPC_LEVEL := ROUND(((SELECT `minlevel` FROM creature_template WHERE Entry = @NPC_ENTRY)+(SELECT `maxlevel` FROM creature_template WHERE Entry = @NPC_ENTRY))/2, 0),
  14. @EXP := (SELECT `exp` FROM creature_template WHERE Entry = @NPC_ENTRY);
  15.  
  16. -- Getting base HP from a HP column defined by exp.
  17. SET
  18. @GET_HP_COL :=
  19. (SELECT CASE @EXP
  20.     WHEN 0 THEN (SELECT basehp0 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS)
  21.     WHEN 1 THEN (SELECT basehp1 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS)
  22.     WHEN 2 THEN (SELECT basehp2 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS)
  23. END),
  24. -- Getting base mana
  25. @GET_MA_COL := (SELECT basemana FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS),
  26. -- Getting base armor
  27. @GET_AR_COL := (SELECT basearmor FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS);
  28.  
  29.  
  30. -- Running the update with all the data collected:
  31. UPDATE creature_template SET Health_mod = (@NPC_HEALTH/@GET_HP_COL), Mana_mod = (@NPC_MANA/@GET_MA_COL), Armor_mod = (@NPC_ARMOR/@GET_AR_COL) WHERE Entry = @NPC_ENTRY;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement