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
Problem with lever & mixture
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#9
RE: Problem with lever & mixture

I got it. I apologize for leaving you last night >> I was modeling my angel and forgot... BUT, I came up with a script during school. Let me type it up and I'll be right back! It stops the lever from doing anything, displays a message when only one substance is added, and runs the effect when they are both added.


This is quite a bit, but I gave info for each function. Change capitalized strings to your needs:


void OnStart()
{
SetLocalVarInt("mixtures", 0); //Creates a "bank" for the lever.
AddUseItemCallback("", "NITROGLYCERIN", "BOXAREA", "Nitrofunc", true); //Using Nitroglycerine on the machine
AddUseItemCallback("", "UNFIN_MIX", "MIXAREA", "UnFinfunc", true); //Using Unfinished Mix on the machine
SetEntityConnectionStateChangeCallback("LEVER", "Leverfunc"); //Lever function
}

void Nitrofunc(string &in asItem, string &in asEntity)
{
AddLocalVarInt("mixtures", 1); //Adds 1 to the "bank" when Nitroglyc is used on the area.
SetEntityActive("NITROGLYC_STATIC", true); //activates the Nit. prop
PlaySoundAtEntity("", "pick_glass.snt", "BOXAREA", 0, true); //sound for placement
}

void UnFinfunc(string &in asItem, string &in asEntity)
{
AddLocalVarInt("mixtures", 1); //Adds 1 to the "bank" when Unfinished Mixture is used on the area.
SetEntityActive("UNFINMIX_STATIC", true); //activates the Unfin mix prop
PlaySoundAtEntity("", "pick_glass.snt", "MIXAREA", 0, true); //sound for placement
}

void Leverfunc(string &in asEntity, int alState)
{
if(alState == -1)
{
//Pulls lever in wrong direction. Leave blank for no effect
}

if(alState == 1)
{
GetLocalVarInt("mixtures"); //Checks "bank" when pulled.
{
if(GetLocalVarInt("mixtures") == 0) //if bank has 0 in it:
{
//Left blank for no function when machine is empty of substances
}
if(GetLocalVarInt("mixtures") == 1) //if bank has 1 in it:
{
SetMessage("CATEGORYNAME", "ENTRYNAME", 4); //Displays message for 4 seconds. OPTIONAL
}
if(GetLocalVarInt("mixtures") == 2) //if bank has 2 in it:
{
SetEntityActive("NITROGLYC_STATIC", false); //disables Nitroglyc prop
SetEntityActive("UNFINMIX_STATIC", false); //disables Unfinished Mix prop
SetEntityActive("FINISHEDMIX", true); //gives the finished mixture
GiveSanityBoost(); //Puzzle-complete effect
SetLeverStuckState("LEVER", 1, true); //Sets the lever locked so player can't use it again.
}
}
}
}


I have not tested this yet, so please let me know how everything works out... This was fun to create.

Also, for the message, I suggest saying something like "I need something else..." It's not necessary, but there if you're interested =]
(This post was last modified: 01-11-2012, 09:27 PM by Statyk.)
01-11-2012, 08:56 PM
Find


Messages In This Thread
Problem with lever & mixture - by Shadowfied - 01-11-2012, 01:36 AM
RE: Problem with lever & mixture - by Statyk - 01-11-2012, 02:02 AM
RE: Problem with lever & mixture - by Shadowfied - 01-11-2012, 02:04 AM
RE: Problem with lever & mixture - by Statyk - 01-11-2012, 02:47 AM
RE: Problem with lever & mixture - by Shadowfied - 01-11-2012, 02:50 AM
RE: Problem with lever & mixture - by Statyk - 01-11-2012, 02:55 AM
RE: Problem with lever & mixture - by Shadowfied - 01-11-2012, 09:39 AM
RE: Problem with lever & mixture - by Shadowfied - 01-11-2012, 12:08 PM
RE: Problem with lever & mixture - by Statyk - 01-11-2012, 08:56 PM
RE: Problem with lever & mixture - by Shadowfied - 01-11-2012, 10:56 PM
RE: Problem with lever & mixture - by Statyk - 01-11-2012, 11:05 PM
RE: Problem with lever & mixture - by Shadowfied - 01-11-2012, 11:07 PM
RE: Problem with lever & mixture - by Statyk - 01-11-2012, 11:08 PM



Users browsing this thread: 1 Guest(s)