I found a better way to get the same job done. Here it is:::
NWScript:
//

//PLACE THESE IN YOUR ONDEATH OR ONSPAWN SCRIPT

//

//--------Example Script - Puts High Treasure in a Box After Death Or Spawn, Based on Player Info

{

#include "NW_o2_CONINCLUDE"

object oContainer = GetObjectByTag("Your Container's Tag Here");

object oPlayer = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);

GenerateHighTreasure(oPlayer, oContainer);

}

//

//--------Example Script - Puts Medium Treasure in a Box After Death Or Spawn, Based on Player Info

{

#include "NW_o2_CONINCLUDE"

object oContainer = GetObjectByTag("Your Container's Tag Here");

object oPlayer = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);

GenerateMediumTreasure(oPlayer, oContainer);

}

//

//--------Example Scrip - Puts Low Treasure in a Box After Death Or Spawn, Based on Player Info

{

#include "NW_o2_CONINCLUDE"

object oContainer = GetObjectByTag("Your Container's Tag Here");

object oPlayer = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);

GenerateLowTreasure(oPlayer, oContainer);

}

//



Both work but the second works a little better.