Frictional Games Forum (read-only)

Full Version: Rod Puzzle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hey Guys,

I've been trying to a while now but I can't seem to get anything working on this script. Basically, the player needs to have 3 rods to put into a machine (well that object with the 3 rod holes) which will then enable the player to pull a lever to open a door.

I'm pretty sure it was used in the original game, but can someone help me with this script. Like if the player has all the rods, which they will, how do the rods go into the slots e.t.c

Thanks in advance
void OnStart()
{

AddUseItemCallback("", "Rod_1", "ScriptArea_1", "UseRod_1", true);
///Rod_1 = 1st rod ///ScriptArea_1 is around the first hole
AddUseItemCallback("", "Rod_2", "ScriptArea_2", "UseRod_2", true);
///Rod_2 = 2nd rod ///ScriptArea_2 is around the second hole
AddUseItemCallback("", "Rod_3", "ScriptArea_3", "UseRod_3", true);
///Rod_3 = 3rd rod ///ScriptArea_3 is around the third hole
}

void UseRod_1(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_1_Static", true); ///Place a static rod inside the hole inactive
RemoveItem("Rod_1); ///This will remove it from the inventory

AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt

if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3
{
///Do stuff when all 3 has been placed
}
}

void UseRod_2(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_2_Static", true);
RemoveItem("Rod_2);

AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt

if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3
{
///Do stuff when all 3 has been placed
}
}

void UseRod_3(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_3_Static", true);
RemoveItem("Rod_3);

AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt

if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3
{
///Do stuff when all 3 has been placed
}
}

Everything with red color should be deleted
Sweet. Thanks for the reply. I'll give it a try and post back on the results.
No problem Wink
I've put in that code, but I keep getting an error on the first line.

Say;s unexpected token for this line:

Code:
{
AddUseItemCallback("", "Rod_1", "ScriptArea_1", "UseRod_1", true);
///Rod_1 = 1st rod ///ScriptArea_1 is around the first hole
AddUseItemCallback("", "Rod_2", "ScriptArea_2", "UseRod_2", true);
///Rod_2 = 2nd rod ///ScriptArea_2 is around the second hole
AddUseItemCallback("", "Rod_3", "ScriptArea_3", "UseRod_3", true);
///Rod_3 = 3rd rod ///ScriptArea_3 is around the third hole
}


That first "{"
at the void OnStart() ?? Hm.. i dont know.... eh..
Got it, missing right quotation on Rod 1-3 in the RemoveItem area in each UseRod 1-3 function.


void UseRod_1(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_1_Static", true); ///Place a static rod inside the hole inactive
RemoveItem("Rod_1); ///This will remove it from the inventory

should be

RemoveItem("Rod_1");


Do that for all 3 rod scripts.
Woops.. My bad Wink
(06-12-2012, 07:28 PM)andyrockin123 Wrote: [ -> ]Got it, missing right quotation on Rod 1-3 in the RemoveItem area in each UseRod 1-3 function.


void UseRod_1(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_1_Static", true); ///Place a static rod inside the hole inactive
RemoveItem("Rod_1); ///This will remove it from the inventory

should be

RemoveItem("Rod_1");


Do that for all 3 rod scripts.
Nice one, I'll give that a try after work and see if that works Smile
Right, I've done that, it all works. But I can't seem to put the rods in the holes of the machine.
Pages: 1 2 3