Raised This Month: $12 Target: $400
 3% 

[CS:GO][/ANY] Colored Flashlight


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mastah7991
AlliedModders Donor
Join Date: Sep 2014
Location: Poland
Old 01-13-2019 , 13:18   [CS:GO][/ANY] Colored Flashlight
Reply With Quote #1

Hi
i want show you simple code to create a flashlight

Code:
float playerPos[3];
	float playerAng[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", playerPos);
	GetEntPropVector(client, Prop_Send, "m_angRotation", playerAng);
	
 	int entlight =  CreateEntityByName("light_dynamic");  

	if (entlight != -1)    
    {     
		DispatchKeyValue(entlight, "_light", "0 132 255");  
        DispatchKeyValue(entlight, "brightness", "5");  
 
        DispatchKeyValueFloat(entlight, "distance", 2400.0);  
		DispatchKeyValueFloat(entlight, "spotlight_radius", 200.0);  

		DispatchKeyValueFloat(entlight, "_inner_cone", 0.0);  
		DispatchKeyValueFloat(entlight, "_cone", 360.0);  
 
        DispatchSpawn(entlight);
		TeleportEntity(entlight , playerPos, playerAng,NULL_VECTOR);
	
		SetVariantString("!activator");
		AcceptEntityInput(entlight, "SetParent", GetEntPropEnt(client,Prop_Send,"m_hViewModel"), entlight, 0);
	}
INPUTS:
https://developer.valvesoftware.com/wiki/Light_dynamic

Toggle the light on/off:
Code:
	AcceptEntityInput(entlight, "Toggle");
Limit:
"For the 2013 SDK this is limited to 17 lights on at any one time so use wisely."

Thanks Bacardi

__________________
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
― Rick Cook, The Wizardry Compiled

Last edited by mastah7991; 01-13-2019 at 14:15.
mastah7991 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-13-2019 , 13:40   Re: [CS:GO][/ANY] Colored Flashlight
Reply With Quote #2

Nice.
But is this true ?
Quote:
Note:For the 2013 SDK this is limited to 17 lights on at any one time so use wisely.
Bacardi is offline
mastah7991
AlliedModders Donor
Join Date: Sep 2014
Location: Poland
Old 01-13-2019 , 14:03   Re: [CS:GO][/ANY] Colored Flashlight
Reply With Quote #3

it's true :/
__________________
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
― Rick Cook, The Wizardry Compiled
mastah7991 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-08-2019 , 17:24   Re: [CS:GO][/ANY] Colored Flashlight
Reply With Quote #4

You also get lighting errors when two dynamic lights cross eachother.
__________________
Neuro Toxin is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 02-09-2019 , 00:54   Re: [CS:GO][/ANY] Colored Flashlight
Reply With Quote #5

Source engine does not do lighting smart at all.
404UserNotFound is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-09-2019 , 05:38   Re: [CS:GO][/ANY] Colored Flashlight
Reply With Quote #6

Proper dynamic lighting in BSP requires additional lightmap data to be "baked" into the BSP which explodes filesizes. Then realtime ray tracing activates the lightmap shadow scaling which results in a shadow.

CSGO uses one dynamic light for the environment light source and allows a second light to be cast. When a third is added the lightmaps flicker around.

Edit:

I figure as the dynamic lighting from this plugin isnt compiled into the maps lightmap data it probably doesnt wig out, while they probably dont generate a shadow.
__________________

Last edited by Neuro Toxin; 02-09-2019 at 05:42.
Neuro Toxin is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode