UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

flickering lights

broken avatar :(
Created 11 years ago
by P0rkRoyalz
0 Members and 1 Guest are viewing this topic.
4,654 views
broken avatar :(
×
broken avatar :(
Location: auMelbourne
Date Registered: 6 August 2012
Last active: 7 years ago
Posts
125
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
TMG Modeller and Animator
Signature
Current W.I.P Map
nazi_zombie_ash (the name may change)
Map Progress:
65%

Need help with guns, sounds or models send me a PM
×
P0rkRoyalz's Groups
P0rkRoyalz's Contact & Social Linksa13xm33P0rkRoyalzP0rkRoyalz
i have flicking lights in my map atm but how do i make mine like the flickering lights like UGX Cabin? mine just fade in and out every 2 seconds and it looks weird, so yeah can some one help me out? thanks
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
i would set two variables for on and off and set them to a random int for the time. then make them so it randomly changes on and off at different times. just an idea, idk how well that would work
broken avatar :(
×
broken avatar :(
Location: auMelbourne
Date Registered: 6 August 2012
Last active: 7 years ago
Posts
125
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
TMG Modeller and Animator
×
P0rkRoyalz's Groups
P0rkRoyalz's Contact & Social Linksa13xm33P0rkRoyalzP0rkRoyalz
sorry do you mean by making my own little script for the lights..? i dont know how to script unfortunately... :'( but if in UGX Cabin they used one of the target names that was "unusable" i was hoping they would let me in on how they got it to work
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
sorry do you mean by making my own little script for the lights..? i dont know how to script unfortunately... :'( but if in UGX Cabin they used one of the target names that was "unusable" i was hoping they would let me in on how they got it to work
I wrote my own function based on what I knew at the time - there's probably a better way to do it but I don't care enough to rewrite anything.

Copy /raw/cientscripts/_lights.csc to your mod clientscripts folder, then replace generic_flickering with this:
Code Snippet
Plaintext
generic_flickering(clientNum)// by [ugx] treminaor
{
   assertex(isdefined(self.lights) && isdefined(self.lights[clientNum]), "Light not setup before script thread run on it.");
   self endon("stop_flicker");

   min_delay = 0.1;
   max_delay = 0.5;
   
   min_intensity = 0.05;
   max_intensity = 0.85;

   intensity = self.lights[clientNum] GetLightIntensity();
   curr_intensity = intensity;
   model_swap_1 = intensity + min_intensity + ((max_intensity - min_intensity) / 3);
   model_swap_2 = intensity + max_intensity - ((max_intensity - min_intensity) / 3);

    self.lights[clientNum] SetLightIntensity( 1 );

light_org = GetStruct(self.target, "targetname");

self.light_model = Spawn( clientNum, light_org.origin, "script_model" );

   model = "";
   level._effect["flicker_subway_light"] = loadFX("subway_light");

   fx =  level._effect["flicker_subway_light"];

   for( ;; )
{
temp_intensity = intensity * RandomFloatRange( min_intensity, max_intensity );
time = RandomFloatRange( min_delay, max_delay );
rand_delay = randomfloat(.5)+0.05;
wait(rand_delay);
steps = time * 20;
div = ( curr_intensity - temp_intensity ) / steps;
for( i = 0; i < steps; i++ )
{
curr_intensity -= div;
if( curr_intensity < 0 )
{
curr_intensity = 0;
}
if ( IsDefined( self.light_model ) )
{
if ( curr_intensity < 0.5 )
{
model = "light_0";
}
else if ( curr_intensity == 1 )
{
model = "light_2";
}
else
{
model = "light_1";
}
           
if ( model != self.light_model.model )
{
self.light_model SetModel( model );
self.lights[clientNum] SetLightIntensity( curr_intensity );
}
}
}
if(self.light_model.model != "light_0")
{
PlayFx( clientNum, fx, self.origin );
}
wait( 0.05 );

curr_intensity = temp_intensity;
   }
}
I don't remember if the fx are custom or not, so take care to check that yourself. You dont need the fx but it really makes the flickering more realistic. Also you need to precache the on and off models in your map.gsc before zombiemode::main is called.
broken avatar :(
×
broken avatar :(
Location: auMelbourne
Date Registered: 6 August 2012
Last active: 7 years ago
Posts
125
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
TMG Modeller and Animator
×
P0rkRoyalz's Groups
P0rkRoyalz's Contact & Social Linksa13xm33P0rkRoyalzP0rkRoyalz
I don't remember if the fx are custom or not, so take care to check that yourself. You dont need the fx but it really makes the flickering more realistic. Also you need to precache the on and off models in your map.gsc before zombiemode::main is called.

thanks for the code btw ;D,
anyway the fx is custom but that doesnt matter, how do i set it up in radiant? like i did with the previous light using the targtename>generic_pulsing?
i had the targetname on the light linked to an info_null, also do i have to add script_delay_min and scrip_delay_max to the light? to get it to have intervals, thanks
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
thanks for the code btw ;D,
anyway the fx is custom but that doesnt matter, how do i set it up in radiant? like i did with the previous light using the targtename>generic_pulsing?
i had the targetname on the light linked to an info_null, also do i have to add script_delay_min and scrip_delay_max to the light? to get it to have intervals, thanks
I hardcoded the intervals and intensity. All you need is the targetname and a properly set up light node.

You also need a struct linked to the light. Here's a prefab: https://dl.dropbox.com/u/7345145/ugx_cabin_lightpost.zip

 
Loading ...