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
3 books open door script
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: 3 books open door script

First, make a small script area in front of each book (the book you should be using is under entities > gameplay, top of the list), be sure to place it so when the book is pulled all the way out, it will collide with the area. Now, here's the script (I did this pretty quickly, so I might've forgotten a thing or two):




void OnStart()
{
AddEntityCollideCallback("NAME_OF_BOOK_1", "NAME_OF_AREA_1", "BookFunc", false, 1);
AddEntityCollideCallback("NAME_OF_BOOK_2", "NAME_OF_AREA_3", "BookFunc", false, 1);
AddEntityCollideCallback("NAME_OF_BOOK_3", "NAME_OF_AREA_3", "BookFunc", false, 1);

SetLocalVarInt("BookVar", 0);
}

void BookFunc(string &in asParent, string &in asChild, int alState)
{
AddTimer("puzzletimer", 30.0f, "RestartPuzzle");

if(asParent == "NAME_OF_BOOK_1")
{
AddLocalVarInt("BookVar", 1);
GetPuzzleComplete();
}
if(asParent == "NAME_OF_BOOK_2")
{
AddLocalVarInt("BookVar", 1);
GetPuzzleComplete();
}
if(asParent == "NAME_OF_BOOK_3")
{
AddLocalVarInt("BookVar", 1);
GetPuzzleComplete();
}
}

void GetPuzzleComplete()
{
if(GetLocalVarInt("BookVar") == 3)
{
SetSwingDoorLocked("NAME_OF_DOOR", false, true);
RemoveTimer("puzzletimer");
}
}

void RestartPuzzle(string &in asTimer)
{
SetLocalVarInt("BookVar", 0);
SetMoveObjectState("NAME_OF_BOOK_1", 0);
SetMoveObjectState("NAME_OF_BOOK_2", 0);
SetMoveObjectState("NAME_OF_BOOK_3", 0);
}


Hope that helped!

I rate it 3 memes.
08-04-2012, 04:58 PM
Find


Messages In This Thread
3 books open door script - by Lukaboy8 - 08-04-2012, 04:37 PM
RE: 3 books open door script - by EXAWOLT - 08-04-2012, 04:53 PM
RE: 3 books open door script - by Lukaboy8 - 08-04-2012, 04:56 PM
RE: 3 books open door script - by Adny - 08-04-2012, 04:58 PM
RE: 3 books open door script - by EXAWOLT - 08-04-2012, 05:04 PM
RE: 3 books open door script - by Lukaboy8 - 08-05-2012, 12:27 PM
RE: 3 books open door script - by SilentStriker - 08-05-2012, 12:32 PM
RE: 3 books open door script - by Lukaboy8 - 08-05-2012, 12:43 PM
RE: 3 books open door script - by SilentStriker - 08-05-2012, 01:02 PM
RE: 3 books open door script - by Lukaboy8 - 08-05-2012, 03:47 PM
RE: 3 books open door script - by SilentStriker - 08-05-2012, 04:01 PM
RE: 3 books open door script - by Lukaboy8 - 08-05-2012, 04:21 PM



Users browsing this thread: 2 Guest(s)