/*--------------------------------------------------------

Script Name: spawn_gem
----------------------------------------------------------
Created By: Genisys(Guile)
Created On: 4/17/09
----------------------------------------------------------

This goes in the OnOpen Event ONLY of a chest or placeable object

----------------------------------------------------------*/


//We only run this script one time for each PC for Each Chest!
void main()
{
 object oPC = GetLastOpenedBy();
 string sName = GetName(oPC);
 int n = GetLocalInt(OBJECT_SELF, "GSC" + sName);

 if(!GetIsPC(oPC))
 return;

 if(n==1)
 {return;}

 else
 {
  SetLocalInt(OBJECT_SELF, "GSC" + sName, 1);

  ExecuteScript("gen_geg_treas", OBJECT_SELF);
 }
}