Author Sticky: Post Working Scripts Here
lake23 Posted: Monday, 08 July 02:28AM
This is a combination of scripts i found on this board.. i felt i should contribute something at least:)
What it does? It rolls up random loot that you select...and respawns the chest to whatever time you wish
NWScript:
void CreateMe( location lLocation )

{

    CreateObject( OBJECT_TYPE_PLACEABLE, "chest005", lLocation, TRUE );

}

void main()

{

    float fSeconds = 4.0; //box respawn time

    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);

    }

}



good luck