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
Turning on lights when entering a scriptarea
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#1
Turning on lights when entering a scriptarea

Could anyone tell me which code to use to turn on torches when entering a scriptarea (multiple torches)
02-24-2012, 10:08 PM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#2
RE: Turning on lights when entering a scriptarea

SetLampLit. Use Indexes.

Torch_1
Torch_2
Torch_3

All will be turned on if you use
Torch_*

02-24-2012, 10:09 PM
Find
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#3
RE: Turning on lights when entering a scriptarea

Thanks man Smile, although idk what to do next -.-
(02-24-2012, 10:09 PM)Obliviator27 Wrote: SetLampLit. Use Indexes.

Torch_1
Torch_2
Torch_3

All will be turned on if you use
Torch_*

(This post was last modified: 02-24-2012, 10:42 PM by LulleBulle.)
02-24-2012, 10:13 PM
Find
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#4
RE: Turning on lights when entering a scriptarea

Someone mind telling me how to do this? Sad
02-25-2012, 02:57 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#5
RE: Turning on lights when entering a scriptarea

To make all the lamps lit at the same time you use

for(int x=1; x <= 3; x++) SetLampLit("torch_"+x, true, true);

change the 3 to the amount of torches you have

02-25-2012, 03:10 PM
Find
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#6
RE: Turning on lights when entering a scriptarea

(02-25-2012, 03:10 PM)SilentStriker Wrote: To make all the lamps lit at the same time you use

for(int x=1; x <= 3; x++) SetLampLit("torch_"+x, true, true);

change the 3 to the amount of torches you have


Yea but where do i put the script area?
02-25-2012, 04:45 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#7
RE: Turning on lights when entering a scriptarea

Just put a script area where ever you want the lamps to be lit and use a AddEntityCollideCallback and then in the function you call you put the code i wrote

02-25-2012, 04:48 PM
Find
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#8
RE: Turning on lights when entering a scriptarea

(02-25-2012, 04:48 PM)SilentStriker Wrote: Just put a script area where ever you want the lamps to be lit and use a AddEntityCollideCallback and then in the function you call you put the code i wrote
i tried this:

void OnStart()
{
AddEntityCollideCallback("Player", "LightOn", "Lights", true, 1);
}
void Lights(string &in asParent, string &in asChild, int alState)
{    
SetLampLit("torch_static01_*", true);
}

It didn't work
(This post was last modified: 02-25-2012, 05:13 PM by LulleBulle.)
02-25-2012, 05:13 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#9
RE: Turning on lights when entering a scriptarea

(02-25-2012, 05:13 PM)LulleBulle Wrote:
(02-25-2012, 04:48 PM)SilentStriker Wrote: Just put a script area where ever you want the lamps to be lit and use a AddEntityCollideCallback and then in the function you call you put the code i wrote
i tried this:

void OnStart()
{
AddEntityCollideCallback("Player", "LightOn", "Lights", true, 1);
}
void Lights(string &in asParent, string &in asChild, int alState)
{    
SetLampLit("torch_static01_*", true);
}

It didn't work
because it should look like this


void OnStart()
{
AddEntityCollideCallback("Player", "LightOn", "Lights", true, 1);
}
void Lights(string &in asParent, string &in asChild, int alState)
{    
for(int x=1; x <= 3; x++) SetLampLit("torch_static01_"+x, true, true);
}


(This post was last modified: 02-25-2012, 05:16 PM by SilentStriker.)
02-25-2012, 05:15 PM
Find
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#10
RE: Turning on lights when entering a scriptarea

(02-25-2012, 05:15 PM)SilentStriker Wrote:
(02-25-2012, 05:13 PM)LulleBulle Wrote:
(02-25-2012, 04:48 PM)SilentStriker Wrote: Just put a script area where ever you want the lamps to be lit and use a AddEntityCollideCallback and then in the function you call you put the code i wrote
i tried this:

void OnStart()
{
AddEntityCollideCallback("Player", "LightOn", "Lights", true, 1);
}
void Lights(string &in asParent, string &in asChild, int alState)
{    
SetLampLit("torch_static01_*", true);
}

It didn't work
because it should look like this


void OnStart()
{
AddEntityCollideCallback("Player", "LightOn", "Lights", true, 1);
}
void Lights(string &in asParent, string &in asChild, int alState)
{    
for(int x=1; x <= 3; x++) SetLampLit("torch_static01_"+x, true, true);
}


Why can't I index the torches?


Also, it worked perfectly.
(This post was last modified: 02-25-2012, 05:26 PM by LulleBulle.)
02-25-2012, 05:21 PM
Find




Users browsing this thread: 1 Guest(s)