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
Script Help Sliding Shelf
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#1
Sliding Shelf

I've been trying to make a shelf slide like a secret door for... probably five hours now. I had it moving earlier, but in the wrong direction (positive X instead of positive Z based on world coordinates). This is the current script I'm using for it:
void OnEnter()
{
    AddEntityCollideCallback("book_moveable_1", "AreaBookPulled_1", "Secret_Shelf", true, 1);
}

void Secret_Shelf(string &in asParent, string &in asChild, int alState)
{
    AddPropForce("shelf_secret_door_1", 0.00f, 0.00f, 1000.00f, "world");
    PlaySoundAtEntity("click", "lock_door", "Player", 0, false);
}

The shelf in question started off being the shelf_secret_door.ent, which I had moving based on "SetMoveObjectState". There were two problems with this:
1. Shelf moved along the X axis (forward), I want it to move along the Z axis (left)
2. The books on the shelf didn't move with it

Now I've switched it out for shelf_high_01.ent, which doesn't move at all. with either the SetMoveObjectState or AddPropForce.

I've looked at TDD scripts, other CS scripts, checked the forum and the wiki to no avail. If you have any suggestions at all, please help me; I'm completely stumped.

Thanks for being so patient with me Smile

[Image: quote_by_rueppells_fox-d9ciupp.png]
03-18-2013, 06:41 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Sliding Shelf

For shelves and secret doors, use a lever. You cannot do it with a script area.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-18-2013, 07:00 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Sliding Shelf

You need to use the shelf, that is called something with secret door.
There are 2. One of them is grabable, and it's probably not that one you want.
The other one is a bit higher, and it uses SetMoveObjectState.

Now you say it moves in the wrong direction. I'm pretty sure other people have had that problem too.
First try searching for it.
Secondly, try opening the model in the modeleditor, and check how it works. Then try to make it on the Z-axis instead.

For the books:
There's nothing to do. Those books are static, and if they were movable, it would look strange because that would be large squares of books, moving.
What you could do is, to try to make it look realistic with movable books and stuff that could be on this shelf.

(03-18-2013, 07:00 AM)JustAnotherPlayer Wrote: For shelves and secret doors, use a lever. You cannot do it with a script area.

A script area should not be the problem. SetMoveObjectState does not change whether it's used by a lever or a script area. It doesn't change anything in the script, except for some parameters.

Trying is the first step to success.
(This post was last modified: 03-18-2013, 07:06 AM by FlawlessHappiness.)
03-18-2013, 07:04 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#4
RE: Sliding Shelf

You just need use a shelf that is a MoveObject (you can check in the model editor what type it is). Then use SetMoveObjectState to move the shelf. If the shelf doesn't move in the right direction, you can change which axis it moves on by opening it in the model editor, then going to Settings > User Defined Variables, and changing the direction that it moves.

If the shelf you want to use isn't a MoveObject, just copy the entity file, put it in your custom story folder, change it's type to MoveObject, and then use it in the level editor.

In Ruins [WIP]
03-18-2013, 07:14 AM
Find
Akos115 Offline
Member

Posts: 101
Threads: 14
Joined: Aug 2012
Reputation: 0
#5
RE: Sliding Shelf

Shelf_secret_door should work fine, the only problem is that it can only move in one direction.

03-18-2013, 08:20 PM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#6
RE: Sliding Shelf

It's working now Big Grin thanks for the help (all of you)!

[Image: quote_by_rueppells_fox-d9ciupp.png]
03-18-2013, 10:07 PM
Find




Users browsing this thread: 1 Guest(s)