Files
HeroesStone_PRC8/_module/nss/oner_o2_classmed.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

53 lines
1.1 KiB
Plaintext

// Each player can loot containers that have this
// script in its OnOpen event.
// Set the float fDelay on the object to customize
// the number of seconds to wait.
// Oner the Wise otwise@gmail.com
// This generates medium treasures.
void Empty_Container(object oContainer )
{
object oItem = GetFirstItemInInventory( oContainer );
while ( GetIsObjectValid( oItem ))
{
DestroyObject( oItem );
oItem = GetNextItemInInventory( oContainer );
}
}
#include "NW_O2_CONINCLUDE"
void main()
{
float fDelay = GetLocalFloat(OBJECT_SELF, "fDelay"); // seconds to wait on respawn
// A default delay.
if (fDelay == 0.0)
fDelay = 600.0;
object oLastOpener = GetLastOpener();
// This is set in the OnEnter for the module.
string sID = GetLocalString(oLastOpener, "player_id");
if (GetLocalInt(OBJECT_SELF, sID) != 0)
{
return;
}
Empty_Container(OBJECT_SELF);
GenerateMediumTreasure(oLastOpener, OBJECT_SELF);
SetLocalInt(OBJECT_SELF, sID, 1);
ShoutDisturbed();
DelayCommand(fDelay, SetLocalInt(OBJECT_SELF,sID, 0));
}