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
#21
RE: Rod Puzzle

(06-18-2012, 09:54 AM)BrooksyFC Wrote: Yeah I've checked that and I can still pick it up, like when I put it in, it is still glowing like it's still active.
Sorry. my original post wasn't 100% accurate. Considering there are hundreds of entities, it is possible they don't all act the exact same way when different effects are applied Big Grin this should fix your problem:

SetEntityInteractionDisabled(string& asName, bool abDisabled);


string &in asName = name of the rod in the machine

bool abDisabled = putting "false" will disallow interaction with the rods entirely.

I rate it 3 memes.
06-18-2012, 11:02 AM
Find
BrooksyFC Offline
Senior Member

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

No worrys Smile

So where would I put that script? Would it go under "Removeitem"

Think A Little, Change A Lot
06-18-2012, 11:58 AM
Find
Adny Offline
Posting Freak

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

(06-18-2012, 11:58 AM)BrooksyFC Wrote: No worrys Smile

So where would I put that script? Would it go under "Removeitem"
It literally doesn't matter so long as its in a function that's called prior to the rod puzzle. Personally I would try to put it in the function that is most relevant to it, but it can go in many other places (i.e. OnStart or OnEnter)

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

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

Im sorry i didn't have the editor in front of me.. I thought there was a static version of the rod.. my bad!

Trying is the first step to success.
06-18-2012, 03:58 PM
Find
BrooksyFC Offline
Senior Member

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

(06-18-2012, 11:02 AM)andyrockin123 Wrote:
(06-18-2012, 09:54 AM)BrooksyFC Wrote: Yeah I've checked that and I can still pick it up, like when I put it in, it is still glowing like it's still active.
Sorry. my original post wasn't 100% accurate. Considering there are hundreds of entities, it is possible they don't all act the exact same way when different effects are applied Big Grin this should fix your problem:

SetEntityInteractionDisabled(string& asName, bool abDisabled);


string &in asName = name of the rod in the machine

bool abDisabled = putting "false" will disallow interaction with the rods entirely.


OK I'll give that a go, I'll post back later on today.

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

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

This is code I've got at the mo, I've added that bit of code to stop interaction with the rods , but it doesn't work still. Can you show me where I have gone wrong?


void UseRod_1(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_1_Static", true);
RemoveItem("Rod_1");
SetEntityInteractionDisabled("Rod_1", false);

AddLocalVarInt("3_Rods", 1);

if(GetLocalVarInt("3_Rods") == 3)
{

}
}

Think A Little, Change A Lot
(This post was last modified: 06-19-2012, 11:25 PM by BrooksyFC.)
06-19-2012, 11:20 PM
Find
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
BrooksyFC Offline
Senior Member

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

This is perfect, thanks very much Smile I've already got a script where you pull a lever and a door opens, so how do I make the lever work so it works when all the rods are in place it is usable.

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

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

Do I need to deactivate the lever I have at the moment so that it is active after the rods are in place it will be active be. Cause I know you can have it so that the lever can be pulled down, but not too anything till the puzzle is done.

Like enter a script here:

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


This is the last question I promise Wink

Think A Little, Change A Lot
06-20-2012, 03:39 PM
Find




Users browsing this thread: 1 Guest(s)