Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a pipe puzzle
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#3
RE: Help with a pipe puzzle

(05-23-2011, 09:28 PM)Kyle Wrote: You use a local variable.

Try this:

void OnStart()
{
     AddUseItemCallback("GetOil", "pipe_piece_1", "PipeArea1", "PipeQuest1", false);
     AddUseItemCallback("GetOil", "pipe_piece_2", "PipeArea2", "PipeQuest2", false);
     AddUseItemCallback("GetOil", "pipe_piece_3", "PipeArea3", "PipeQuest3", false);
     SetLocalVarInt("Var01", 1);
}
void PipeQuestDone()
{
     [Do whatever you want to happen here]
}
void PipeQuest1(string &in asItem, string &in asEntity)
{
     if (GetLocalVarInt("Var01") == 1)
     {
          RemoveItem("pipe_piece_1");
          SetEntityActive("Pipe1", true);
          PlaySoundAtEntity("", "puzzle_place_jar.snt", "Player", 0, false);
          SetLocalVarInt("Var01", 2);
          return;
     }
     else
     {
          AddUseItemCallback("GetOil", "pipe_piece_1", "PipeArea1", "PipeQuest1", false);
     }
}
void PipeQuest2(string &in asItem, string &in asEntity)
{
     if (GetLocalVarInt("Var01") == 2)
     {
          RemoveItem("pipe_piece_2");
          SetEntityActive("Pipe2", true);
          PlaySoundAtEntity("", "puzzle_place_jar.snt", "Player", 0, false);
          SetLocalVarInt("Var01", 3);
          return;
     }
     else
     {
          AddUseItemCallback("GetOil", "pipe_piece_2", "PipeArea2", "PipeQuest2", false);
     }
}
void PipeQuest3(string &in asItem, string &in asEntity)
{
     if (GetLocalVarInt("Var01") == 3)
     {
          RemoveItem("pipe_piece_3");
          SetEntityActive("Pipe3", true);
          PlaySoundAtEntity("", "puzzle_place_jar.snt", "Player", 0, false);
          PipeQuestDone();
          return;
     }
     else
     {
          AddUseItemCallback("GetOil", "pipe_piece_3", "PipeArea3", "PipeQuest3", false);
     }
}

I think this should fix most of it. Smile

Thanks mate, i'll try when I get home, btw could you explain to me what that "SetLocalVarInt("Var01", 1);" or what the var01 does? I can just copy this but I'm not sure how it actually works Tongue

EDIT: Yep, works like a charm, still don't know how it works tho

(This post was last modified: 05-24-2011, 02:59 PM by Rownbear.)
05-24-2011, 02:03 PM
Find


Messages In This Thread
Help with a pipe puzzle - by Rownbear - 05-23-2011, 04:14 PM
RE: Help with a pipe puzzle - by Kyle - 05-23-2011, 09:28 PM
RE: Help with a pipe puzzle - by Rownbear - 05-24-2011, 02:03 PM
RE: Help with a pipe puzzle - by SLAMnesia - 06-07-2011, 04:26 PM
RE: Help with a pipe puzzle - by DannieWest - 06-08-2011, 01:19 PM
RE: Help with a pipe puzzle - by Rownbear - 06-26-2011, 01:30 AM
RE: Help with a pipe puzzle - by Kyle - 06-26-2011, 01:49 AM



Users browsing this thread: 1 Guest(s)