// som_sarcophagus_open
/*
Place this script in the "On Open Script" field of a
useable sarcophagus. The first time the sarcophagus is
opened, a puff of dirt is released over the opening.
Thereafter the effect is disabled.
*/
// 14jan12 RJH
const string somHasOpened = "hasOpenedSarc";
const string somDirtPuff = "fx_dirt_puff";
void DoDirtPuff()
{
// Gather data
object oArea = GetArea( OBJECT_SELF );
location locSelf = GetLocation( OBJECT_SELF );
string sResRef = GetResRef( OBJECT_SELF );
float fFacing = GetFacing( OBJECT_SELF );
// Set positional parameters based on the blueprint
float fHeight = 0.5f;
if ( ( StringCompare( sResRef, "plc_mc_sarcoph1" ) == 0 ) ||
( StringCompare( sResRef, "plc_mc_sarcoph2" ) == 0 ) )
{
fFacing += 255.0f;
} else if (
( StringCompare( sResRef, "plc_mc_sarcoph3" ) == 0 ) ||
( StringCompare( sResRef, "plc_mc_sarcoph5" ) == 0 ) )
{
fFacing += 300.0f;
fHeight = 0.6f;
}
// Compute the effect placement
float fSin = 1.0f * sin( fFacing );
float fCos = 1.0f * cos( fFacing );
vector vSelf = GetPositionFromLocation( locSelf );
vector vOffset = Vector( fCos, fSin, fHeight );
location locEffect = Location( oArea, vSelf + vOffset, fFacing );
// Apply the puff of smoke at the location
effect eCloud = EffectNWN2SpecialEffectFile( somDirtPuff );
ApplyEffectAtLocation( DURATION_TYPE_INSTANT, eCloud, locEffect );
}
void main()
{
int nHasOpened = GetLocalInt( OBJECT_SELF, somHasOpened );
if ( nHasOpened == FALSE ) {
// Trigger a puff of smoke over the opening
DoDirtPuff();
SetLocalInt( OBJECT_SELF, somHasOpened, TRUE );
}
}
Modifié par rjshae, 16 janvier 2013 - 04:57 .





Retour en haut






