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
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#1
Script help

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?

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.
07-15-2013, 08:11 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Script help

Have you tried using else if for the second if statement? That should prevent it from closing immediately after opening.

Tutorials: From Noob to Pro
(This post was last modified: 07-15-2013, 08:49 PM by Your Computer.)
07-15-2013, 08:49 PM
Website Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#3
RE: Script help

worked, thanks!
07-15-2013, 09:13 PM
Find




Users browsing this thread: 1 Guest(s)