DysoForums Forum Index DysoForums
 
GalleryGallery   Donate to DysotopiaDonate   Dysotopia.com homepageDyso.com
SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStats   RegisterRegister 
 Login to check your private messagesLogin to check your private messages   LoginLogin 

all you need is love

 
Post new topic   Reply to topic    DysoForums Forum Index -> Worldbuilders
View previous topic :: View next topic :: Hide signatures  
Author Message
Y
Guest




Level: 51
XP
EXP: 189 / 280 EXP: 189 / 280 EXP: 189 / 280
 67%
PostPosted: Mon Jun 30, 2003 8:17 am    Post subject: all you need is love Reply with quote

Code:
// Make a bench or coutch usable by 2
void main()
{
    // Set some variable for a beter understanding
    object oPlayer = GetLastUsedBy();
    object oBench  = OBJECT_SELF;

    // Get a hold on the 2 pillows
    object oPillow1 = GetLocalObject( OBJECT_SELF, "Pillow 1" );
    object oPillow2 = GetLocalObject( OBJECT_SELF, "Pillow 2" );

    // If the sitting places do not exist, create them
    if( !GetIsObjectValid( oPillow1 ) )
    {
        // Set up some variable for understanding
        object oArea = GetArea( oBench );
        vector locBench = GetPosition( oBench );
        float fOrient  = GetFacing( oBench );

        // Calculate location of the 2 pillows
        location locPillow1 = Location( oArea, locBench + AngleToVector( fOrient + 90.0f ) / 1.7f, fOrient );
        location locPillow2 = Location( oArea, locBench + AngleToVector( fOrient - 90.0f ) / 1.7f, fOrient );

        // Create the 2 pillows
        oPillow1 = CreateObject( OBJECT_TYPE_PLACEABLE, "plc_invisobj", locPillow1 );
        oPillow2 = CreateObject( OBJECT_TYPE_PLACEABLE, "plc_invisobj", locPillow2 );

        // Memorise the places
        SetLocalObject( OBJECT_SELF, "Pillow 1", oPillow1 );
        SetLocalObject( OBJECT_SELF, "Pillow 2", oPillow2 );
    }

    // Chose the nearest pillow if not used and sit
    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 ) );
        }
    }
}
Back to top
Shadowleaf
Hero


Joined: 14 Jan 2003
Posts: 634

Level: 23
XP
EXP: 1 / 65 EXP: 1 / 65 EXP: 1 / 65
 1%
PostPosted: Mon Jun 30, 2003 8:33 am    Post subject: Reply with quote

cool, very nice and useful looking. i probably wont use it myself but in case i do, thanks icon_biggrin.gif
_________________
Glorin wrote:
Marine you are such a great guy, i hope you don't get hit by a truck one day!!
Back to top
View users profile Send private message Send email AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    DysoForums Forum Index -> Worldbuilders All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.2 © 2001, 2002 phpBB Group