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
Adny Offline
Posting Freak

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

I feel the current problem will be solved a lot quicker if I show you what I am using to get the rod machine to work properly. I'll try to explain exactly what needs to be in the script and what needs to be in the level editor; I'll also attach my script that works properly (which you have my permission to use Tongue)

First, I named my rods: rod_1, rod_2, and rod_3. The rods inside the machine (which are inactive) are named: rod_1_static, rod_2_static, and rod_3_static. The name of the machine where you put the rods is irrelevant. Make a script area that is roughly the same size as the rod machine, and make sure it is completely covering it. Click the "area" tab for the script area, and make 100% sure "ItemInteraction" is checked. Name the script area "InteractMachine". That concludes what you need for the level editor.

Note: This is the bare minimum script required to get this to properly function in the game; feel free to add particle and sound effects as you see necessary!

void OnStart()
{
SetLocalVarInt("RodVar", 0);
AddUseItemCallback("", "rod_1", "InteractMachine", "use_rod_1", true);
AddUseItemCallback("", "rod_2", "InteractMachine", "use_rod_2", true);
AddUseItemCallback("", "rod_3", "InteractMachine", "use_rod_3", true);

SetEntityInteractionDisabled("rod_1_static", true);
SetEntityInteractionDisabled("rod_2_static", true);
SetEntityInteractionDisabled("rod_3_static", true);
}

void use_rod_1(string &in asItem, string &in asEntity)
{
RemoveItem("rod_1");
SetEntityActive("rod_1_static", true);
AddLocalVarInt("RodVar", 1);
All3Rods();
}

void use_rod_2(string &in asItem, string &in asEntity)
{
RemoveItem("rod_2");
SetEntityActive("rod_2_static", true);
AddLocalVarInt("RodVar", 1);
All3Rods();
}

void use_rod_3(string &in asItem, string &in asEntity)
{
RemoveItem("rod_3");
SetEntityActive("rod_3_static", true);
AddLocalVarInt("RodVar", 1);
All3Rods();
}

void All3Rods()
{
if (GetLocalVarInt("RodVar") == 3)
{
PlayGuiSound("move_gate.snt", 1.0f); ///this function was to test if it actually worked
}
}



Hope that helped! This works 100% in game, just make sure you copied the script correctly and that all parts in the level editor have the correct names.

I rate it 3 memes.
06-20-2012, 01:20 AM
Find


Messages In This Thread
Rod Puzzle - by BrooksyFC - 06-12-2012, 03:14 PM
RE: Rod Puzzle - by FlawlessHappiness - 06-12-2012, 03:27 PM
RE: Rod Puzzle - by Putmalk - 06-13-2012, 11:18 PM
RE: Rod Puzzle - by BrooksyFC - 06-12-2012, 03:49 PM
RE: Rod Puzzle - by FlawlessHappiness - 06-12-2012, 04:09 PM
RE: Rod Puzzle - by BrooksyFC - 06-12-2012, 06:57 PM
RE: Rod Puzzle - by FlawlessHappiness - 06-12-2012, 07:17 PM
RE: Rod Puzzle - by Adny - 06-12-2012, 07:28 PM
RE: Rod Puzzle - by FlawlessHappiness - 06-12-2012, 07:55 PM
RE: Rod Puzzle - by BrooksyFC - 06-13-2012, 08:44 AM
RE: Rod Puzzle - by BrooksyFC - 06-13-2012, 08:47 PM
RE: Rod Puzzle - by FlawlessHappiness - 06-13-2012, 09:37 PM
RE: Rod Puzzle - by BrooksyFC - 06-13-2012, 09:59 PM
RE: Rod Puzzle - by Adny - 06-14-2012, 12:05 AM
RE: Rod Puzzle - by BrooksyFC - 06-16-2012, 11:56 AM
RE: Rod Puzzle - by FlawlessHappiness - 06-16-2012, 12:46 PM
RE: Rod Puzzle - by BrooksyFC - 06-16-2012, 01:42 PM
RE: Rod Puzzle - by BrooksyFC - 06-18-2012, 08:17 AM
RE: Rod Puzzle - by Dutton - 06-18-2012, 08:47 AM
RE: Rod Puzzle - by BrooksyFC - 06-18-2012, 09:54 AM
RE: Rod Puzzle - by Adny - 06-18-2012, 11:02 AM
RE: Rod Puzzle - by BrooksyFC - 06-18-2012, 11:58 AM
RE: Rod Puzzle - by Adny - 06-18-2012, 12:05 PM
RE: Rod Puzzle - by FlawlessHappiness - 06-18-2012, 03:58 PM
RE: Rod Puzzle - by BrooksyFC - 06-19-2012, 08:13 AM
RE: Rod Puzzle - by BrooksyFC - 06-19-2012, 11:20 PM
RE: Rod Puzzle - by Adny - 06-20-2012, 01:20 AM
RE: Rod Puzzle - by BrooksyFC - 06-20-2012, 08:27 AM
RE: Rod Puzzle - by BrooksyFC - 06-20-2012, 03:39 PM



Users browsing this thread: 1 Guest(s)