Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
puzzle help needed
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#1
puzzle help needed

okay so i have four extaction ovens where you have to put an object inside I would like to make it so if you put the "object" inside the area that I've put in the oven The object self goes inactive and an other "object" goes actvive so it looks like you put it in the,
but I go to the problem I want to make it that you have to put four diffrent objects inside. so if you hav just on and yoyupull the lever you will see a messag in the screen "you don't have enough ingredients" but if you pull it when all the objects are inside but not at the correct place it says liek incorrect combination and if you have it int he right order it will just work.
But I can't really figure out how to make it so thta it only works if its the right combination. Huh

Edit: also if there is a way to make and if statement with an active object than I think I could handle it myself :/

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 09-08-2012, 01:02 PM by Steve.)
09-08-2012, 12:19 PM
Find
Theforgot3n1 Offline
Member

Posts: 192
Threads: 20
Joined: Apr 2012
Reputation: 6
#2
RE: puzzle help needed

Look around inside "Machine Room" (original amnesia map) and analyze it's coal system. Try to replicate it to the best of your ability, and only if you're completely out of ideas, should you post for help. I'm sensing you just want the script done, since usually, people give us at least an overview of their own attempts scripting their puzzle.

Confusion: a Custom Story - Ch1 for play!
http://www.frictionalgames.com/forum/thread-15477.html
About 50% built.
Delayed for now though!
09-08-2012, 01:45 PM
Website Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#3
RE: puzzle help needed

well yes I tried to anylyse the map Machine Room but I couldn't reaaly figure it out so I asked for soem advice :\
and if else just taking over the code from the original doens't really help you to learn how to do this in the future...

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 09-08-2012, 05:01 PM by Steve.)
09-08-2012, 05:00 PM
Find
Dutton Offline
Member

Posts: 121
Threads: 3
Joined: Apr 2012
Reputation: 2
#4
RE: puzzle help needed

I wish i had the time to test this myself, I think it could be done with Local Variable, and If statements.

If the item is the correct one after the first that entered. it would add 1 to a Local Variable.
If the current number of items is not 4 it will display the message.

i really would like to work on it. but i don't have the time for it pt.

[Image: 15isy6C]
09-08-2012, 05:07 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#5
RE: puzzle help needed

yeah if there was a way to use the if function to check if there is an entity active I think I know how I can do it but I have no idea if it is possible to do that.

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
09-08-2012, 05:28 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: puzzle help needed

There is.... Ok i will give it a try... give me a couple of minutes...

EDIT: OK I'm done.

Ok so assuming that you already know how to display messages, then here is the script.
Tell me if you need explanation.

I did not make the "Not enough ingredients"-part. Instead it just says "Incorrect combination". Because that is technically also an incorrect combination.

object_1 = first object
object_2 = second object
object_3 = third object
object_4 = fourth object

Lever_1 = lever. Pull it UP to trigger function

AreaOven_1 = A script area in first oven. It has "ItemInteraction" checked
AreaOven_2 = A script area in second oven. It has "ItemInteraction" checked
AreaOven_3 = A script area in third oven. It has "ItemInteraction" checked
AreaOven_4 = A script area in fourth oven. It has "ItemInteraction" checked
Spoiler below!


That took some time

void OnStart()
{

SetLocalVarInt("oven_1_correct", 0);
SetLocalVarInt("oven_2_correct", 0);
SetLocalVarInt("oven_3_correct", 0);
SetLocalVarInt("oven_4_correct", 0);
SetLocalVarInt("All_4_Correct", 0);

for(int p=1;p<5;p++)AddUseItemCallback("", "object_"+p, "AreaOven_1", "PutObjectOven_1", false, 0);
for(int p=1;p<5;p++)AddUseItemCallback("", "object_"+p, "AreaOven_2", "PutObjectOven_2", false, 0);
for(int p=1;p<5;p++)AddUseItemCallback("", "object_"+p, "AreaOven_3", "PutObjectOven_3", false, 0);
for(int p=1;p<5;p++)AddUseItemCallback("", "object_"+p, "AreaOven_4", "PutObjectOven_4", false, 0);

SetEntityConnectionStateChangeCallback("Lever_1", "CheckIngredients");
}

////////////LEVER CHECK/////////////////

void CheckIngredients(string &in asEntity, int alState)
{
if(alState == 1)
{
//OVEN 1//
if(GetLocalVarInt("oven_1_correct") == 1)
{
AddLocalVarInt("All_4_Correct", 1);
}

if(GetLocalVarInt("oven_1_correct") == 0)
{
SetMessage("Messages", "IncorrectCombination", 0);
AddTimer("Redo_timer", 1, "Redo_timer");
return;
}

//OVEN 2//

if(GetLocalVarInt("oven_2_correct") == 1)
{
AddLocalVarInt("All_4_Correct", 1);
}

if(GetLocalVarInt("oven_2_correct") == 0)
{
SetMessage("Messages", "IncorrectCombination", 0);
AddTimer("Redo_timer", 1, "Redo_timer");
return;
}

//OVEN 3//

if(GetLocalVarInt("oven_3_correct") == 1)
{
AddLocalVarInt("All_4_Correct", 1);
}

if(GetLocalVarInt("oven_3_correct") == 0)
{
SetMessage("Messages", "IncorrectCombination", 0);
AddTimer("Redo_timer", 1, "Redo_timer");
return;
}

//OVEN 4//

if(GetLocalVarInt("oven_4_correct") == 1)
{
AddLocalVarInt("All_4_Correct", 1);
}

if(GetLocalVarInt("oven_4_correct") == 0)
{
SetMessage("Messages", "IncorrectCombination", 0);
AddTimer("Redo_timer", 1, "Redo_timer");
return;
}

if(GetLocalVarInt("All_4_Correct") > 4) //NOT COMPLETELY SURE ABOUT THAT SYMBOL: >
{
SetMessage("Messages", "IncorrectCombination", 0);
AddTimer("Redo_timer", 1, "Redo_timer");
}

if(GetLocalVarInt("All_4_Correct" == 4)
{
AddTimer("INSERT_FUNCTION_HERE", 1, "INSERT_FUNCTION_HERE");
}
}

////////////REDO TIMER//////////////////

void Redo_timer(string &in asTimer)
{
SetLocalVarInt("oven_1_correct", 0);
SetLocalVarInt("oven_2_correct", 0);
SetLocalVarInt("oven_3_correct", 0);
SetLocalVarInt("oven_4_correct", 0);
SetLocalVarInt("All_4_Correct", 0);

for(int p=1;p<5;p++)SetEntityActive("object_1_oven_"+p, false);
for(int p=1;p<5;p++)SetEntityActive("object_2_oven_"+p, false);
for(int p=1;p<5;p++)SetEntityActive("object_3_oven_"+p, false);
for(int p=1;p<5;p++)SetEntityActive("object_4_oven_"+p, false);

SetEntityActive("AreaOven_1", true);
SetEntityActive("AreaOven_2", true);
SetEntityActive("AreaOven_3", true);
SetEntityActive("AreaOven_4", true);

RemoveItem("object_1");
RemoveItem("object_2");
RemoveItem("object_3");
RemoveItem("object_4");

GiveItem("object_1", "Puzzle", "object_1", "object_1.tga", 1);
GiveItem("object_2", "Puzzle", "object_2", "object_2.tga", 1);
GiveItem("object_3", "Puzzle", "object_3", "object_3.tga", 1);
GiveItem("object_4", "Puzzle", "object_4", "object_4.tga", 1);
}

////////////OVEN 1//////////////////////

void PutObjectOven_1(string &in asItem, string &in asEntity)
{
if(asItem == "object_1")
{
RemoveItem("object_1");
SetEntityActive("object_1_oven_1", true);
SetLocalVarInt("oven_1_correct", 1);
SetEntityActive("AreaOven_1", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_2")
{
RemoveItem("object_2");
SetEntityActive("object_2_oven_1", true);
SetLocalVarInt("oven_1_correct", 0);
SetEntityActive("AreaOven_1", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_3")
{
RemoveItem("object_3");
SetEntityActive("object_3_oven_1", true);
SetLocalVarInt("oven_1_correct", 0);
SetEntityActive("AreaOven_1", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == object_4)
{
RemoveItem("object_4");
SetEntityActive("object_4_oven_1", true);
SetLocalVarInt("oven_1_correct", 0);
SetEntityActive("AreaOven_1", false);
AddLocalVarInt("4_Items", 1);
}
}

//////////OVEN 2////////////////////

void PutObjectOven_2(string &in asItem, string &in asEntity)
{
if(asItem == "object_1")
{
RemoveItem("object_1");
SetEntityActive("object_1_oven_2", true);
SetLocalVarInt("oven_2_correct", 0);
SetEntityActive("AreaOven_2", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_2")
{
RemoveItem("object_2");
SetEntityActive("object_2_oven_2", true);
SetLocalVarInt("oven_2_correct", 1);
SetEntityActive("AreaOven_2", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_3")
{
RemoveItem("object_3");
SetEntityActive("object_3_oven_2", true);
SetLocalVarInt("oven_2_correct", 0);
SetEntityActive("AreaOven_2", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == object_4)
{
RemoveItem("object_4");
SetEntityActive("object_4_oven_2", true);
SetLocalVarInt("oven_2_correct", 0);
SetEntityActive("AreaOven_2", false);
AddLocalVarInt("4_Items", 1);
}
}

///////////OVEN 3///////////////////

void PutObjectOven_3(string &in asItem, string &in asEntity)
{
if(asItem == "object_1")
{
RemoveItem("object_1");
SetEntityActive("object_1_oven_3", true);
SetLocalVarInt("oven_3_correct", 0);
SetEntityActive("AreaOven_3", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_2")
{
RemoveItem("object_2");
SetEntityActive("object_2_oven_3", true);
SetLocalVarInt("oven_3_correct", 0);
SetEntityActive("AreaOven_3", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_3")
{
RemoveItem("object_3");
SetEntityActive("object_3_oven_3", true);
SetLocalVarInt("oven_3_correct", 1);
SetEntityActive("AreaOven_3", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == object_4)
{
RemoveItem("object_4");
SetEntityActive("object_4_oven_3", true);
SetLocalVarInt("oven_3_correct", 0);
SetEntityActive("AreaOven_3", false);
AddLocalVarInt("4_Items", 1);
}
}

///////////////OVEN 4////////////////////

void PutObjectOven_4(string &in asItem, string &in asEntity)
{
if(asItem == "object_1")
{
RemoveItem("object_1");
SetEntityActive("object_1_oven_4", true);
SetLocalVarInt("oven_4_correct", 0);
SetEntityActive("AreaOven_4", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_2")
{
RemoveItem("object_2");
SetEntityActive("object_2_oven_4", true);
SetLocalVarInt("oven_4_correct", 0);
SetEntityActive("AreaOven_4", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == "object_3")
{
RemoveItem("object_3");
SetEntityActive("object_3_oven_4", true);
SetLocalVarInt("oven_4_correct", 0);
SetEntityActive("AreaOven_4", false);
AddLocalVarInt("4_Items", 1);
}

if(asItem == object_4)
{
RemoveItem("object_4");
SetEntityActive("object_4_oven_4", true);
SetLocalVarInt("oven_4_correct", 0);
SetEntityActive("AreaOven_4", false);
AddLocalVarInt("4_Items", 1);
}
}



Trying is the first step to success.
(This post was last modified: 09-08-2012, 06:12 PM by FlawlessHappiness.)
09-08-2012, 05:34 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#7
RE: puzzle help needed

thanks a ton beecake Big Grin
I will look at it in detail later, but at first glance i saw giveitem the puzzle is with drag objects, I might be wrong and it's just for drag objects. if so my bad.
thanks anyway

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
09-08-2012, 06:37 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: puzzle help needed

(09-08-2012, 06:37 PM)Steve Wrote: thanks a ton beecake Big Grin
I will look at it in detail later, but at first glance i saw giveitem the puzzle is with drag objects, I might be wrong and it's just for drag objects. if so my bad.
thanks anyway
The puzzle is with items in your inventory Wink

Trying is the first step to success.
09-08-2012, 06:39 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#9
RE: puzzle help needed

(09-08-2012, 06:39 PM)beecake Wrote:
(09-08-2012, 06:37 PM)Steve Wrote: thanks a ton beecake Big Grin
I will look at it in detail later, but at first glance i saw giveitem the puzzle is with drag objects, I might be wrong and it's just for drag objects. if so my bad.
thanks anyway
The puzzle is with items in your inventory Wink
yeah I thought so I will look if I can modify the code so it will work for drag objects(if possible) or else if have to make the item pick ubject that will aken a time or find another way Smile
and could you tell me how an if entity active code looks like? just a question it could be usefull Big Grin

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 09-08-2012, 06:44 PM by Steve.)
09-08-2012, 06:41 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: puzzle help needed

How it works with a drag-able object?

Trying is the first step to success.
(This post was last modified: 09-08-2012, 06:51 PM by FlawlessHappiness.)
09-08-2012, 06:47 PM
Find




Users browsing this thread: 1 Guest(s)