Valve interaction - 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: Valve interaction (/thread-7484.html) |
Valve interaction - Josh707 - 04-19-2011 Hey everyone, I have set up my map with toggle-able light switches and I want to know how to make a valve turn on a heater. I have tried to do Code: SetEntityPlayerInteractCallback("heatervalve", "Turnonheater", true); then Code: void Turnonheater(string &in entity) tl;dr How do I make a valve call a function when I turn it all the way? RE: Valve interaction - Anxt - 04-19-2011 Select the object in the map editor that has the wheel on it. Go to the entity tab, and where it says "ConnectionStateChangeCallback" or something of the sort, type in the TurnOnHeater function name. Then, make your function look like this: void Turnonheater(string &in entity) { if(alState==1) { PlaySoundAtEntity("", "22_fire.snt", "geostove", 0, false); SetLampLit("bonfire", true, false); } } Get rid of the SetEntityPlayerInteractCallback you have as well, it will mess it up. RE: Valve interaction - Josh707 - 04-19-2011 Error says: 'alState' is not declared, and Expression must be of boolean type at the start you said the object that has the wheel on it, I just have a valve (rotating wheel with nothing behind it) stuck into the wall. Is that a problem or do I need to use a certain type of valve? RE: Valve interaction - Apjjm - 04-19-2011 You will want the function "SetEntityConnectionStateChangeCallback" for that job. Quote:void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);E.g: Code: void OnStart() RE: Valve interaction - Anxt - 04-19-2011 Oh sorry, forgot to fix the function name. My bad. Should be: void Turnonheater(string &in entity, int alState) { if(alState==1) { PlaySoundAtEntity("", "22_fire.snt", "geostove", 0, false); SetLampLit("bonfire", true, false); } } Forgot to add the alState bit. Now it should work. RE: Valve interaction - Josh707 - 04-19-2011 Thank you! it worked. The first actual advice i've gotten on this forum RE: Valve interaction - Anxt - 04-19-2011 I do my best to help out when I can, if you need anything feel free to send me a PM, that way I will definitely see it. RE: Valve interaction - Josh707 - 04-19-2011 Sounds good! |