Aschbourne_PRC8/_module/nss/zep_use_chair2.nss
GetOffMyYarn 69879d6957 Areas and Fixes
Added CCOH and missing areas
Changed some areas to be craftable,
Fixed some on death issues,
Fixed the Gaurd
2024-08-30 11:38:44 -04:00

45 lines
1.6 KiB
Plaintext

//Standard script to allow a placeable bench to sit two players
void main()
{
object oPlayer = GetLastUsedBy();
object oBench = OBJECT_SELF;
object oPillow1 = GetLocalObject( OBJECT_SELF, "Pillow 1" );
object oPillow2 = GetLocalObject( OBJECT_SELF, "Pillow 2" );
if( !GetIsObjectValid( oPillow1 ) )
{
object oArea = GetArea( oBench );
vector locBench = GetPosition( oBench );
float fOrient = GetFacing( oBench );
location locPillow1 = Location( oArea, locBench + AngleToVector( fOrient + 90.0f ) / 2.0f, fOrient );
location locPillow2 = Location( oArea, locBench + AngleToVector( fOrient - 90.0f ) / 2.0f, fOrient );
oPillow1 = CreateObject( OBJECT_TYPE_PLACEABLE, "plc_invisobj", locPillow1 );
oPillow2 = CreateObject( OBJECT_TYPE_PLACEABLE, "plc_invisobj", locPillow2 );
SetLocalObject( OBJECT_SELF, "Pillow 1", oPillow1 );
SetLocalObject( OBJECT_SELF, "Pillow 2", oPillow2 );
}
if( GetDistanceBetween( oPlayer, oPillow1 ) < GetDistanceBetween( oPlayer, oPillow2 ) )
{
if( !GetIsObjectValid( GetSittingCreature( oPillow1 ) ) )
{
AssignCommand( oPlayer, ActionSit( oPillow1 ) );
}
else
{
AssignCommand( oPlayer, ActionSit( oPillow2 ) );
}
}
else
{
if( !GetIsObjectValid( GetSittingCreature( oPillow2 ) ) )
{
AssignCommand( oPlayer, ActionSit( oPillow2 ) );
}
else
{
AssignCommand( oPlayer, ActionSit( oPillow1 ) );
}
}
}