Frictional Games Forum (read-only)

Full Version: un-lit one lamp = un-lit all others
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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? Smile
Copy 1 line, paste it 4 times, change 1 letter.

That's the way you'll have to do it. :p
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);
}
Alright, I guess I will have to do it that way then :p Thank you Smile

EDIT: Solved it using a for-loop.
Using a for loop for only 4 entities? How decadent Big Grin
(01-11-2011, 08:38 PM)Frontcannon Wrote: [ -> ]Using a for loop for only 4 entities? How decadent Big Grin

I used 5 just in the example, it's really 10 lamps + - Smile
Cleaner re-useable code is always better too Smile
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