#include "inc_gen_loot"
void main()
    {
    if (GetLocalInt(OBJECT_SELF,"DO_ONCE"))
        return;
    object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC);
    int iCoins,iGoods,iItems;
    if (d100() <= CHEST_COIN)
        iCoins = 1;
    if (d100() <= CHEST_GOODS)
        iGoods = 1;
    if (d100() <= CHEST_ITEMS)
        iItems = 1;
    if (GENERATE_COIN && !iCoins && !iGoods && !iItems)
        iCoins = 1;
    GenerateLoot(OBJECT_SELF,PartyLevel(oPC),iCoins,iGoods,iItems);
    SetLocalInt(OBJECT_SELF,"DO_ONCE",TRUE);
    }
