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
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#11
RE: Script help needed

You're still working on this? Here's my working version of it. All four sticky areas have the same detach and attach functions. The local map variable names have the names of the sticky areas. Study, modify, etc...

PHP Code: (Select All)
const string[] oven_sticky_areas = {"OvenArea_1""OvenArea_2""OvenArea_3""OvenArea_4"};
const 
string oven_object_name "oven_object";
const 
string oven_door_name "mansion_1";
const 
string oven_lever_name "lever_simple01_22";

void OnStart()
    {
        
SetEntityConnectionStateChangeCallback(oven_lever_name"CheckIngredients");
    }

////////////LEVER CHECK/////////////////
void CheckIngredients(string &in asEntityint alState)
    {
        if(
alState == 1)
        {
            if (
GetLocalVarInt(oven_sticky_areas[0]) == 1
             
&& GetLocalVarInt(oven_sticky_areas[1]) == 1
             
&& GetLocalVarInt(oven_sticky_areas[2]) == 1
             
&& GetLocalVarInt(oven_sticky_areas[3]) == 1)
            {
                
AddDebugMessage("OvenPuzzle: Correct!"false);
                
AddTimer("CompleteOvenPuzzle"1"CompleteOvenPuzzle");
            }

            else
            {
                
AddDebugMessage("OvenPuzzle: Wrong!"false);
                
SetMessage("Messages""IncorrectCombination"0);
            }
        }
    }

void AttachObjectOven(string &in asStickyAreastring &in asBodyName)
    {
        if (
StringContains(asBodyNameoven_object_name))
            
SetAllowStickyAreaAttachment(true);
        else
        {
            
SetAllowStickyAreaAttachment(false);
            return;
        }

        
AddDebugMessage(asStickyArea " " asBodyNametrue);

        
asBodyName StringSub(asBodyName0oven_object_name.length() + 2);
        
AddDebugMessage(asBodyNamefalse);

        if (
StringContains(asStickyArea"1") && StringContains(asBodyName"1"))
            
SetLocalVarInt(asStickyArea1);

        else if (
StringContains(asStickyArea"2") && StringContains(asBodyName"2"))
            
SetLocalVarInt(asStickyArea1);

        else if (
StringContains(asStickyArea"3") && StringContains(asBodyName"3"))
            
SetLocalVarInt(asStickyArea1);

        else if (
StringContains(asStickyArea"4") && StringContains(asBodyName"4"))
            
SetLocalVarInt(asStickyArea1);
    }

void DetachObjectOven(string &in asStickyAreastring &in asBodyName)
    {
        
SetLocalVarInt(asStickyArea0);
    }

void CompleteOvenPuzzle(string &in asTimer)
    {
        
SetSwingDoorLocked(oven_door_namefalsetrue);
        
SetMessage("Messages""correctcombinationchemicals"0);
    } 

Tutorials: From Noob to Pro
(This post was last modified: 09-19-2012, 07:23 PM by Your Computer.)
09-19-2012, 06:30 PM
Website 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)