Rownbear
Member
Posts: 157
Threads: 13
Joined: Apr 2011
Reputation:
2
|
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.
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
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.)
|
|