Frictional Games Forum (read-only)

Full Version: Valve help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I was wondering how I script it so that when the valve is turned all the way it triggers a function?
I guess what im asking for is how do I get the valve to trigger a function????
State Change is what you are looking for.
void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);

A callback called when ever the connection state changes (button being switched on, lever switched, etc).
Callback syntax: void Func(string &in EntityName, int alState)
alState: -1 = off, 0 = between, 1 = on
(07-05-2011, 01:49 AM)Tanshaydar Wrote: [ -> ]State Change is what you are looking for.
void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);

A callback called when ever the connection state changes (button being switched on, lever switched, etc).
Callback syntax: void Func(string &in EntityName, int alState)
alState: -1 = off, 0 = between, 1 = on

What do insert where??
Can anybody see why its not working???


////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityConnectionStateChangeCallback(LoL, EndaMer);
AddEntityCollideCallback("Player", "HaveLantern", "MayIGo", false, 1);
AddEntityCollideCallback("Player", "HaveLantern_1", "MayINot", false, 1);
}

void Func("button_simple_1", 1)
{
PlaySoundAtEntity("", "13_steam.snt", "Player", 0, true);
}

void MayINot(string &in asParent, string &in asChild, int alState)
{
if(HasItem("ZuLantern")==false)
{
SetMessage("NotWorking", "CisternDarkness", 0);
}
}

void MayIGo(string &in asParent, string &in asChild, int alState)
{
if(HasItem("ZuLantern")==true)
{
SetEntityActive("BlockBuster", false);
SetEntityActive("BlockBuster_1", false);
SetEntityActive("BlockBuster_2", false);
}
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
(07-05-2011, 10:33 AM)teddifisk Wrote: [ -> ]
(07-05-2011, 01:49 AM)Tanshaydar Wrote: [ -> ]State Change is what you are looking for.
void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);

A callback called when ever the connection state changes (button being switched on, lever switched, etc).
Callback syntax: void Func(string &in EntityName, int alState)
alState: -1 = off, 0 = between, 1 = on

What do insert where??
Can anybody see why its not working???


////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityConnectionStateChangeCallback(LoL, EndaMer);
AddEntityCollideCallback("Player", "HaveLantern", "MayIGo", false, 1);
AddEntityCollideCallback("Player", "HaveLantern_1", "MayINot", false, 1);
}

void Func("button_simple_1", 1)
{
PlaySoundAtEntity("", "13_steam.snt", "Player", 0, true);
}

void MayINot(string &in asParent, string &in asChild, int alState)
{
if(HasItem("ZuLantern")==false)
{
SetMessage("NotWorking", "CisternDarkness", 0);
}
}

void MayIGo(string &in asParent, string &in asChild, int alState)
{
if(HasItem("ZuLantern")==true)
{
SetEntityActive("BlockBuster", false);
SetEntityActive("BlockBuster_1", false);
SetEntityActive("BlockBuster_2", false);
}
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

You forgot the "" in SetEntityConnectionStateChangeCallback(LoL, EndaMer); is SetEntityConnectionStateChangeCallback("LoL", "EndaMer");
I think