Frictional Games Forum (read-only)
[Solved] How to unlock door with a Wheel ? - 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: [Solved] How to unlock door with a Wheel ? (/thread-26940.html)

Pages: 1 2


[Solved] How to unlock door with a Wheel ? - olrik666 - 10-24-2014

hi guys, I want to know which script to use in order to open a leveldoor with a valve.

I can't find it. Undecided


Thanks Smile


RE: How to unlock door with a Wheel ? - Straxedix - 10-24-2014

Hello olrik666

I guess you can find help in here:

https://wiki.frictionalgames.com/doku.php?id=hpl2/amnesia/script_functions#levers_wheels_and_buttons


RE: How to unlock door with a Wheel ? - olrik666 - 10-24-2014

I don't understand :/



My script :

void OnStart()
{
PreloadSound("17_steam.snt");
PreloadSound("unlock_door.snt");
SetLocalVarInt("Valve_iron1", 0);
}

void OnLeave()

{
SetupLoadScreen("Loading", "LoadScreen1", 0, "LoadScreenImage1.png");
}
/////////Interact

void unlockdoor(string &in asEntity, int alState)

{

if(alState == 1)

{
SetLevelDoorLocked("door_complex1", false);
PlaySoundAtEntity("", "unlock_door.snt", "door_complex1", 0, false);
PlaySoundAtEntity("", "17_steam.snt", "barrier", 0, false);

}


}


RE: How to unlock door with a Wheel ? - DnALANGE - 10-25-2014

Try adding this in OnStart
PHP Code:
SetEntityConnectionStateChangeCallback("NameofyourwheelintheLeveleditor""unlockdoor"); 




RE: How to unlock door with a Wheel ? - Straxedix - 10-25-2014

As DnALANGE said add that code on "void OnStart()"

so it should looks like

Spoiler below!
PHP Code:
void OnStart()
{
SetEntityConnectionStateChangeCallback("NameofyourwheelintheLeveleditor""unlockdoor"); 
PreloadSound("17_steam.snt");
PreloadSound("unlock_door.snt");
SetLocalVarInt("Valve_iron1"0);
}

void OnLeave()

{
SetupLoadScreen("Loading""LoadScreen1"0"LoadScreenImage1.png");
}
/////////Interact

void unlockdoor(string &in asEntityint alState)

{

if(
alState == 1)

{
SetLevelDoorLocked("door_complex1"false);
PlaySoundAtEntity("""unlock_door.snt""door_complex1"0false);
PlaySoundAtEntity("""17_steam.snt""barrier"0false);

}





And try using the spoiler it saves a lot of place in thread :P

like:[.spoiler]text[./spoiler] (without the dot) :D


RE: How to unlock door with a Wheel ? - burge4150 - 10-25-2014

I'm just here to reaffirm:

SetEntityConnectionStateChangeCallback("string entity name", "function name");

Whenever a valve changes state (from all the way off to all the way on, etc) it will trigger this function. I would remove the callback or put a check in the function to make sure it can't be repeated because that'll cause issues.


RE: How to unlock door with a Wheel ? - DnALANGE - 10-25-2014

Then this guy should fix this issue by doing this function IN the script itself ;
PHP Code:
SetWheelStuckState("YOURWheelName"1true); 
This will STUCK it''s state in
Quote:
PHP Code:

or
Quote:
PHP Code:
-
-
Burge4150, next time if you have an argument, please add the solution as well.


RE: How to unlock door with a Wheel ? - olrik666 - 10-25-2014

Thanks you all guys Wink it's work fine Smile


RE: How to unlock door with a Wheel ? - DnALANGE - 10-25-2014

(10-25-2014, 05:11 PM)olrik666 Wrote: Thanks you all guys Wink it's work fine Smile

+Rep for me Tongue
You can give people kudo's \ reputatuion points for fun.
Only if you want to offcourse..
You dont have to do that now.
Just IF you want you can press on players name and REP + a small tekst for it.
For any other issues. be free to post them.
HINT; IF you have anything solved, please add SOLVED on your theeadh page.
So people do not have to go look into your "solved threadh"


RE: [Solved] How to unlock door with a Wheel ? - Straxedix - 10-25-2014

Glad i helped :P