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
How do i Move a Shelf with a script?
machosalad Offline
Junior Member

Posts: 38
Threads: 8
Joined: Oct 2010
Reputation: 0
#1
How do i Move a Shelf with a script?

i am trying to make a script that moves a tall shelf to reveal a secret passage. The entity of the shelf is "shelf_high01.ent" and the name of it is "SecretShelf1".

This is the script that runs:

void RevealSecretPassage(string &in asParent, string &in asChild, int alState)
{
    PlayMusic("Secret1.ogg", false, 1.0f, 0, 0, true);
    FadeLightTo("SecretPointLight1", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f);
    SetMoveObjectState("SecretShelf1", 1);
    CreateParticleSystemAtEntity("dust", "ps_dust_falling_door_quick", "SecretShelf1", false);
    PlaySoundAtEntity("", "scrape_rock", "SecretShelf1", 0, false);
    GiveSanityBoostSmall();
}

But the shelf never moves! The music plays, so i'm sure the function runs.
What am i doing wrong?
12-15-2010, 05:15 PM
Find
Oscar House Offline
Senior Member

Posts: 302
Threads: 3
Joined: Nov 2010
Reputation: 9
#2
RE: How do i Move a Shelf with a script?

Have you considered making two of those shelves, and when the function is called, it deactivates the closed shelf and activates the open shelf?
Something like

void RevealSecretPassage(string &in asParent, string &in asChild, int alState)
{
    PlayMusic("Secret1.ogg", false, 1.0f, 0, 0, true);
    FadeLightTo("SecretPointLight1", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f);
    SetEntityActive("SecretShelf1", false);
    SetEntityActive("SecretShelf2", true);
    CreateParticleSystemAtEntity("dust", "ps_dust_falling_door_quick", "SecretShelf1", false);
    PlaySoundAtEntity("", "scrape_rock", "SecretShelf1", 0, false);
    GiveSanityBoostSmall();
}

Unless you're supposed to see the shelf when it opens, for that I don't know the answer. Maybe it's supposed to be
SetMoveObjectState("SecretShelf1", true); ?

[Image: 2exldzm.png]
12-15-2010, 05:54 PM
Find
Andross Offline
Junior Member

Posts: 38
Threads: 1
Joined: Oct 2010
Reputation: 0
#3
RE: How do i Move a Shelf with a script?

You can't move random entities with the SetMoveObjectState() function; it only works on items specifically made to move in a certain way. In the Archives level, they use "shelf_secret_door.ent" to implement a secret passage behind a shelf.
12-22-2010, 07:27 PM
Find




Users browsing this thread: 1 Guest(s)