Name: Whatever you want to call it =)
Function: Room with 3 levers, if all three get thrown into the activated
position, then it spawns an object ( in this case, his custom red dragon ).
Notes: I wrote this for a gentleman when he was struggling on this
situation. I personally haven't tested it, but it worked for him. It
requires a few things - the 3 triggers, a waypoint, and an invisible object.
In reality, the value stored in the invisible object can just be put in the
waypoint and the object can be removed.
After the dragon spawns, the levers get locked in the activated position.
NWScript:
void main()
{
object oLeverCounter = GetObjectByTag( "lever_counter" );
int nNumLeversPulled = GetLocalInt( oLeverCounter, "nNumPulled" );
int nAllLeversPulled = GetLocalInt( oLeverCounter, "nAllPulled" );
int bActivated = GetLocalInt( OBJECT_SELF, "m_bActivated" );
if ( !nAllLeversPulled )
{
if ( bActivated )
{
nNumLeversPulled--;
SetLocalInt( OBJECT_SELF, "m_bActivated", FALSE );
SetLocalInt( oLeverCounter, "nNumPulled", nNumLeversPulled );
PlayAnimation( ANIMATION_PLACEABLE_DEACTIVATE );
PrintString( "Deactivated Lever" );
} else
{
nNumLeversPulled++;
SetLocalInt( OBJECT_SELF, "m_bActivated", TRUE );
SetLocalInt( oLeverCounter, "nNumPulled", nNumLeversPulled );
PlayAnimation( ANIMATION_PLACEABLE_ACTIVATE );
PrintString( "Activated Lever" );
}
PrintInteger( nNumberLeversPulled );
if ( nNumLeversPulled == 3 )
{
PrintString( "Spawning the creature!" );
SetLocalInt( oLeverCounter, "nAllPulled", 1 );
object oSpawnLocation = GetObjectByTag( "wp_dragon" );
location lSpawnLoc = GetLocation( oSpawnLocation );
CreateObject( OBJECT_TYPE_CREATURE, "drgred003", lSpawnLoc );
}
}
}
_________________
Ondo Frigton - Bard of Many Seasons
Beware the Badgers!
|