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
Rod Puzzle
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#1
Rod Puzzle

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

Think A Little, Change A Lot
(This post was last modified: 06-12-2012, 03:26 PM by BrooksyFC.)
06-12-2012, 03:14 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Rod Puzzle

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

Trying is the first step to success.
(This post was last modified: 06-12-2012, 03:29 PM by FlawlessHappiness.)
06-12-2012, 03:27 PM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#3
RE: Rod Puzzle

Sweet. Thanks for the reply. I'll give it a try and post back on the results.

Think A Little, Change A Lot
06-12-2012, 03:49 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Rod Puzzle

No problem Wink

Trying is the first step to success.
06-12-2012, 04:09 PM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#5
RE: Rod Puzzle

I've put in that code, but I keep getting an error on the first line.

Say;s unexpected token for this line:

{
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 "{"

Think A Little, Change A Lot
06-12-2012, 06:57 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Rod Puzzle

at the void OnStart() ?? Hm.. i dont know.... eh..

Trying is the first step to success.
06-12-2012, 07:17 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#7
RE: Rod Puzzle

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.

I rate it 3 memes.
06-12-2012, 07:28 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: Rod Puzzle

Woops.. My bad Wink

Trying is the first step to success.
06-12-2012, 07:55 PM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#9
RE: Rod Puzzle

(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

Think A Little, Change A Lot
06-13-2012, 08:44 AM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#10
RE: Rod Puzzle

Right, I've done that, it all works. But I can't seem to put the rods in the holes of the machine.

Think A Little, Change A Lot
06-13-2012, 08:47 PM
Find




Users browsing this thread: 2 Guest(s)