/* This is a script that someone requested in the script requests thread. Gibber, here's your script! Enjoy!

-Jaden

SCRIPT: Customizable Loot Drop Table

WHAT IT DOES: Picks 1 of 3 selected items by random d100 roll to drop from a mob once it has been killed.

OTHER NOTES: Notes listed in script. Read them! "gnadesh" is a custom tag for the person I scripted this for and should be changed and/or disregarded by others. */




/*******************************
Script: Customizable Loot Drop Table
Created By: Jaden Wagener
Created On: 09/08/02
Description: Loot table that causes a mob to drop loot based on random
selection. Currently enables up to 3 different drops per mob.
Instructions: Place in mob's OnDeath slot.
***NOTES***
--xLoot1, xLoot2 and xLoot3 MUST be the strref of the item.
--xLootChance1 and xLootChance2 MUST be the upper limit on a d100 roll.
(i.e. if you want xLoot1 to drop on a roll of 1-40, set xLootChance at 40)
--To add another mob, create another IF loop at the end of the loop(s) in the
main script. Set the IF test to the TAG of the mob you wish to add. Then add
the RandomLoot line.
--RandomLoot() requires 5 pieces of information: The first 3 are the strdef's
of the items to be dropped, the last 2 are the upper range roll chance of the
first 2 items. Example:
RandomLoot("nw_it_gem001","nw_it_gem002","nw_it_gem003",50,85);
This is how it translates:
"nw_it_gem001" = Greenstone (Roll of 1-50)
"nw_it_gem002" = Fire Agate (Roll of 51-85)
"nw_it_gem003" = Amethyst (Roll of 86-100)
--If you want nothing to spawn for a certain roll percentage, just use ""
*******************************/
//Declare Variables
int xLootChance1, xLootChance2, xRoll;
string xLoot1, xLoot2, xLoot3;
string xMobTag = GetTag(OBJECT_SELF);
//Declare Custom Script
void RandomLoot(string xLoot1, string xLoot2, string xLoot3, int xLootChance1, int xLootChance2);
//RandomLoot creates the loot based on specified chance
void RandomLoot(string xLoot1, string xLoot2, string xLoot3, int xLootChance1, int xLootChance2)
{
xRoll = Random(100) + 1;
if (xRoll <= xLootChance1)
CreateItemOnObject(xLoot1,OBJECT_SELF,1);
else if ((xRoll > xLootChance1) && (xRoll <= xLootChance2))
CreateItemOnObject(xLoot2,OBJECT_SELF,1);
else if (xRoll > xLootChance2)
CreateItemOnObject(xLoot3,OBJECT_SELF,1);
}
void main()
{
if (xMobTag == "gnadesh")
RandomLoot("nw_it_mring001","nw_it_mring011","",20,50);
}