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
On, Off Button
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#2
RE: On, Off Button

(03-02-2013, 03:57 AM)User01 Wrote: I need a little help. When I push the button, the lamp gets on. But when I push it again it will just stay on, insteadt off. What do I need to add/change?

PHP Code: (Select All)
void OnStart()
{
SetLocalVarInt("Var1"0);
SetEntityPlayerInteractCallback("button1""func1"false);
}


void func1(string &in asEntity)
{
AddLocalVarInt("Var1"1);
    
SetLampLit("bonfire1"truetrue);
    
PlaySoundAtEntity("""spot.snt""bonfire1"0.5ffalse);


Use this :
PHP Code: (Select All)
void OnStart()
{
SetEntityPlayerInteractCallback("button1""func1"false);
}


void func1(string &in asEntity)
{
    
SetLampLit("bonfire1"truetrue);
    
PlaySoundAtEntity("""spot.snt""bonfire1"0.5ffalse);
    
SetEntityPlayerInteractCallback("button1""func2"false);
}

void func2(string &in asEntity)
{
    
SetLampLit("bonfire1"falsetrue);
    
PlaySoundAtEntity("""///////YOUR SOUND////////""bonfire1"0.5ffalse);
    
SetEntityPlayerInteractCallback("button1""func1"false);


I changed the script to make it loop(When you press the button, it goes off. When you press it again, it goes on. And so on).

[Image: the-cabin-in-the-woods-masked-people.jpg]
(This post was last modified: 03-02-2013, 04:44 AM by No Author.)
03-02-2013, 04:43 AM
Find


Messages In This Thread
On, Off Button - by User01 - 03-02-2013, 03:57 AM
RE: On, Off Button - by No Author - 03-02-2013, 04:43 AM
RE: On, Off Button - by User01 - 03-02-2013, 04:50 AM
RE: On, Off Button - by No Author - 03-02-2013, 04:54 AM



Users browsing this thread: 1 Guest(s)