Help with a pipe puzzle - 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: Help with a pipe puzzle (/thread-8205.html) |
Help with a pipe puzzle - Rownbear - 05-23-2011 Hello I need help with using the "if" in my script, I just dont get it. So I have 3 pipes use them on 3 separate scripts and every time one placed right an pipe entity appears so the player sees that it's placed right. Now When all are placed right I want to swap a stuck valve with a valve that can be turned. So here's my script so far Spoiler below!
I don't know how to script it to understand when all 3 pipes are placed right it should swap the stuck valve with the unstuck Help appreciated! RE: Help with a pipe puzzle - Kyle - 05-23-2011 You use a local variable. Try this: Code: void OnStart() I think this should fix most of it. RE: Help with a pipe puzzle - Rownbear - 05-24-2011 (05-23-2011, 09:28 PM)Kyle Wrote: You use a local variable. Thanks mate, i'll try when I get home, btw could you explain to me what that "SetLocalVarInt("Var01", 1);" or what the var01 does? I can just copy this but I'm not sure how it actually works EDIT: Yep, works like a charm, still don't know how it works tho RE: Help with a pipe puzzle - SLAMnesia - 06-07-2011 I'd like to know how variables work too I have a problem and I posted it here; http://www.frictionalgames.com/forum/thread-8484-post-74695.html#pid74695 And the public says it's a variable problem >.> I have no idea what those are or how to use em but this could help me in some way im sure RE: Help with a pipe puzzle - DannieWest - 06-08-2011 Well, it's basically something like when the local variable is 0 something happens, and when it is 1 something else happens, so when you use the "if", the script checks if the variable is equal to 0 or 1. So if you set the local variable to 1 it will do the script you created for local var 1. If, lets say you haven't collected the item, the variable is 0 and will skip the script which had the variable 1 and do whatever is on 0, until you get the necessary items (or w/e it is you use to change the variable to 1) and then it does the script you created for 1 Since english isn't my main language I might've explained a bit confusing, but I hope this helped a little at least xD The if does exactly what it's named, IF something is 0 the script is activated, else it does the 1 or what the local variable is RE: Help with a pipe puzzle - Rownbear - 06-26-2011 SOLVED: CANT USE 180, only -1, 0, and 1, figured it out self, sorry for useless bump. Bumping old instead of making new: I got a problem with a valve for my script, I got one working but it's not working correctly. So am I not using the right script for this? I just want to turn the valve to 180 and the stuff to happen void OnStart() { SetEntityConnectionStateChangeCallback("Valve_1", "MakeAcid"); } void MakeAcid(string &in asEntity, int alState) { if (alState == 180) { SetLeverStuckState("Valve_1", 180, true); SetEntityActive("13_burner_1", true); AddTimer("Timer", 3.0, "AcidFinished"); } } void AcidFinished(string&in asTimer) { SetEntityActive("13_burner_1", false); SetEntityActive("chemical_container_full_1", true); } Please Help. RE: Help with a pipe puzzle - Kyle - 06-26-2011 @Rownbear; Wow, I didn't know that you had to do -1, 0, or 1 for a valve, because I was always trying to do it the way you said you first did it. XD |