Frictional Games Forum (read-only)
Valve help - 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: Valve help (/thread-8901.html)



Valve help - Henriksen - 07-01-2011

Hi, I was wondering how I script it so that when the valve is turned all the way it triggers a function?


RE: Valve help - Henriksen - 07-03-2011

I guess what im asking for is how do I get the valve to trigger a function????


RE: Valve help - Tanshaydar - 07-05-2011

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


RE: Valve help - Henriksen - 07-05-2011

(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()
{

}


RE: Valve help - H. Filipe - 07-08-2011

(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