Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
un-lit one lamp = un-lit all others
Tony32 Offline
Junior Member

Posts: 26
Threads: 2
Joined: Jan 2011
Reputation: 0
#1
un-lit one lamp = un-lit all others

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
01-11-2011, 07:06 PM
Find
Tottel Offline
Senior Member

Posts: 307
Threads: 9
Joined: Nov 2010
Reputation: 0
#2
RE: un-lit one lamp = un-lit all others

Copy 1 line, paste it 4 times, change 1 letter.

That's the way you'll have to do it. :p
01-11-2011, 07:35 PM
Find
Neatherblade Offline
Junior Member

Posts: 19
Threads: 5
Joined: Jan 2011
Reputation: 0
#3
RE: un-lit one lamp = un-lit all others

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);
}
01-11-2011, 08:02 PM
Find
Tony32 Offline
Junior Member

Posts: 26
Threads: 2
Joined: Jan 2011
Reputation: 0
#4
RE: un-lit one lamp = un-lit all others

Alright, I guess I will have to do it that way then :p Thank you Smile

EDIT: Solved it using a for-loop.
(This post was last modified: 01-11-2011, 08:20 PM by Tony32.)
01-11-2011, 08:15 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#5
RE: un-lit one lamp = un-lit all others

Using a for loop for only 4 entities? How decadent Big Grin


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
01-11-2011, 08:38 PM
Find
Tony32 Offline
Junior Member

Posts: 26
Threads: 2
Joined: Jan 2011
Reputation: 0
#6
RE: un-lit one lamp = un-lit all others

(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
01-11-2011, 08:40 PM
Find
ModManDann Offline
Member

Posts: 61
Threads: 6
Joined: Dec 2010
Reputation: 0
#7
RE: un-lit one lamp = un-lit all others

Cleaner re-useable code is always better too Smile

Current project: Mind Trap
01-11-2011, 10:45 PM
Find
DIGI Byte Offline
Senior Member

Posts: 376
Threads: 20
Joined: Dec 2010
Reputation: 1
#8
RE: un-lit one lamp = un-lit all others

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
(This post was last modified: 01-12-2011, 08:29 AM by DIGI Byte.)
01-12-2011, 08:26 AM
Find




Users browsing this thread: 1 Guest(s)