Author: Darkvenge
Author Website: n/a
Script Name: Open Coffin / Spawn Vampire
Description: A PC opens a coffin and out pops a vampire. This will only happen once so PC's don't continuously spawn vampires as they open/damage the coffin.
Instructions on Use: Put script in the OnDamaged and OnOpen events of a coffin.  Also, make sure to use the blueprint res/ref of the creature you wish to spawn.

NOTE:  Some people are successful by using the creature TAG and not blueprint res/ref.

Script 1 (OnDamaged & OnOpen):

////////////////////////////////////////////////////////////
/////////////Open Coffin - Spawn Vampire ///////////////////
////////////////////(Only Once)/////////////////////////////
////////////////////////////////////////////////////////////
//////////////By: Tom Ploskina Jr.//////////////////////////
////////////////////////////////////////////////////////////
/*      This script spawns a vampire by its ////////////////
/       blueprint upon opening a coffin.  It ///////////////
/       then sets a local variable to make /////////////////
/       sure that only 1 vampire will spawn ////////////////
/       when the coffin is opened.//////////////////////////
///////////////////////////////////////////////////////// */

void main()
{
//If PC has not opened coffin keep going...
if(!(GetLocalInt(GetLastOpenedBy(), "nCoffinStatus") == 1))
{
    //Okay, the PC is about to open coffin, let's give them a 1
    SetLocalInt(GetLastOpenedBy(), "nCoffinStatus", 1);
    //Spawn the creature with the blueprint of ct_vamp at stated location
    location CoffinIsHere = GetLocation(OBJECT_SELF);
    CreateObject(OBJECT_TYPE_CREATURE, "ct_cvamp", CoffinIsHere);
    }
    else
    {
        //Let's do something if they've already opened the coffin
        SpeakString("The coffin appears to be empty");
        }
}