Frictional Games Forum (read-only)

Full Version: [SOLVED] Levers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
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 ^^
string& asName ? name of lever ?

Cause i wanna shut down Light (spot light) and entity...
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.
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
Bump ?
Bump :3
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.
Here

jesus man...
(10-18-2014, 02:06 PM)7heDubz Wrote: [ -> ]Here

jesus man...

This means nothing.
I already searched there.
Pages: 1 2