| 
		
	
		| FurtherGames   Member
 
 Posts: 72
 Threads: 23
 Joined: Apr 2013
 Reputation: 
1
 | 
			|  Script For Activating Point Lights? 
 
				Are there any script codes to activate a point light once the player has collided with a script area?
			 |  |  
	| 05-04-2013, 04:59 PM |  |  
	
		| FurtherGames   Member
 
 Posts: 72
 Threads: 23
 Joined: Apr 2013
 Reputation: 
1
 |  |  
	| 05-04-2013, 05:57 PM |  |  
	
		| CarnivorousJelly   Posting Freak
 
 Posts: 1,196
 Threads: 41
 Joined: Dec 2012
 Reputation: 
80
 | 
			| RE: Script For Activating Point Lights? 
 
				 (05-04-2013, 05:57 PM)FurtherGames Wrote:   (05-04-2013, 05:47 PM)Robosprog Wrote:  http://wiki.frictionalgames.com/hpl2/amn..._functions Yeah... I used the "void SetLightVisible(string& asLightName, bool abVisible);" command, but it doesn't work.
 
Make sure you typed in in correctly. If it's still not working, try this:
 
Keep all the lights active with a radius of 0 and use this function to change the radius to what you want:
 FadeLightTo(string& asLightName, float afR, float afG, float afB, float afA, float afRadius, float afTime);
string& asLightName = "pointlight_whatever number yours is" 
float afR = value you have on the red slider, with a decimal (eg 1.0f) 
float afG = same as above but for green 
float afB = same as above but for blue 
float afA = same as above but for alpha 
float afRadius = the you want your pointlight to change to (eg 3.0f) 
float afTime = time, in seconds, for the change to take place (1.0f is 1 second)
			 
 |  |  
	| 05-04-2013, 06:04 PM |  |  
	
		| FurtherGames   Member
 
 Posts: 72
 Threads: 23
 Joined: Apr 2013
 Reputation: 
1
 | 
			| RE: Script For Activating Point Lights? 
 
				 (05-04-2013, 06:04 PM)Kiandra Wrote:   (05-04-2013, 05:57 PM)FurtherGames Wrote:   (05-04-2013, 05:47 PM)Robosprog Wrote:  http://wiki.frictionalgames.com/hpl2/amn..._functions Yeah... I used the "void SetLightVisible(string& asLightName, bool abVisible);" command, but it doesn't work.
 Make sure you typed in in correctly. If it's still not working, try this:
 
 Keep all the lights active with a radius of 0 and use this function to change the radius to what you want:
 
 string& asLightName = "pointlight_whatever number yours is"FadeLightTo(string& asLightName, float afR, float afG, float afB, float afA, float afRadius, float afTime);
float afR = value you have on the red slider, with a decimal (eg 1.0f)
 float afG = same as above but for green
 float afB = same as above but for blue
 float afA = same as above but for alpha
 float afRadius = the you want your pointlight to change to (eg 3.0f)
 float afTime = time, in seconds, for the change to take place (1.0f is 1 second)
 
Do you use "SetEntityActive for lamps/candle sticks?
			 |  |  
	| 05-04-2013, 06:10 PM |  |  
	
		| CarnivorousJelly   Posting Freak
 
 Posts: 1,196
 Threads: 41
 Joined: Dec 2012
 Reputation: 
80
 | 
			| RE: Script For Activating Point Lights? 
 
				No, you would use SetLampLit(string& asName, bool abLit, bool abEffects);
 
 Unless you want the lamps to appear out of nowhere. Then SetEntityActive would be appropriate (for future reference, its what you would use to spawn the enemies)
 
 |  |  
	| 05-04-2013, 06:13 PM |  |  
	
		| FurtherGames   Member
 
 Posts: 72
 Threads: 23
 Joined: Apr 2013
 Reputation: 
1
 | 
			| RE: Script For Activating Point Lights? 
 
				 (05-04-2013, 06:13 PM)Kiandra Wrote:  No, you would use SetLampLit(string& asName, bool abLit, bool abEffects);
 
 Unless you want the lamps to appear out of nowhere. Then SetEntityActive would be appropriate (for future reference, its what you would use to spawn the enemies)
 
Yeah, I thought so. I have one other question. Is there a way to change the colour of a point light? When you are changing the colour in the editor you can use the sliders?
			 |  |  
	| 05-04-2013, 06:19 PM |  |  
	
		| CarnivorousJelly   Posting Freak
 
 Posts: 1,196
 Threads: 41
 Joined: Dec 2012
 Reputation: 
80
 | 
			| RE: Script For Activating Point Lights? 
 
				 (05-04-2013, 06:19 PM)FurtherGames Wrote:   (05-04-2013, 06:13 PM)Kiandra Wrote:  No, you would use SetLampLit(string& asName, bool abLit, bool abEffects);
 
 Unless you want the lamps to appear out of nowhere. Then SetEntityActive would be appropriate (for future reference, its what you would use to spawn the enemies)
 Yeah, I thought so. I have one other question. Is there a way to change the colour of a point light? When you are changing the colour in the editor you can use the sliders?
 
In the level editor: moving the sliders or typing in the exact value works 
In script: FadeLightTo and change the afR, afG and afB values to something other than what you have in game
 
I used it on one of my maps to change the time of day:
 if (GetGlobalVarInt("NightTriggered") == 0){
 /////////////LIGHTS///////////
 FadeLightTo("PointLight_1", 0.017f, 0.060f, 0.092f, 0.010f, 2.50f, 180.0f);
 FadeLightTo("PointLight_2", 0.017f, 0.060f, 0.092f, 0.010f, 2.50f, 180.0f);
 FadeLightTo("PointLight_3", 0.053f, 0.058f, 0.071f, 0.150f, 4.50f, 180.0f);
 FadeLightTo("PointLight_4", 0.000f, 0.000f, 0.000f, 0.150f, 6.00f, 180.0f);
 FadeLightTo("PointLight_5", 0.000f, 0.000f, 0.000f, 0.150f, 6.00f, 180.0f);
 FadeLightTo("PointLight_6", 0.053f, 0.058f, 0.071f, 0.350f, 4.50f, 180.0f);
 FadeLightTo("PointLight_7", 0.053f, 0.058f, 0.071f, 0.350f, 2.50f, 180.0f);
 FadeLightTo("PointLight_8", 0.053f, 0.058f, 0.071f, 0.350f, 3.50f, 180.0f);
 FadeLightTo("PointLight_9", 0.000f, 0.000f, 0.000f, 0.350f, 6.00f, 180.0f);
And it keeps going and going all the way up to pointlight 30/spotlight 8
 
I would make a small room off to the side (disconnected from your map) to test the new light colours in. Just use the same static object set the rest of your map uses to ensure the colours look good.
			 
 ![[Image: quote_by_rueppells_fox-d9ciupp.png]](http://orig14.deviantart.net/d9d5/f/2015/282/5/9/quote_by_rueppells_fox-d9ciupp.png) |  |  
	| 05-04-2013, 07:59 PM |  |  |