The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Script Help Script help needed
Steve Offline
Member

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

Okay I've come here today with another question.
I have this script wich works like this:
when I put four different object in the righ "place" and I pull lever_1 it should complete the puzzle.
but when I should have completedf the puzzle it doesn't work and it still says incorrect combination.
this is the script:
Spoiler below!

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++)AddEntityCollideCallback("object_"+p, "AreaOven_1", "PutObjectOven_1", false, 0);
for(int p=1;p<5;p++)AddEntityCollideCallback("object_"+p, "AreaOven_2", "PutObjectOven_2", false, 0);
for(int p=1;p<5;p++)AddEntityCollideCallback("object_"+p, "AreaOven_3", "PutObjectOven_3", false, 0);
for(int p=1;p<5;p++)AddEntityCollideCallback("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);
return;
}

//OVEN 2//
if(GetLocalVarInt("oven_2_correct") == 1)
{
AddLocalVarInt("All_4_Correct", 1);
}
if(GetLocalVarInt("oven_2_correct") == 0)
{
SetMessage("Messages", "IncorrectCombination", 0);
return;
}
//OVEN 3//
if(GetLocalVarInt("oven_3_correct") == 1)
{
AddLocalVarInt("All_4_Correct", 1);
}
if(GetLocalVarInt("oven_3_correct") == 0)
{
SetMessage("Messages", "IncorrectCombination", 0);
return;
}
//OVEN 4//
if(GetLocalVarInt("oven_4_correct") == 1)
{
AddLocalVarInt("All_4_Correct", 1);
}
if(GetLocalVarInt("oven_4_correct") == 0)
{
SetMessage("Messages", "IncorrectCombination", 0);
return;
}
if(GetLocalVarInt("All_4_Correct") == 4)
{
AddTimer("youdidit", 1, "completedpuzzle");
}
}
}

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

void PutObjectOven_1(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_1_correct", 1);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_1_correct", 0);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_1_correct", 0);
AddLocalVarInt("4_Items", 1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_1_correct", 0);
AddLocalVarInt("4_Items", 1);
}
}
if(alState == -1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_1_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_1_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_1_correct", 0);
AddLocalVarInt("4_Items", -1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_1_correct", 0);
AddLocalVarInt("4_Items", -1);
}
}
}

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

void PutObjectOven_2(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_2_correct", 0);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_2_correct", 1);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_2_correct", 0);
AddLocalVarInt("4_Items", 1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_2_correct", 0);
AddLocalVarInt("4_Items", 1);
}
}
if(alState == -1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_2_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_2_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_2_correct", 0);
AddLocalVarInt("4_Items", -1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_2_correct", 0);
AddLocalVarInt("4_Items", -1);
}
}
}

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

void PutObjectOven_3(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_3_correct", 0);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_3_correct", 0);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_3_correct", 1);
AddLocalVarInt("4_Items", 1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_3_correct", 0);
AddLocalVarInt("4_Items", 1);
}
}
if(alState == -1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_3_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_3_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_3_correct", 0);
AddLocalVarInt("4_Items", -1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_3_correct", 0);
AddLocalVarInt("4_Items", -1);
}
}
}

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

void PutObjectOven_4(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_4_correct", 0);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_4_correct", 0);
AddLocalVarInt("4_Items", 1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_4_correct", 0);
AddLocalVarInt("4_Items", 1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_4_correct", 1);
AddLocalVarInt("4_Items", 1);
}
}
if(alState == -1)
{
if(asChild == "object_1")
{
AddLocalVarInt("oven_4_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_2")
{
AddLocalVarInt("oven_44_correct", 0);
AddLocalVarInt("4_Items", -1);
}
if(asChild == "object_3")
{
AddLocalVarInt("oven_4_correct", 0);
AddLocalVarInt("4_Items", -1);
}

if(asChild == "object_4")
{
AddLocalVarInt("oven_4_correct", 0);
AddLocalVarInt("4_Items", -1);
}
}
}

void completedpuzzle(string& asTimer)
{
SetSwingDoorLocked("extaction_oven_6", false, true);
SetMessage("Messages", "correctcombinationchemicals", 0);
}

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
09-11-2012, 03:35 PM
Find


Messages In This Thread
Script help needed - by Steve - 09-11-2012, 03:35 PM
RE: Script help needed - by Tomato Cat - 09-11-2012, 06:02 PM
RE: Script help needed - by Steve - 09-11-2012, 06:46 PM
RE: Script help needed - by Tomato Cat - 09-11-2012, 10:24 PM
RE: Script help needed - by Steve - 09-12-2012, 07:35 AM
RE: Script help needed - by Your Computer - 09-12-2012, 02:11 PM
RE: Script help needed - by FlawlessHappiness - 09-12-2012, 02:21 PM
RE: Script help needed - by Steve - 09-16-2012, 09:18 PM
RE: Script help needed - by FlawlessHappiness - 09-16-2012, 09:29 PM
RE: Script help needed - by Steve - 09-19-2012, 05:32 PM
RE: Script help needed - by Your Computer - 09-19-2012, 06:30 PM
RE: Script help needed - by Steve - 09-19-2012, 08:29 PM
RE: Script help needed - by FlawlessHappiness - 09-19-2012, 06:38 PM
RE: Script help needed - by Your Computer - 09-19-2012, 08:38 PM
RE: Script help needed - by Steve - 09-19-2012, 08:51 PM
RE: Script help needed - by Steve - 10-04-2012, 03:46 PM
RE: Script help needed - by Steve - 10-05-2012, 04:55 PM
RE: Script help needed - by Robby - 10-05-2012, 05:48 PM
RE: Script help needed - by The chaser - 10-05-2012, 08:33 PM
RE: Script help needed - by Steve - 10-06-2012, 08:02 PM
RE: Script help needed - by The chaser - 10-06-2012, 08:32 PM
RE: Script help needed - by Steve - 10-06-2012, 09:37 PM
RE: Script help needed - by Robby - 10-06-2012, 08:02 PM
RE: Script help needed - by Your Computer - 10-06-2012, 08:37 PM
RE: Script help needed - by Robby - 10-06-2012, 08:45 PM
RE: Script help needed - by Steve - 10-08-2012, 03:23 PM



Users browsing this thread: 1 Guest(s)