Module commit
Module commit.
This commit is contained in:
33
_module/nss/_use_tchest_loot.nss
Normal file
33
_module/nss/_use_tchest_loot.nss
Normal file
@@ -0,0 +1,33 @@
|
||||
void main()
|
||||
{
|
||||
object oSelf = OBJECT_SELF;
|
||||
object oPC = GetLastDisturbed();
|
||||
//SetLocalObject(oPC,"oLastOpened",oSelf); //hook for OnAcquired script for _Store objects
|
||||
|
||||
if (GetInventoryDisturbType()==INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
object oTemp = GetInventoryDisturbItem();
|
||||
CopyItem(oTemp,oPC,TRUE);
|
||||
DestroyObject(oTemp,0.2);
|
||||
SendMessageToPC(oPC,"You cannot place items in the chest!");
|
||||
return;
|
||||
}
|
||||
|
||||
//Debug code
|
||||
//SendMessageToPC(oPC,GetTag(GetInventoryDisturbItem()));
|
||||
|
||||
int iChestLevel = GetLocalInt(oSelf,"iChestLevel");
|
||||
int iChestSpawnChance = (iChestLevel*2)+30;
|
||||
int iMaxMonster = GetLocalInt(oSelf,"iMaxMonster");
|
||||
|
||||
if (iMaxMonster>0)
|
||||
{
|
||||
if (d100(1)< iChestSpawnChance)
|
||||
{
|
||||
iMaxMonster--;
|
||||
SetLocalInt(oSelf,"iMaxMonster",iMaxMonster);
|
||||
SetLocalObject(oSelf,"oDiggingPC",oPC);
|
||||
AssignCommand(oSelf,DelayCommand(0.2,ExecuteScript("_map_chst_spawn2",oSelf)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user