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
Turn on/off
eliasfrost Offline
Posting Freak

Posts: 1,769
Threads: 34
Joined: Mar 2007
Reputation: 39
#4
RE: Turn on/off

I've run into another problem, when I use the entity, it runs the script just like it should, but I can't interact with it again? What I want to do is to be able to switch song by clicking the radio, but I can only interact with it once. Here's my script, I thought the SetEntityInteractionDisabled("Radio_1", false); and ResetProp("Radio_1"); would fix this, but it didn't. >.<

Here's the code so far:

void OnStart()
{
    SetLocalVarInt("radio", 0);
    SetEntityPlayerInteractCallback("Radio_1", "func1", true);
}

void func1(string &in asEntity)
{
    if(GetLocalVarInt("radio") >= 0)
    {
        AddLocalVarInt("radio", 1);
        StopMusic(2, 1);
        playmusic();
    }
    SetEntityInteractionDisabled("Radio_1", false);
        ResetProp("Radio_1");
}

void playmusic()
{
    if(GetLocalVarInt("radio") == 0)
    {
        StopMusic(2, 1);
    }

    if(GetLocalVarInt("radio") == 1)
    {
        StopMusic(2, 1);
        PlayMusic("1.ogg", true, 1, 2, 1, false);
    }

    if(GetLocalVarInt("radio") == 2)
    {
        StopMusic(2, 1);
        PlayMusic("2.ogg", true, 1, 2, 1, false);
    }

    if(GetLocalVarInt("radio") == 3)
    {
        StopMusic(2, 1);
        PlayMusic("3.ogg", true, 1, 2, 1, false);
    }

    if(GetLocalVarInt("radio") == 4)
    {
        StopMusic(2, 1);
        PlayMusic("4.ogg", true, 1, 2, 1, false);
    }

    if(GetLocalVarInt("radio") == 5)
    {
        StopMusic(2, 1);
        PlayMusic("5.ogg", true, 1, 2, 1, false);
    }
}

[Image: indiedb_88x31.png]
10-18-2011, 07:16 PM
Find


Messages In This Thread
Turn on/off - by eliasfrost - 10-18-2011, 11:46 AM
RE: Turn on/off - by Tanshaydar - 10-18-2011, 11:50 AM
RE: Turn on/off - by eliasfrost - 10-18-2011, 11:52 AM
RE: Turn on/off - by eliasfrost - 10-18-2011, 07:16 PM
RE: Turn on/off - by Your Computer - 10-18-2011, 07:31 PM
RE: Turn on/off - by eliasfrost - 10-18-2011, 07:35 PM



Users browsing this thread: 1 Guest(s)