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


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving Shelf Using Secret Books
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#1
Moving Shelf Using Secret Books

So I wanted to use the secret books method that the original Amnesia game had where when you pulled the books (on time that is), it would open the shelf. However, for me, it's a bit different

I want it to be if you pull the right books (some are real, some are fake) the shelf opens and if you pull the fake books, it restarts the whole puzzle. I got the shelf movement to work... sort of. It moves backwards through the wall instead of to the side. That's not how it's suppose to be, it should move to the side, like in the Amnesia game itself.

I tried checking how they made it work... but I don't see how! They didn't use an Area or anything like that. They did use the "SetMoveObjectState" and that's pretty much all I see that made me understand how it worked. But somehow, they made their shelf move to the side, not backwards, like mine.

Please help!! Sad

If you need me to go more into detail, I can record a very quick video demonstrating what I mean.

EDIT: I found out what was the problem. Apparently you CANNOT rotate the shelf to whatever position you want it to be (Ex. rotating it -180 on the X axis). How the shelf is placed in the level editor is how the shelf has to be. You cannot touch it, move it, rotate it, NOTHING, or else it doesn't work correctly.


Thanks for all the help guys Smile but I figured it out by doing some trial and error. However, you guys gave me some useful info. to use maybe in the future, so thank you for that Smile
(This post was last modified: 06-18-2012, 08:52 PM by SonOfLiberty796.)
06-18-2012, 03:02 AM
Find
SilentHideButFine Offline
Member

Posts: 156
Threads: 38
Joined: May 2012
Reputation: 6
#2
RE: Moving Shelf Using Secret Books

(06-18-2012, 03:02 AM)Xvideogamer720X Wrote: So I wanted to use the secret books method that the original Amnesia game had where when you pulled the books (on time that is), it would open the shelf. However, for me, it's a bit different

I want it to be if you pull the right books (some are real, some are fake) the shelf opens and if you pull the fake books, it restarts the whole puzzle. I got the shelf movement to work... sort of. It moves backwards through the wall instead of to the side. That's not how it's suppose to be, it should move to the side, like in the Amnesia game itself.

I tried checking how they made it work... but I don't see how! They didn't use an Area or anything like that. They did use the "SetMoveObjectState" and that's pretty much all I see that made me understand how it worked. But somehow, they made their shelf move to the side, not backwards, like mine.

Please help!! Sad

If you need me to go more into detail, I can record a very quick video demonstrating what I mean.
void OnStart()
{
for(int i=1;i<=3;i++) AddEntityCollideCallback("SecretBook_"+i, "AreaSecretBook_"+i, "CollideSecretBook", false, 0);
}



void CollideSecretBook(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) {
SetLocalVarInt("Var"+asParent, 1);

AddTimer(asParent, 20, "PushBackBook");

SetPropObjectStuckState(asParent, 1);

PlaySoundAtEntity("Sound"+asParent, "gameplay_tick", asParent, 0.0f, false);

StartScreenShake(0.001f, 0.5f, 0.5f, 0.5f);

PlayGuiSound("16_lever_stuck", 0.3f);

/*DEBUG
*/
AddDebugMessage("Book in area: "+asParent, true);
} else {
SetLocalVarInt("Var"+asParent, 0);

RemoveTimer(asParent);

PlaySoundAtEntity("Sound2"+asParent, "lock_door", asParent, 1.5f, false);
PlayGuiSound("16_lever_stuck", 0.2f);

StopSound("Sound"+asParent, 1.0f);

/*DEBUG
*/
AddDebugMessage("Book out of area: "+asParent, true);
}

/*All books are pulled before time is out and the secret room is revealed.
*/
if(GetLocalVarInt("VarSecretBook_1") == 1 && GetLocalVarInt("VarSecretBook_2") == 1 && GetLocalVarInt("VarSecretBook_3") == 1) {

FadeLightTo("PointLight_30", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f);

SetMoveObjectState("shelf_secret_door_1", 1);

SetPropObjectStuckState("SecretBook_*", -1);

SetEntityInteractionDisabled("SecretBook_*", true);

PlaySoundAtEntity("BooksDone", "lock_door", "Player", 0, false);

CreateParticleSystemAtEntity("dust", "ps_dust_falling_door_quick", "AreaDoorParticle", false);

for(int i=1;i<=3;i++){ RemoveTimer("SecretBook_"+i); StopSound("SoundSecretBook_"+i, 0.0f); }

GiveSanityBoostSmall();

PlayMusic("03_puzzle_secret.ogg", false, 0.7f, 0, 10, false);

SetSwingDoorLocked("shelf02_3", false, true);

/*DEBUG
*/
AddDebugMessage("All books in position, move shelf!", true);
}

}
void PushBackBook(string &in asTimer)
{
SetPropObjectStuckState(asTimer, -1);

AddTimer("2"+asTimer, 0.25f, "PushBackBook02");

/*DEBUG
*/
AddDebugMessage("Push back book: "+asTimer, true);
}
void PushBackBook02(string &in asTimer)
{
if(asTimer == "2SecretBook_1") SetPropObjectStuckState("SecretBook_1", 0);
else if(asTimer == "2SecretBook_2") SetPropObjectStuckState("SecretBook_2", 0);
else SetPropObjectStuckState("SecretBook_3", 0);
}


it works for me Smile

[url= http://www.moddb.com/mods/jessehmusic [/url] ,HOSPITAL OF HORROR MOD
06-18-2012, 06:38 AM
Find
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#3
RE: Moving Shelf Using Secret Books

That's complicated as hell...
I actually saw that in their script, but didn't understand it at all.

Looks like I'm gonna have to do some trial and error and see if this will actually work for me. Thanks for the help!

Unless someone else could help me with something easier/better or just help me understand that script, but it looks like it doesn't get easier than that. :p
(This post was last modified: 06-18-2012, 06:46 AM by SonOfLiberty796.)
06-18-2012, 06:45 AM
Find
Dutton Offline
Member

Posts: 121
Threads: 3
Joined: Apr 2012
Reputation: 2
#4
RE: Moving Shelf Using Secret Books

The best thing you could do, is to actually learn what the script means by itself, that way you'll have a better overview of whats happening when, and why.

[Image: 15isy6C]
06-18-2012, 07:04 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#5
RE: Moving Shelf Using Secret Books

SetMoveObjectState is all you need. 1 refers to the "open" position of something (activated), and 0 refers to the "closed" position of something (inactivated); 0 is the starting position of a given entity unless otherwise changed via the level editor.

Also, there are 4 different types of secret moving shelves:

shelf_secret_door.ent

shelf_secret_door_interact.ent

shelf_secret_door_joint.ent

shelf_secret_door_rot.ent


make sure yours is not interact, joint, or rot. (based on the issue you described, it seems you are using a rotating shelf and have no AngularOffsetArea).

Make sure you're using "shelf_secret_door.ent"; this specific shelf moves left/right when the SetMoveObjectState is changed to 1.

SilentHideButFine's copy and paste of the shelf puzzle in game isn't very helpful to you; it is a somewhat advanced script that deals with the movement of the books and the effects for the puzzle, rather than the actual movement of the secret shelf.


So quick overview:
-Use shelf_secret_door.ent
-Use SetMoveObjectState and set it to 1 to "activate" the secret shelf

Alternatively, if you're interested in the other types of shelves, I am only familiar with a few; if you use the "Rotate" (rot) shelf, you need to go into the level editor and place a script area roughly the same length and height of the bookshelf, and put this area wherever you the bookshelf to "hinge" at, or rotate around. In the bookshelves options, make sure to put the name of the script area in the box under "AngularOffsetArea".

Hope that helped!

I rate it 3 memes.
06-18-2012, 02:13 PM
Find
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#6
RE: Moving Shelf Using Secret Books

(06-18-2012, 02:13 PM)andyrockin123 Wrote: SetMoveObjectState is all you need. 1 refers to the "open" position of something (activated), and 0 refers to the "closed" position of something (inactivated); 0 is the starting position of a given entity unless otherwise changed via the level editor.

Also, there are 4 different types of secret moving shelves:

shelf_secret_door.ent

shelf_secret_door_interact.ent

shelf_secret_door_joint.ent

shelf_secret_door_rot.ent


make sure yours is not interact, joint, or rot. (based on the issue you described, it seems you are using a rotating shelf and have no AngularOffsetArea).

Make sure you're using "shelf_secret_door.ent"; this specific shelf moves left/right when the SetMoveObjectState is changed to 1.

SilentHideButFine's copy and paste of the shelf puzzle in game isn't very helpful to you; it is a somewhat advanced script that deals with the movement of the books and the effects for the puzzle, rather than the actual movement of the secret shelf.


So quick overview:
-Use shelf_secret_door.ent
-Use SetMoveObjectState and set it to 1 to "activate" the secret shelf

Alternatively, if you're interested in the other types of shelves, I am only familiar with a few; if you use the "Rotate" (rot) shelf, you need to go into the level editor and place a script area roughly the same length and height of the bookshelf, and put this area wherever you the bookshelf to "hinge" at, or rotate around. In the bookshelves options, make sure to put the name of the script area in the box under "AngularOffsetArea".

Hope that helped!
Dude. You don't know how much I love you. *kid voice* You're my new friend *end kid voice* lol :p
Thank you SO much! What you wrote is pretty much a guide! You should publish this in the tutorials section of the wiki page.

And yeah, the script looked like it was more about the puzzle itself more than the shelf :p not to mention it had all these numbers and symbols and what not that I have not learned.

I'll try out what you said and come back with the results; I'm pretty sure what you said will work Smile

EDIT: Hmm.. it's still doing the exact same thing. I was really sure that it would finally work, but it didn't :/ I did use the "shelf_secret_door.ent" and made sure I didn't click on or use the other three shelfs...

However, what I find strange is that the "shelf_secret_door.ent" (the one you're telling me to use), is it still has the option for an "AngularOffsetArea". I even checked on the original Amnesia map, Archives, and the shelf they are using is the exact same; it also has that "AngularOffestArea" option.

I'll keep testing and see what's up... something isn't right here. But yeah, to conclude, I'm still having the same problem :/
(This post was last modified: 06-18-2012, 07:44 PM by SonOfLiberty796.)
06-18-2012, 07:29 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#7
RE: Moving Shelf Using Secret Books

I took the time before and messed around with the secret shelf they use in the old archives and the script they use for it to open is pretty straight forward Smile the AngularOffsetArea is where the shelf should rotate so if you put a script area on one side of the shelf and then write the script area inside the AngularOffset option it will rotate around the middle of the script area Smile

in the Old Archives they use the ConnectEntities script to make it start rotating Smile

06-18-2012, 08:04 PM
Find
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#8
RE: Moving Shelf Using Secret Books

(06-18-2012, 08:04 PM)SilentStriker Wrote: I took the time before and messed around with the secret shelf they use in the old archives and the script they use for it to open is pretty straight forward Smile the AngularOffsetArea is where the shelf should rotate so if you put a script area on one side of the shelf and then write the script area inside the AngularOffset option it will rotate around the middle of the script area Smile

in the Old Archives they use the ConnectEntities script to make it start rotating Smile
That's for the rotating shelf, though. And I'm talking about the shelf in the Archives, not the Old Archives.

But thanks for telling me this though! It may help in the future Smile

EDIT: I found out what was the problem. Apparently you CANNOT rotate the shelf to whatever position you want it to be (Ex. rotating it -180 on the X axis). How the shelf is placed in the level editor is how the shelf has to be. You cannot touch it, move it, rotate it, NOTHING, or else it doesn't work correctly.
(This post was last modified: 06-18-2012, 08:51 PM by SonOfLiberty796.)
06-18-2012, 08:19 PM
Find




Users browsing this thread: 1 Guest(s)