226 lines
6.7 KiB
Plaintext
226 lines
6.7 KiB
Plaintext
void EmptyChest(object oTarget)
|
|
{
|
|
object oItem = GetFirstItemInInventory(oTarget);
|
|
do{
|
|
SetPlotFlag(oItem, FALSE);
|
|
DestroyObject(oItem, 0.0);
|
|
}
|
|
while((oItem = GetNextItemInInventory(oTarget)) != OBJECT_INVALID);
|
|
}
|
|
void CreateObjects(object oSelf)
|
|
{
|
|
string sItem;
|
|
int nRandom;
|
|
int nNumOfItems = 0;
|
|
int nCounter = 1;
|
|
int nPercentage = Random(100) + 1;
|
|
/*
|
|
Percentage rolls moved here for easy editing
|
|
If a 25 or lower is rolled, 3 items are spawned (25%)
|
|
If a 50 or lower is rolled, 2 items are spawned (50%)
|
|
Otherwise, 1 item is spawned
|
|
*/
|
|
if (nPercentage <= 20)
|
|
nNumOfItems = 5;
|
|
else if (nPercentage <= 35)
|
|
nNumOfItems = 4;
|
|
else if (nPercentage <= 60)
|
|
nNumOfItems = 3;
|
|
else if (nPercentage <= 90)
|
|
nNumOfItems = 2;
|
|
else if (nPercentage <= 100)
|
|
nNumOfItems = 1;
|
|
while (nCounter <= nNumOfItems)
|
|
{
|
|
nRandom = Random(120) + 1;// Edit the number in () to how many cases. Leave +1
|
|
switch (nRandom)
|
|
{ // Put a case and the tag of each item to be spawned.
|
|
case 1: sItem = "goldseal"; break;
|
|
case 2: sItem = "it_mpotion008"; break;
|
|
case 3: sItem = "it_mpotion011"; break;
|
|
case 4: sItem = "it_mpotion024"; break;
|
|
case 5: sItem = "it_mpotion020"; break;
|
|
case 6: sItem = "it_mpotion008"; break;
|
|
case 7: sItem = "it_mpotion011"; break;
|
|
case 8: sItem = "goldseal"; break;
|
|
case 9: sItem = "kdpotion001"; break;
|
|
case 10: sItem = "goldseal"; break;
|
|
case 11: sItem = "it_mpotion008"; break;
|
|
case 12: sItem = "it_mpotion011"; break;
|
|
case 13: sItem = "it_mpotion024"; break;
|
|
case 14: sItem = "it_mpotion020"; break;
|
|
case 15: sItem = "it_mpotion008"; break;
|
|
case 16: sItem = "it_mpotion011"; break;
|
|
case 17: sItem = "goldseal"; break;
|
|
case 18: sItem = "shieldpotion"; break;
|
|
case 19: sItem = "kdpotion001"; break;
|
|
case 20: sItem = "keheal1"; break;
|
|
case 21: sItem = "it_mpotion008"; break;
|
|
case 22: sItem = "it_mpotion011"; break;
|
|
case 23: sItem = "it_mpotion024"; break;
|
|
case 24: sItem = "it_mpotion020"; break;
|
|
case 25: sItem = "it_mpotion008"; break;
|
|
case 26: sItem = "it_mpotion011"; break;
|
|
case 27: sItem = "goldseal"; break;
|
|
case 28: sItem = "shieldpotion"; break;
|
|
case 29: sItem = "kdpotion001"; break;
|
|
case 30: sItem = "goldseal"; break;
|
|
case 31: sItem = "goldseal"; break;
|
|
case 32: sItem = "it_mpotion008"; break;
|
|
case 33: sItem = "it_mpotion011"; break;
|
|
case 34: sItem = "it_mpotion024"; break;
|
|
case 35: sItem = "it_mpotion020"; break;
|
|
case 36: sItem = "it_mpotion008"; break;
|
|
case 37: sItem = "it_mpotion011"; break;
|
|
case 38: sItem = "goldseal"; break;
|
|
case 39: sItem = "kdpotion001"; break;
|
|
case 40: sItem = "goldseal"; break;
|
|
case 41: sItem = "it_mpotion008"; break;
|
|
case 42: sItem = "it_mpotion011"; break;
|
|
case 43: sItem = "it_mpotion024"; break;
|
|
case 44: sItem = "it_mpotion020"; break;
|
|
case 45: sItem = "it_mpotion008"; break;
|
|
case 46: sItem = "it_mpotion011"; break;
|
|
case 47: sItem = "goldseal"; break;
|
|
case 48: sItem = "shieldpotion"; break;
|
|
case 49: sItem = "kdpotion001"; break;
|
|
case 50: sItem = "keheal1"; break;
|
|
case 51: sItem = "it_mpotion008"; break;
|
|
case 52: sItem = "it_mpotion011"; break;
|
|
case 53: sItem = "it_mpotion024"; break;
|
|
case 54: sItem = "it_mpotion020"; break;
|
|
case 55: sItem = "it_mpotion008"; break;
|
|
case 56: sItem = "it_mpotion011"; break;
|
|
case 57: sItem = "goldseal"; break;
|
|
case 58: sItem = "shieldpotion"; break;
|
|
case 59: sItem = "kdpotion001"; break;
|
|
case 60: sItem = "goldseal"; break;
|
|
case 61: sItem = "goldseal"; break;
|
|
case 62: sItem = "it_mpotion008"; break;
|
|
case 63: sItem = "it_mpotion011"; break;
|
|
case 64: sItem = "it_mpotion024"; break;
|
|
case 65: sItem = "it_mpotion020"; break;
|
|
case 66: sItem = "it_mpotion008"; break;
|
|
case 67: sItem = "it_mpotion011"; break;
|
|
case 68: sItem = "goldseal"; break;
|
|
case 69: sItem = "kdpotion001"; break;
|
|
case 70: sItem = "goldseal"; break;
|
|
case 71: sItem = "it_mpotion008"; break;
|
|
case 72: sItem = "it_mpotion011"; break;
|
|
case 73: sItem = "it_mpotion024"; break;
|
|
case 74: sItem = "it_mpotion020"; break;
|
|
case 75: sItem = "it_mpotion008"; break;
|
|
case 76: sItem = "it_mpotion011"; break;
|
|
case 77: sItem = "goldseal"; break;
|
|
case 78: sItem = "shieldpotion"; break;
|
|
case 79: sItem = "kdpotion001"; break;
|
|
case 80: sItem = "keheal1"; break;
|
|
case 81: sItem = "it_mpotion008"; break;
|
|
case 82: sItem = "it_mpotion011"; break;
|
|
case 83: sItem = "it_mpotion024"; break;
|
|
case 84: sItem = "it_mpotion020"; break;
|
|
case 85: sItem = "it_mpotion008"; break;
|
|
case 86: sItem = "it_mpotion011"; break;
|
|
case 87: sItem = "goldseal"; break;
|
|
case 88: sItem = "shieldpotion"; break;
|
|
case 89: sItem = "kdpotion001"; break;
|
|
case 90: sItem = "goldseal"; break;
|
|
case 91: sItem = "goldseal"; break;
|
|
case 92: sItem = "it_mpotion008"; break;
|
|
case 93: sItem = "it_mpotion011"; break;
|
|
case 94: sItem = "it_mpotion024"; break;
|
|
case 95: sItem = "it_mpotion020"; break;
|
|
case 96: sItem = "it_mpotion008"; break;
|
|
case 97: sItem = "it_mpotion011"; break;
|
|
case 98: sItem = "goldseal"; break;
|
|
case 99: sItem = "kdpotion001"; break;
|
|
case 100: sItem = "goldseal"; break;
|
|
case 101: sItem = "it_mpotion008"; break;
|
|
case 102: sItem = "it_mpotion011"; break;
|
|
case 103: sItem = "it_mpotion024"; break;
|
|
case 104: sItem = "it_mpotion020"; break;
|
|
case 105: sItem = "it_mpotion008"; break;
|
|
case 106: sItem = "it_mpotion011"; break;
|
|
case 107: sItem = "goldseal"; break;
|
|
case 108: sItem = "shieldpotion"; break;
|
|
case 109: sItem = "kdpotion001"; break;
|
|
case 110: sItem = "keheal1"; break;
|
|
case 111: sItem = "it_mpotion008"; break;
|
|
case 112: sItem = "it_mpotion011"; break;
|
|
case 113: sItem = "it_mpotion024"; break;
|
|
case 114: sItem = "it_mpotion020"; break;
|
|
case 115: sItem = "it_mpotion008"; break;
|
|
case 116: sItem = "it_mpotion011"; break;
|
|
case 117: sItem = "goldseal"; break;
|
|
case 118: sItem = "shieldpotion"; break;
|
|
case 119: sItem = "kdpotion001"; break;
|
|
case 120: sItem = "goldseal"; break;
|
|
|
|
|
|
|
|
default: break;
|
|
}
|
|
CreateItemOnObject(sItem, oSelf, 1);//Creates the item(s) into chest.
|
|
nCounter++;
|
|
}
|
|
}
|
|
void main()
|
|
{
|
|
object oChest = OBJECT_SELF;
|
|
object oItem = GetFirstItemInInventory(oChest);
|
|
float fDelay = 1800.0f;//Delay in seconds to reloot the chest.
|
|
if (GetLocalInt(oChest,"doonce") == 0)
|
|
{
|
|
EmptyChest(oChest);//Empties the chest from any left overs
|
|
CreateObjects(oChest);
|
|
SetLocalInt(oChest,"doonce",1);
|
|
DelayCommand(fDelay, SetLocalInt(oChest,"doonce",0));
|
|
|
|
// *** % chance of getting art loot *** //
|
|
object oPC = GetLastOpenedBy();
|
|
|
|
if (!GetIsPC(oPC)) return;
|
|
|
|
if (d100()<=10)
|
|
{
|
|
CreateItemOnObject("art", oPC);
|
|
|
|
}
|
|
// *** % chance end *** //
|
|
|
|
// *** % chance of getting art loot *** //
|
|
|
|
if (d100()<=10)
|
|
{
|
|
CreateItemOnObject("art", oPC);
|
|
|
|
}
|
|
// *** % chance end *** //
|
|
|
|
// *** % chance of getting art loot *** //
|
|
|
|
if (d100()<=10)
|
|
{
|
|
CreateItemOnObject("art", oPC);
|
|
|
|
}
|
|
// *** % chance end *** //
|
|
|
|
|
|
}
|
|
else if (oItem == OBJECT_INVALID)
|
|
{
|
|
SendMessageToPC(GetLastOpenedBy() , "This chest has been emptied recently." );
|
|
}
|
|
else
|
|
{
|
|
SendMessageToPC(GetLastOpenedBy() , "This chest has been used recently." );
|
|
}
|
|
|
|
object oPC = GetLastOpenedBy();
|
|
|
|
|
|
|
|
}
|
|
|