Code: Select all
//OnOpened event of placeable
void main()
{
float fDelay = 60.0; // << Set respawn delay in seconds
if(GetLocalInt(OBJECT_SELF, "LOOTED")) return;
string sResRef;
switch (Random(4) + 1)// << 1 to 12, also change the number 12 to match the number of cases below
{
case 1: sResRef = "nw_it_mpotion001x10"; break;//<< Resref of Item 1
case 2: sResRef = "nw_it_mpotion020"; break;//<< Resref of Item 2
case 3: sResRef = "cs_it_mpotioncom"; break;//<< Resref of Item 3
case 4: sResRef = "cs_it_mpotionremcrs"; break;//<< Resref of Item 4
}
CreateItemOnObject(sResRef, OBJECT_SELF);
SetLocalInt(OBJECT_SELF, "LOOTED", TRUE);
DelayCommand(fDelay, DeleteLocalInt(OBJECT_SELF, "LOOTED"));
}