Frictional Games Forum (read-only)
[SCRIPT] How do i make a lever that removes something? - 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] How do i make a lever that removes something? (/thread-11253.html)



How do i make a lever that removes something? - TheDavenia - 11-08-2011

How do i make a lever that removes something?
Like there's a lever hidden somewhere, and its supposed to delete something...
Whats the code for that?
Help please!


RE: How do i make a lever that removes something? - Obliviator27 - 11-08-2011

SetEntityConnectionStateChangeCallback
as well as
SetEntityActive

Will do so.

Example
PHP Code:
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever_1""LeverPulled");
}
void LeverPulled(string &in asEntityint alState)
{
    if(
alState == 1)
    {
        
SetEntityActive("entity_1"false);
        
SetLeverStuckState("lever_1"1true);
    }