Skip to content

Creature loot exemples

cyberium edited this page Jan 10, 2024 · 2 revisions

Let’s create a temporary creature on vanilla to handle loot for this tutorial.

-- Creature Template

INSERT INTO `creature_template`(`Entry`, `Name`, `SubName`, `MinLevel`, `MaxLevel`, `ModelId1`, `ModelId2`, `ModelId3`, `ModelId4`, `Faction`, `Scale`, `Family`, `CreatureType`, `InhabitType`, `RegenerateStats`, `RacialLeader`, `NpcFlags`, `UnitFlags`, `DynamicFlags`, `ExtraFlags`, `CreatureTypeFlags`, `StaticFlags1`, `StaticFlags2`, `StaticFlags3`, `StaticFlags4`, `SpeedWalk`, `SpeedRun`, `Detection`, `CallForHelp`, `Pursuit`, `Leash`, `Timeout`, `UnitClass`, `Rank`, `HealthMultiplier`, `PowerMultiplier`, `DamageMultiplier`, `DamageVariance`, `ArmorMultiplier`, `ExperienceMultiplier`, `MinLevelHealth`, `MaxLevelHealth`, `MinLevelMana`, `MaxLevelMana`, `MinMeleeDmg`, `MaxMeleeDmg`, `MinRangedDmg`, `MaxRangedDmg`, `Armor`, `MeleeAttackPower`, `RangedAttackPower`, `MeleeBaseAttackTime`, `RangedBaseAttackTime`, `DamageSchool`, `MinLootGold`, `MaxLootGold`, `LootId`, `PickpocketLootId`, `SkinningLootId`, `KillCredit1`, `KillCredit2`, `MechanicImmuneMask`, `SchoolImmuneMask`, `ResistanceHoly`, `ResistanceFire`, `ResistanceNature`, `ResistanceFrost`, `ResistanceShadow`, `ResistanceArcane`, `PetSpellDataId`, `MovementType`, `TrainerType`, `TrainerSpell`, `TrainerClass`, `TrainerRace`, `TrainerTemplateId`, `VendorTemplateId`, `GossipMenuId`, `InteractionPauseTimer`, `CorpseDecay`, `SpellList`, `StringId1`, `StringId2`, `EquipmentTemplateId`, `Civilian`, `AIName`, `ScriptName`) VALUES
(1002958, 'Prairie Wolf', NULL, 5, 6, 1100, 0, 0, 0, 38, 0, 1, 1, 1, 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1.14286, 18, 0, 15000, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 102, 120, 0, 0, 3, 6, 8.624, 11.858, 174, 2, 100, 1500, 2000, 0, 0, 0, 2958, 0, 2958, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5936, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 'EventAI', '');

In this creature template based on an existing creature from vanilla, we modified only the `Entry` and `LootId` to arbitrary values.

Now, let’s add some chance to get Malachite. We will use `groupid` = 0 since there are no more rules for this drop, and it should be treated separately.

-- Malachite

INSERT INTO `creature_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(1002958, 774, 0.66, 0, 1, 1, 0, 'Malachite');

You can add more chances for other items following the same logic. Adding Tigerseye, for example:

-- Tigerseye

INSERT INTO `creature_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(1002958, 818, 0.24, 0, 1, 1, 0, 'Tigerseye');

At this stage, we have a chance to get either nothing, Malachite, Tigerseye, or both Malachite and Tigerseye.

Now, let’s add a chance to get some patterns. We want only one pattern from a pattern list. We’ll create a list in `reference_loot_template`:

-- Patterns

INSERT INTO `reference_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(1002958, 2406, 0, 1, 1, 1, 0, 'Pattern: Fine Leather Boots');

INSERT INTO `reference_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(1002958, 2407, 0, 1, 1, 1, 0, 'Pattern: White Leather Jerkin');

Now, link this list to the creature:

INSERT INTO `creature_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(1002958, 0, 0.3, 0, -1002958, 1, 0, 'Patterns');

This means each drop has a 0.3% chance to evaluate the items list in `1002958` without any conditions.

Next, let’s consider adding green and blue items with different chances:

-- Greens, Blue, and Epic

INSERT INTO `creature_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(1002958, 0, 70, 1, -2001001, 2, 0, 'Greens'),
(1002958, 5426, 29.9, 1, 1, 1, 0, 'Blue'),
(1002958, 0, 0.1, 1, -4001001, 1, 0, 'Epic');

This means there’s a 70% chance to get 2 green items, a 29.9% chance to get a blue item, and a 0.1% chance to get an epic item.

Finally, add another item shared between many creatures using a reference list:

-- Quest start items

INSERT INTO `reference_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(5001001, 4851, 1, 1, 1, 1, 0, 'Dirt-stained Map'),
(5001001, 4881, 1, 1, 1, 1, 0, 'Aged Envelope');

This will give 1% chance to get dropped for both item in that list.
The result may be then either no item or Dirt-stained Map or Aged Envelope.

Now, link this list to the creature:

INSERT INTO `creature_loot_template`(`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`, `comments`) VALUES
(1002958, 0, 100, 0, -5001001, 1, 0, 'Quest start items');

This gives a 100% chance to trigger the referenced list `-5001001` each time the creature drops loot.
But ofc in that list there is other rules that will be used to determine what items will be dropped.

Clone this wiki locally