Frictional Games Forum (read-only)

Full Version: Rotate secret book shelf with moveable book
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. I have a problem when i want to rotate the secret book shelf using a moveable book. The problem is that the shelf is not moving at all.

Here is the script:

Spoiler below!
void OnStart();

{

AddEntityCollideCallback("Book", "Book_Area", "func_shelf", true, 1);

}

void func_shelf(string &in asEntity, int alState)

{
if (alState == 1)
{
SetMoveObjectState("Shelf", 1);

}

}

I have named the moveable book to "Book", and placed a area near the book, and i have named it "Book_Area". The shelf name is "Shelf", and i have places a area near the corner of the shelf, where i want it to rotate, and named it "RotateShelf, and i have named the "RotateShelf" in the AngularOffsetArea on the Shelf.

Any help would be highly appreciated! Thanks in advance! Smile
Your function func_shelf have wrong arguments, you need two strings and one integer.

Like this:
void func_shelf ( string &in as p, string &in c, int i )
(11-08-2013, 03:02 PM)Amn Wrote: [ -> ]Your function func_shelf have wrong arguments, you need two strings and one integer.

Like this:
void func_shelf ( string &in as p, string &in c, int i )

Thanks for the answer Amn! I figured out my problem few days back, this is my code now:

Spoiler below!
AddEntityCollideCallback("Book_1", "BookArea_1", "func_shelf", true, 0);


void func_shelf (string &in asParent, string &in asChild, int alState)

{
if(alState == 1)
if(asParent == "Book_1" && GetLocalVarInt("Move") == 0)



{
SetMoveObjectState("Shelf", 1);
SetLocalVarInt("Move", 1);
PlayMusic("10_puzzle02.ogg", false, 0.7, 0.1, 2, false);
GiveSanityBoostSmall();
}

}

I have tried to add few more books, when you have all books drawn, then the secret shelf will rotate. It doesn't require any given order, just that when all books have been drawn. I have tried many hours to try to get it to work, but with no results. I know the problem is simple, just that i don't seem to get the hang of it.

Thanks for any answer in advance! Smile
What is the exact name of the shelf you are using ? I mean not the one you gave to the shelf, but the one it has in the level editor.
(11-11-2013, 07:20 PM)daortir Wrote: [ -> ]What is the exact name of the shelf you are using ? I mean not the one you gave to the shelf, but the one it has in the level editor.

The shelf name is shelf_secret_door.ent

I actually didn't get the shelf to rotate, with any kind of shelf entitys. It only goes sideways, but i figured that will do.

The main issue for me is still that i don't get the shelf to move, when i try to combine more books to the script. I will be back to write some updates, if i manage to get it to work.

Thanks for the reply daortir!