AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [CS:GO][/ANY] Colored Flashlight (https://forums.alliedmods.net/showthread.php?t=313561)

mastah7991 01-13-2019 13:18

[CS:GO][/ANY] Colored Flashlight
 
Hi :D
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 :D

https://cdn.discordapp.com/attachmen...65/unknown.png

Bacardi 01-13-2019 13:40

Re: [CS:GO][/ANY] Colored Flashlight
 
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.

mastah7991 01-13-2019 14:03

Re: [CS:GO][/ANY] Colored Flashlight
 
it's true :/

Neuro Toxin 02-08-2019 17:24

Re: [CS:GO][/ANY] Colored Flashlight
 
You also get lighting errors when two dynamic lights cross eachother.

404UserNotFound 02-09-2019 00:54

Re: [CS:GO][/ANY] Colored Flashlight
 
Source engine does not do lighting smart at all.

Neuro Toxin 02-09-2019 05:38

Re: [CS:GO][/ANY] Colored Flashlight
 
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.


All times are GMT -4. The time now is 12:50.

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