Frictional Games Forum (read-only)
[SCRIPT] [SOLVED] Levers - 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: [SCRIPT] [SOLVED] Levers (/thread-26898.html)

Pages: 1 2


[SOLVED] Levers - Straxedix - 10-18-2014

Hi i saw in some Fcm-s,Cs-s...When you pull the lever lights turn off or on so if can someone explain me that how to make it.I never did something like that before :P


RE: Levers - FlawlessHappiness - 10-18-2014

Levers work, with the thing called "alState".

This is the callback for a lever, placed in void OnStart() (For beginners)

PHP Code:
SetEntityConnectionStateChangeCallback(stringasNamestringasCallback); 

The function will look like this:

PHP Code:
void Func(string &in asEntityint alState
{
if(
alState == 1)
{
//If ON
}

if(
alState == -1)
{
//If OFF
}


Simply put in SetLampLit when ON and OFF, and put in false and true, for whatever your liking ^^


RE: Levers - Straxedix - 10-18-2014

string& asName ? name of lever ?

Cause i wanna shut down Light (spot light) and entity...


RE: Levers - FlawlessHappiness - 10-18-2014

It's a simple callback.
Just like with a collide callback.

Try using logic here.

In a collide callback you have object A colliding with object B, creating a FUNCTION.

So what happens in the lever callbacK?
It's simply a lever that calls a FUNCTION.

Meaning, string &in asName == The name of the lever, yep.


RE: Levers - Straxedix - 10-18-2014

Uhm no not working

Spoiler below!
PHP Code:
void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever00""Lever");
}

void Lever(string &in asEntityint alState
{
if(
alState == 1)
{
//If ON
}

if(
alState == -1)
{
//If OFF
}



EDIT:Could you explain a little i am doing that kinda script for the first time :I


RE: Levers - Straxedix - 10-18-2014

Bump ?


RE: Levers - Straxedix - 10-18-2014

Bump :3


RE: Levers - Slanderous - 10-18-2014

PHP Code:
void Func(string &in asEntityint alState
{
if(
alState == 1)
{
//If ON
}

if(
alState == -1)
{
//If OFF


Those two little bastards allow you to do what happens whether you pull them up or down, I beleive 1 is if you pull lever up, so basically put the stuff you want to happen in the state 1, if neither that helps try putting the stuff to -1 instead of 1.


RE: Levers - 7heDubz - 10-18-2014

Here

jesus man...


RE: Levers - Straxedix - 10-19-2014

(10-18-2014, 02:06 PM)7heDubz Wrote: Here

jesus man...

This means nothing.
I already searched there.