NWScript:
void CreateMe( location lLocation )
{
CreateObject( OBJECT_TYPE_PLACEABLE, "chest005", lLocation, TRUE );
}
void main()
{
float fSeconds = 4.0;
location lLocation = GetLocation( OBJECT_SELF );
AssignCommand( GetArea( OBJECT_SELF ), DelayCommand (fSeconds, CreateMe( lLocation ) ) );
int nDiceRoll = d4(1);
if(nDiceRoll == 1)
{
CreateItemOnObject("item1", OBJECT_SELF, 1);
}
else if(nDiceRoll == 2)
{
CreateItemOnObject("item2", OBJECT_SELF, 1);
}
else if(nDiceRoll == 3)
{
CreateItemOnObject("item3", OBJECT_SELF, 1);
}
else if(nDiceRoll == 4)
{
CreateItemOnObject("item4", OBJECT_SELF, 1);
}
}