114 lines
3.0 KiB
Plaintext
114 lines
3.0 KiB
Plaintext
/*Simple random loot system by Grani:
|
|
this script generates up to 10 loot items on the dead enemy,
|
|
as specified with variables of the creature it is attached to.
|
|
|
|
The variables should be set as follows:
|
|
loot_XX - an integer, write in it the percent chance of drop (value from 1 to 99)
|
|
resref_XX - a string, write in it the resref of the loot item
|
|
|
|
The script can also generate one stack of stackable items. The variables for this are:
|
|
loot_stack - an integer, the percent chance of drop
|
|
resref_stack - a string, the resref of the loot item
|
|
amount_stack - an integer, the amount of items in a dropped stack
|
|
|
|
Note: in case of standard palette loot items, use the item's tag instead of resref!*/
|
|
|
|
void main()
|
|
{
|
|
ExecuteScript("nw_c2_default7", OBJECT_SELF);
|
|
|
|
|
|
//Get resrefs of loot and chances of drop specified in variables
|
|
int nL1 = GetLocalInt(OBJECT_SELF, "loot_01");
|
|
string sL1 = GetLocalString(OBJECT_SELF,"resref_01");
|
|
|
|
int nL2 = GetLocalInt(OBJECT_SELF, "loot_02");
|
|
string sL2 = GetLocalString(OBJECT_SELF,"resref_02");
|
|
|
|
int nL3 = GetLocalInt(OBJECT_SELF, "loot_03");
|
|
string sL3 = GetLocalString(OBJECT_SELF,"resref_03");
|
|
|
|
int nL4 = GetLocalInt(OBJECT_SELF, "loot_04");
|
|
string sL4 = GetLocalString(OBJECT_SELF,"resref_04");
|
|
|
|
int nL5 = GetLocalInt(OBJECT_SELF, "loot_05");
|
|
string sL5 = GetLocalString(OBJECT_SELF,"resref_05");
|
|
|
|
int nL6 = GetLocalInt(OBJECT_SELF, "loot_06");
|
|
string sL6 = GetLocalString(OBJECT_SELF,"resref_06");
|
|
|
|
int nL7 = GetLocalInt(OBJECT_SELF, "loot_07");
|
|
string sL7 = GetLocalString(OBJECT_SELF,"resref_07");
|
|
|
|
int nL8 = GetLocalInt(OBJECT_SELF, "loot_08");
|
|
string sL8 = GetLocalString(OBJECT_SELF,"resref_08");
|
|
|
|
int nL9 = GetLocalInt(OBJECT_SELF, "loot_09");
|
|
string sL9 = GetLocalString(OBJECT_SELF,"resref_09");
|
|
|
|
int nL10 = GetLocalInt(OBJECT_SELF, "loot_10");
|
|
string sL10 = GetLocalString(OBJECT_SELF,"resref_10");
|
|
|
|
int nStack = GetLocalInt(OBJECT_SELF, "loot_stack");
|
|
string sStack = GetLocalString(OBJECT_SELF,"resref_stack");
|
|
int nNumber = GetLocalInt(OBJECT_SELF, "amount_stack");
|
|
|
|
|
|
//generate the loot; or not
|
|
if (d100()<=nL1)
|
|
{
|
|
CreateItemOnObject(sL1, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL2)
|
|
{
|
|
CreateItemOnObject(sL2, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL3)
|
|
{
|
|
CreateItemOnObject(sL3, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL4)
|
|
{
|
|
CreateItemOnObject(sL4, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL5)
|
|
{
|
|
CreateItemOnObject(sL5, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL6)
|
|
{
|
|
CreateItemOnObject(sL6, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL7)
|
|
{
|
|
CreateItemOnObject(sL7, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL8)
|
|
{
|
|
CreateItemOnObject(sL8, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL9)
|
|
{
|
|
CreateItemOnObject(sL9, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nL10)
|
|
{
|
|
CreateItemOnObject(sL10, OBJECT_SELF);
|
|
}
|
|
|
|
if (d100()<=nStack)
|
|
{
|
|
CreateItemOnObject(sStack, OBJECT_SELF, nNumber);
|
|
}
|
|
|
|
}
|