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
secret bookshelf
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#1
secret bookshelf

How do I make a script that when I drag a lever a bookshelf moves and reveals an hidden door ?.

[Image: 44917299.jpg]Dubstep <3
05-28-2011, 12:23 PM
Find
Mooserider Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2011
Reputation: 2
#2
RE: secret bookshelf

It's actually reasonably easy once you know how Big Grin
There are a couple ways though:

First, if you want the shelf to slide to the left (I don't think you can make it slide to the right), Follow these steps:

1. Make a lever. Call it "Lever". Make it's settings whatever you want.
2. Place the "shelf_secret_door" entity. Name it "Shelf".
3. In the OnStart part of your script, put this:
        ConnectEntities("door_connection",        //Name of connection
        "Lever",     //Parent entity (Affects)
        "Shelf",    //Child entity     (Affected)
        false,        //Invert the state sent
        1,         //States used (0=both), checked before invertion.
        "CreateDust");    //callback
That was copied from the Old Archives level in the actual game - when I put it in mine I removed the comments but that made it not work, so I don't advise it (Even though I probably just messed something upTongue)

If you want to have the castlebase secret door slide up like in the actual game, put the secret door in the map (It's under "Door"), name it "secret_door" and copy and paste the above script in your OnStart section but change "Shelf" to "secret_door"

Now, If you want the shelf to swing open like in the original game, It's a little bit more complicated. Follow these steps:

1. Make the lever in step 1 above.
2. Make a "shelf_secret_door_rot" entity. Name it Shelf.
3. Make an area at the right side of the shelf (Where it will pivot). Name it "RotateArea".
4. Go into the entity settings of the shelf and under "AngularOffsetArea" make it "RotateArea" with no quotes.
5. Add the above code.

Things to note:
1. If you want to pull the lever up instead of down the easiest way is to change "false" in the script to "true".
2. To make a door like in Justine where you can pull up to open it and down to close it, change the "1" in the script to "0" and turn the lever upside down (At least that's what I had to do).

And you should be done! If I've messed up and the script doesn't work, just tell me. Hope it helps!

Working on a FC: "Don't Let Go "
(This post was last modified: 05-28-2011, 03:04 PM by Mooserider.)
05-28-2011, 01:58 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: secret bookshelf

It doesn't work :S
Here's the script:
Spoiler below!

[Image: shelf.png]

Uploaded with ImageShack.us


Here's the bookshelf
Spoiler below!

[Image: shelf2.png]

Uploaded with ImageShack.us


Here's the code:
Spoiler below!

void OnStart()
{
        ConnectEntities("door_connection",        //Name of connection
        "Lever1",     //Parent entity (Affects)
        "Shelf",    //Child entity     (Affected)
        false,        //Invert the state sent
        1,         //States used (0=both), checked before invertion.
        "CreateDust");    //callback
}


I tried the swing door part and it didn't work :/

[Image: 44917299.jpg]Dubstep <3
05-28-2011, 04:17 PM
Find
Exostalker Offline
Member

Posts: 204
Threads: 10
Joined: Aug 2010
Reputation: 3
#4
RE: secret bookshelf

I would recommend to move rotate area a little bit more left, so that it would include a little bit of secret shelf...

This works for me, I can't see any changes:

...
               SetLeverStuckState("secret_lever", 1, true);
     ConnectEntities("shelf_connection", "secret_lever", "secret_shelf", false, 1, "CreateDust");
               return;
...

void CreateDust(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{    
    if(GetLocalVarInt("DoSecretDoorEffects") == 1) return;
    
    CreateParticleSystemAtEntity("PSDoorDust", "ps_dust_falling_door.ps", "secret_shelf", false);
    
    AddTimer("sucess_music", 2, "TimerMusic");    
    
    AddTimer("Hint", 0.5f, "TimerHint");
    
    StartScreenShake(0.01f, 0.5f, 2.0f,2.0f);
    
    SetLocalVarInt("DoSecretDoorEffects", 1);
    
    CreateParticleSystemAtEntity("DustFromMoving", "ps_dust_falling_door.ps", "candlestick_floor_burntout_8", false);
    
    FadeRadialBlurTo(1, 0.1f);
    
        PlayMusic("14_elevator_clank.ogg", false, 0.9f, 0, 1, false);
        
    
}

void TimerMusic(string &in asTimer)
{
    
    PlayMusic("01_puzzle_passage.ogg", false, 0.6f, 0.2f, 10, false);
    
     FadeRadialBlurTo(0.0, 3.2f);

(This post was last modified: 05-28-2011, 05:54 PM by Exostalker.)
05-28-2011, 05:54 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#5
RE: secret bookshelf

I got a new ide. What's the script for draging the lever and a door destroys?

I know it's something with
SetPropHealth("Shelf", -100);

[Image: 44917299.jpg]Dubstep <3
05-28-2011, 07:08 PM
Find
Exostalker Offline
Member

Posts: 204
Threads: 10
Joined: Aug 2010
Reputation: 3
#6
RE: secret bookshelf

Well in my opinion destroying it would be ultra unrealistic...

05-28-2011, 07:31 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#7
RE: secret bookshelf

(05-28-2011, 07:31 PM)Exostalker Wrote: Well in my opinion destroying it would be ultra unrealistic...

I didn't understand your code and the others aren't working :/

[Image: 44917299.jpg]Dubstep <3
05-28-2011, 08:15 PM
Find
Exostalker Offline
Member

Posts: 204
Threads: 10
Joined: Aug 2010
Reputation: 3
#8
RE: secret bookshelf

Also, did you add RotateArea to your shelf angullaroffsetarea?

Angullaroffsetarea is entity setting, if you choose your shelf you should see it.

05-28-2011, 09:14 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#9
RE: secret bookshelf

Yea I did :/

[Image: 44917299.jpg]Dubstep <3
05-28-2011, 10:00 PM
Find
Mooserider Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2011
Reputation: 2
#10
RE: secret bookshelf

Is the name of the lever in the editor and the name of the lever in the script the same? Also, make sure that the bookshelf is the "shelf secret door rot.ent" entity. Sorry if you've already done this, but I can't see it in the picture you posted. If none of this works, I am truly sorry, but I don't know what would fix it.

EDIT:

I've put up a test map that I made. Hopefully if yours still doesn't work this map will help you.
[attachment=1481]

Working on a FC: "Don't Let Go "
(This post was last modified: 05-29-2011, 12:47 AM by Mooserider.)
05-28-2011, 11:48 PM
Find




Users browsing this thread: 2 Guest(s)