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

Electric Lights

broken avatar :(
Created 8 years ago
by WhiskyLima
0 Members and 1 Guest are viewing this topic.
2,205 views
broken avatar :(
×
broken avatar :(
Location: gbDarlington
Date Registered: 9 August 2015
Last active: 5 years ago
Posts
38
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
I Love Games Me!
Signature
"Just because we have the biggest hammer, doesn't mean every problem is a nail!"
×
WhiskyLima's Groups
WhiskyLima's Contact & Social Links
Hey gusy, got a light hooked up to the electric_light KVP all working well, but obviously the light has to come from somewhere. Is there a way to change the lights model depending on the electric state and for extra credit, can I turn on and off an info_corona at the same time.

Cheers all
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
If you look in the _lights.csc you can see how 3arch did their power-lights including a model-swap. Just look for the electric_light kvp and you should find it. At work atm so cant tell any details..
broken avatar :(
×
broken avatar :(
Location: gbDarlington
Date Registered: 9 August 2015
Last active: 5 years ago
Posts
38
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
I Love Games Me!
×
WhiskyLima's Groups
WhiskyLima's Contact & Social Links
Ok yes I see the code section, it might take a while to figure it out though.. if you manage to find any more information please let me know. Thank you for your help!

Double Post Merge: October 19, 2016, 01:10:13 pm
Ok I have tried everything I can work out with this script but I am really having a hard time getting it to work. I have modified the existing light script and added it to my mod but I cant work it out. Scripting in this language is definately not something I have any skill in im afraid.
Last Edit: October 19, 2016, 01:10:13 pm by WhiskyLima
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Try this ( not tested, but code comes from a few functions below in the _lights.csc so it should work ):

Make the models a script model and make the light target the model ( deselect everything, first select the light then the model and press 'W' ).

Put the _lights.csc in your mods\clientscripts\ fodler and replace the power_lights_think() function with this:

Code Snippet
Plaintext
//
// Control light intensity for certain lights connected to the power
power_lights_think( clientNum )
{
// Get associated light model entity
if ( IsDefined( self.target ) )
{
self.light_model = GetEnt( clientNum, self.target, "targetname" );
}

// The lights start off
while (1)
{
level waittill( "pl1" ); // power lights on

// Turn the lights on
println("power lights on client num: " + clientnum);
if ( IsDefined( self.script_float ) )
{
self.lights[clientNum] SetLightIntensity( self.script_float );
}
else
{
self.lights[clientNum] SetLightIntensity( 1.5 );
}
self.light_model SetModel( "lights_berlin_subway_hat_0" ); // put the on-model for the light here ( make sure it's precached! )

level waittill( "lights_off" );

// Turn the lights off
// Turn this into a flicker later
println("power lights off client num: " + clientnum);
self.lights[clientNum] SetLightIntensity( 0.001 );
}
}
broken avatar :(
×
broken avatar :(
Location: gbDarlington
Date Registered: 9 August 2015
Last active: 5 years ago
Posts
38
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
I Love Games Me!
×
WhiskyLima's Groups
WhiskyLima's Contact & Social Links
Thank you for that! I have been working on something similar by moving snippets of code around but probably had something wrong somewhere. I have tried this but still can't seem to get it to work however I think it might be something to do with the precaching of the model, how do I do that?

 
Loading ...