Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] If 'something' collides with area function
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: If 'something' collides with area function

(05-27-2012, 07:14 PM)beecake Wrote: I placed "Add_variable_1" and 2 and 3, under AttachFunction.

Here is my script so far

Spoiler below!


void Add_variable_1(string &in asStickyArea, string &in asBodyName)
{
SetLocalVarInt("book_placement_1", 1);

if(GetLocalVarInt("book_placement_1") == 1)
{
if(GetLocalVarInt("book_placement_2") == 1)
{
if(GetLocalVarInt("book_placement_3") == 1)
{
StartEffectFlash(1, 1.0, 1);
AddTimer("", 1, "RealLife_timer");
}
}
}
}

void Add_variable_2(string &in asStickyArea, string &in asBodyName)
{
SetLocalVarInt("book_placement_2", 1);

if(GetLocalVarInt("book_placement_1") == 1)
{
if(GetLocalVarInt("book_placement_2") == 1)
{
if(GetLocalVarInt("book_placement_3") == 1)
{
StartEffectFlash(1, 1.0, 1);
AddTimer("", 1, "RealLife_timer");
}
}
}
}

void Add_variable_3(string &in asStickyArea, string &in asBodyName)
{
SetLocalVarInt("book_placement_3", 1);

if(GetLocalVarInt("book_placement_1") == 1)
{
if(GetLocalVarInt("book_placement_2") == 1)
{
if(GetLocalVarInt("book_placement_3") == 1)
{
StartEffectFlash(1, 1.0, 1);
AddTimer("", 1, "RealLife_timer");
}
}
}
}

///TIMERS

void RealLife_timer(string &in asTimer)
{
TeleportPlayer("PlayerStartArea_3");
}


I had some problems with it, but now it works.

Remember to place something in the AttachAbleBodyName Smile

Here's the code i would have used; there's no need to add an AttachAbleBodyName to the sticky area:

PHP Code: (Select All)
void AttachFunction(string &in areastring &in object)
{
    
AddDebugMessage(objectfalse);

    if (!
StringContains(object"BookSyntax"))
    {
        
SetAllowStickyAreaAttachment(false);
        return;
    }

    
SetAllowStickyAreaAttachment(true);
    
AddLocalVarInt("AttachedBooks"1);

    if (
GetLocalVarInt("AttachedBooks") == 3)
    {
        
AddDebugMessage("Puzzle completed!"false);

        
// Complete puzzle
    
}
}

void DetachFunction(string &in areastring &in object)
{
    
AddDebugMessage("Detaching: "+objectfalse);
    
AddLocalVarInt("AttachedBooks", -1);


Tutorials: From Noob to Pro
05-28-2012, 07:52 AM
Website Find


Messages In This Thread
RE: If 'something' collides with area function - by Your Computer - 05-28-2012, 07:52 AM



Users browsing this thread: 1 Guest(s)