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
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#1
On, Off Button

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);

(This post was last modified: 03-23-2013, 02:07 AM by plutomaniac.)
03-02-2013, 03:57 AM
Find
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
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#3
RE: On, Off Button

Thank you Heart
03-02-2013, 04:50 AM
Find
No Author Offline
Posting Freak

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

Your are very welcomeSmile

[Image: the-cabin-in-the-woods-masked-people.jpg]
03-02-2013, 04:54 AM
Find




Users browsing this thread: 1 Guest(s)