Frictional Games Forum (read-only)
Rod Puzzle - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Rod Puzzle (/thread-16078.html)

Pages: 1 2 3


RE: Rod Puzzle - Adny - 06-18-2012

(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.


RE: Rod Puzzle - BrooksyFC - 06-18-2012

No worrys Smile

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


RE: Rod Puzzle - Adny - 06-18-2012

(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)


RE: Rod Puzzle - FlawlessHappiness - 06-18-2012

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


RE: Rod Puzzle - BrooksyFC - 06-19-2012

(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.


RE: Rod Puzzle - BrooksyFC - 06-19-2012

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

}
}


RE: Rod Puzzle - Adny - 06-20-2012

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.


RE: Rod Puzzle - BrooksyFC - 06-20-2012

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.


RE: Rod Puzzle - BrooksyFC - 06-20-2012

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