![]() |
un-lit one lamp = un-lit all others - 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: un-lit one lamp = un-lit all others (/thread-6162.html) |
un-lit one lamp = un-lit all others - Tony32 - 01-11-2011 Let's say I got 5 LAMPS <- Not lights. All are LIT. Now if I turn lamp 1 off (using script), I want the other 4 to do the same thing.. They should be connected in some kind of way. I tried adding 4 of the lamps to the fifths "ConnectedProps" and still they don't "follow". Is there a way to do this? Or do I have to turn of the lamps one by one? ![]() RE: un-lit one lamp = un-lit all others - Tottel - 01-11-2011 Copy 1 line, paste it 4 times, change 1 letter. That's the way you'll have to do it. :p RE: un-lit one lamp = un-lit all others - Neatherblade - 01-11-2011 This is how i have done it. void OnStart() { AddEntityCollideCallback("Player", "torch_trigger", "BloodTorchoff1", true, 1); } void BloodTorchoff1(string &in asParent, string &in asChild, in alState) { SetLampLit("blood_torch_1", false, true); SetLampLit("blood_torch_2", false, true); SetLampLit("blood_torch_3", false, true); } RE: un-lit one lamp = un-lit all others - Tony32 - 01-11-2011 Alright, I guess I will have to do it that way then :p Thank you ![]() EDIT: Solved it using a for-loop. RE: un-lit one lamp = un-lit all others - Frontcannon - 01-11-2011 Using a for loop for only 4 entities? How decadent ![]() RE: un-lit one lamp = un-lit all others - Tony32 - 01-11-2011 (01-11-2011, 08:38 PM)Frontcannon Wrote: Using a for loop for only 4 entities? How decadent I used 5 just in the example, it's really 10 lamps + - ![]() RE: un-lit one lamp = un-lit all others - ModManDann - 01-11-2011 Cleaner re-useable code is always better too ![]() RE: un-lit one lamp = un-lit all others - DIGI Byte - 01-12-2011 try this void OnStart() { AddEntityCollideCallback("Player", "torch_trigger", "BloodTorchoff1", true, 1); } void BloodTorchoff1(string &in asParent, string &in asChild, in alState) { SetLampLit("blood_torch_*", false, true); } any lamp starting with blood_torch_ will turn off, if you have duplicates that you don't want to turn off, I suggest changing their names in the level editor |