AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Simulate thunders & lightning (https://forums.alliedmods.net/showthread.php?t=317803)

Desktop 07-30-2019 12:01

Simulate thunders & lightning
 
Hi guys;

I've been searching for any code that helps making the same effect that old MercyLeZz zombie plague in 1.6 could do (talking about thunders and lightning).

Didn't find anything similar to that intesity-variating light that he used to make this effect on the map.

To explain my idea, think about a very dark map (already done with SetLightStyle) with timers repeating each X seconds, producing increasements and decreasements of map's light.

The point is that whenever i change the light intensity with SetLightStyle, it does not refresh until the player places some type of light or moves around all the map, making that code useless.

Any idea?

TheDS1337 07-30-2019 12:28

Re: Simulate thunders & lightning
 
I'm assuming this is for CS:GO, I know that CS:GO has a very weird bug with lightning even if you could achieve it without having to restart the map and/or disconnect all clients and reconnect them.

I really hope that one day it gets fixed by volvo

Desktop 07-30-2019 15:31

Re: Simulate thunders & lightning
 
Yes, this is for CSGO tho, forgot to mention it.

I think we're thinking the same bug.

I wonder if we could "refresh" the entity in any way to fix this.

TheDS1337 07-31-2019 05:26

Re: Simulate thunders & lightning
 
I don't think it's possible, it's only loaded when a map is loaded :/ we need to email valve to atleast get the "a" lightening fixed because if you already tried it... it makes most of the map textures solid black

Desktop 08-09-2019 11:42

Re: Simulate thunders & lightning
 
Ummm, look at this, i've found it in an old post by Dr. Api

PHP Code:

void ChangeLightStyle(char[] lightstringint client 0)
{
    
int style 1;
    if(
strcmp(lightstring"") != 0)
    {
        
SetLightStyle(0lightstring);

        
// This refreshes and updates the entire map with the new light style.
        
int entity CreateEntityByName("light_dynamic");

        
DispatchKeyValue(entity"_light""0 0 0 0");
        
DispatchKeyValue(entity"brightness""0");
        
DispatchKeyValue(entity"style""13");
        
DispatchKeyValue(entity"distance""19999");
        
DispatchSpawn(entity);

        if(
client)
        {
            
SetEntProp(entityProp_Data"m_iHammerID"client);
            
SDKHook(entitySDKHook_SetTransmitHook_SetTransmitLight);
        }

        if(
style == 0)
        {
            
float vPos[3], vMins[3], vMaxs[3];
            
GetEntPropVector(0Prop_Data"m_WorldMins"vMins);
            
GetEntPropVector(0Prop_Data"m_WorldMaxs"vMaxs);
            
vPos[0] = (vMins[0] + vMaxs[0]) / 2;
            
vPos[1] = (vMins[1] + vMaxs[1]) / 2;
            
vPos[2] = vMaxs[2] + 2000.0;
            
TeleportEntity(entityvPosNULL_VECTORNULL_VECTOR);

            
AcceptEntityInput(entity"TurnOn");
            
SetVariantString("OnUser1 !self:TurnOff::0.2:-1");
            
AcceptEntityInput(entity"AddOutput");
            
SetVariantString("OnUser1 !self:TurnOff::0.3:-1");
            
AcceptEntityInput(entity"AddOutput");
            
SetVariantString("OnUser1 !self:TurnOff::0.4:-1");
            
AcceptEntityInput(entity"AddOutput");
            
SetVariantString("OnUser1 !self:Kill::0.5:-1");
            
AcceptEntityInput(entity"AddOutput");
            
AcceptEntityInput(entity"FireUser1");
        }
        else
        {
            if(
style == 1)
            {
                
SetVariantString("OnUser1 !self:TurnOff::0.7:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser1 !self:TurnOff::0.8:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser1 !self:Kill::1.0:-1");
                
AcceptEntityInput(entity"AddOutput");
                
AcceptEntityInput(entity"FireUser1");

                
SetVariantString("OnUser3 !self:FireUser2::0.05:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.10:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.15:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.20:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.25:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.30:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.35:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.40:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.45:-1");
                
AcceptEntityInput(entity"AddOutput");
            }
            else
            {
                
SetVariantString("OnUser1 !self:TurnOff::1.2:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser1 !self:TurnOff::1.3:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser1 !self:Kill::1.5:-1");
                
AcceptEntityInput(entity"AddOutput");
                
AcceptEntityInput(entity"FireUser1");

                
SetVariantString("OnUser3 !self:FireUser2::0.1:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.2:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.3:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.4:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.5:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.6:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.7:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.8:-1");
                
AcceptEntityInput(entity"AddOutput");
                
SetVariantString("OnUser3 !self:FireUser2::0.9:-1");
                
AcceptEntityInput(entity"AddOutput");
            }

            
SetEntProp(entityProp_Data"m_iHealth"1);
            
HookSingleEntityOutput(entity"OnUser2"OnUser2);
            
AcceptEntityInput(entity"FireUser3");
        }
    }


How good/bad is this? Theoretically it refreshes lights by emitting light when you apply changes to darkness/brightness.


All times are GMT -4. The time now is 08:53.

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