Jump to content
The Dark Mod Forums

Help required: scripted lights no turning on correctly.


Bikerdude

Recommended Posts

Have you tried using "LightsOn()" instead of lamp_auxiliary_room_1.fadeToLight? fadeToLight bypasses anything and directly sets the color, so the light doesn't know it is now on, or off or changes the skin.

 

If LightOn() does not set the right color and fadetime, you can change that with spawnarg on the light entity before.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I would the light to fade on, rather than just come on if it all possible. And worst case I can work around the issue by having a model with a colour_me skin and a plain light etc.

 

As you know, I know pretty much zero about the scripting language we use in the mod, so when you say "LightsOn()" instead of lamp_auxiliary_room_1.fadeToLight? how do you mean 'exactly? and would the "LightsOn()" arg be an instant on instead of fade-to on?

Link to comment
Share on other sites

I'm still at work so not tested, but I think you just need to replace FadeToLight in that script with FadeInLight. The rest of the line stays the same.

 

They mostly do the same thing, except that FadeToLight specifically avoids doing the extra stuff that happens when a light goes on or off.

Link to comment
Share on other sites

I would the light to fade on, rather than just come on if it all possible. And worst case I can work around the issue by having a model with a colour_me skin and a plain light etc.

 

As you know, I know pretty much zero about the scripting language we use in the mod, so when you say "LightsOn()" instead of lamp_auxiliary_room_1.fadeToLight? how do you mean 'exactly? and would the "LightsOn()" arg be an instant on instead of fade-to on?

 

Steve's variant is much better. (But we really should document the script events a bit better, the doc doesn't mention that important difference that "fadeToLight()" only works on lights that are already on.

 

Anyway, if your light is an entity with the "tdm_light_holder" script object, then you can do:

 

$lamp_auxiliary_room_1.LightsOn();

 

If it is just a plain light, you can only call the script events that are documented in script/tdm_events.script. Basically, a script object attached to an entity provides extra functionality. See http://wiki.thedarkmod.com/index.php?title=Script_objects

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

  • Steve's variant is much better. (But we really should document the script events a bit better, the doc doesn't mention that important difference that "fadeToLight()" only works on lights that are already on.
  • Anyway, if your light is an entity with the "tdm_light_holder" script object, then you can do:

$lamp_auxiliary_room_1.LightsOn();

  • Well I had a play and just changing " fadeInLight " didnt work when it had " ( electricLightBright, 1.5 ) " after it, so removed it and still the skin dosent change.
  • Im guessing it does, but again like I asked before, will this fade the light on, or switch it on instantly..? Or is that what the 1.5 value inside the () brackets is for ..?

Well tried " $lamp_auxiliary_room_1.LightsOn( 1.5 ); " and I just get a unknown value error in the console. The light entity in question is "atdm:lamp_electric_grill__short_lit" btw.

Link to comment
Share on other sites

You need the right amount of parameters for each function. fadeInLight() takes the time:

 

scriptEvent void	    fadeInLight(float time);

 

So you can only fade in the light to the _already set in stone_ light color over a given time, but not set the light color AND fade it in over time.

 

The code atleast looks to me like it will:

 

* fade the light over time to the full, preset color
* run On(), so it should also swap skins

 

But I'm not certain when the skin will switch, I think it is right before the fade completes. (which might not be what you want)

You might want to try this:

 

$lamp_auxiliary_room_1.fadeToLight( electricLightBright, 1.5 );
sys.wait( 1.5 );
$lamp_auxiliary_room_1.On();

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Another possibility is to change the entity def:

 

// entity 6
{
"classname" "atdm:lamp_electric_grill__short_lit"
"name" "lamp_auxiliary_room_test"
"_color" "0.70 0.55 0.30"
"light_center" "0 -8 0"
"light_radius" "125 125 125"
"model" "models/darkmod/lights/non-extinguishable/grill_light_short.lwo"
"nodiffuse" "0"
"noshadows" "1"
"nospecular" "0"
"origin" "136 -91 112"
"parallel" "0"
"rotation" "-1 1.11022e-016 0 -1.11022e-016 -1 0 0 0 1"
"start_off" "1"
}

 

(set the color to the one you want)

 

and then use

 

$lamp_auxiliary_room_1.fadeInLight( 1.5 );

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Well, it distinguishs between capital and small letters, as many programming languages do either. I never noticed any problems with spaces, though.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • JackFarmer

      Somehow I admire the fact that the material from Dune has now been filmed for the third time. Personally, I could never do much with the material, but as a child of the 80s, I of course know the David Lynch movie...and that movie was at least funny!
      · 2 replies
    • Baal

      Episode 3 of the second best Doom 3 mod, Phobos,  was just released.
      · 5 replies
    • snatcher

      TDM Modpack v4.2 released!
      · 1 reply
    • The Black Arrow

      Hey @nbohr1morehow come the zombies in The Dark Mod don't have a "resurrection" mechanic to it, similar to how Thief has it?
      They're quite a weak creature as of right now, it's merely a walking corpse that slashes you, making attacking them to kill them an actual strategy.
      Would be better if they had some cool mechanism to it that truly makes them a danger, such as the resurrection idea itself.
      · 7 replies
    • Ansome

      Query: when was the last time a zombie in a video game was unnerving or scary to you? I'm chipping away at my anniversary submission and I've been trying to gather opinions on the subject. I'm perfectly capable of lighting them well, changing their sfx, and creating effective ambience, but I'm worried that zombies at their core are just too overdone to be an effective payoff to the tension I'm creating.
      · 14 replies
×
×
  • Create New...