Frictional Games Forum (read-only)

Full Version: Script help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

So I've been working on a custom model which opens and closes through the script. (Objectstate 1 = closed) But it doesn't seem to work for me. It closes but it doesn't open up again. Could you take a look at it?

Code:
void OnStart()
{
    SetLocalVarInt("bed_1", 1);
}

void bed_move(string &in asEntity)
{
    if(GetLocalVarInt("bed_1")==0)
    {
    thing1();
    }
    if(GetLocalVarInt("bed_1")==1)
    {
    thing2();
    }
}

void thing1()
{
    SetMoveObjectState("futuristic_bed_1", 0);
    AddLocalVarInt("bed_1", 1);
}

void thing2()
{
    SetMoveObjectState("futuristic_bed_1", 1);
    AddLocalVarInt("bed_1", -1);
}

Oh, the interaction callback goes through the editor.
Have you tried using else if for the second if statement? That should prevent it from closing immediately after opening.
worked, thanks!