Jump to content
The Dark Mod Forums

Changing a texture in a func_static based desklamp.


Bikerdude

Recommended Posts

Evening

 

I made a small desktop, but that only fly in the ointment is I cant change the texture of the lampshade when I switch the light on/off

 

any ideas..?

 

[edit] found an alternative lamp glass work around

 

- change the texture to one of the 2-sided glass textures - only issue i have now is Im getting a weird reflection of the candle flame, in that i can see 2 flames instead of one, I assuem the only way to fix that is to edit the material def and remove the reflection line..?

Link to comment
Share on other sites

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

How are you switching it off? If the entity has the following spawnargs:

 

entityDef atdm:lamp_desk
{
"inherit"			   "atdm:static_electric_light_lit_quiet_base"
"model"				 "models/darkmod/lights/non-extinguishable/lamp_desk_01.ase"

"extinguished"		  "0"
"noshadows_lit"		 "1"			 // turn off shadow when lit
// Let the lamp not obscure the light:
"noshadows"			 "1"			 // lit, so has no shadows

"editor_usage"		  "A small desk lamp that the player can toggle on/off with frob."
"editor_displayFolder"			  "Lights/Switchable/Electric/Indoor"

"frobable"			  "1"

"def_attach"			"light_lamp_desk"
"pos_attach"			"flame"		 // At the attach point called "flame"...
"attach_pos_name_1"	 "flame"		 // ... which is defined here.
"name_attach"		   "flame"		 // Give it a name to pass along spawnargs
"attach_pos_origin_1"   "0 0 27"			// Offset the light a bit//doesn't appear to work
"attach_pos_angles_1"   "0 0 0"	 // rotate the light
"light_center"		  "0 0 27"

"skin"				  "desklampshade"
"skin_lit"			  "desklampshade"
"skin_unlit"			"desklampshade_unlit"

"_color"				"0.48 0.48 0.40"
"frob_action_script"	"frob_light_holder_toggle_light"
}

 

That you should see it swap the skin when it goes off/on, and if you make the proper skin, it will switch the texture. Does this help?

"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

Its a new desktop oillamp I made from patches with a little rotary switch. I don't have a skin for it because its not a model.

 

the other issue I have is when I turn the light off the bloody particle effect is still on - its not being removed when the flame is extinguished.

 

Ive attached the little room I am working on - eventually I will make multiple prefabs of this room for mappers to use etc.

room_gp.map.txt

Link to comment
Share on other sites

Its a new desktop oillamp I made from patches with a little rotary switch. I don't have a skin for it because its not a model.

 

the other issue I have is when I turn the light off the bloody particle effect is still on - its not being removed when the flame is extinguished.

 

Ive attached the little room I am working on - eventually I will make multiple prefabs of this room for mappers to use etc.

 

You should really make the lamp into a model - only when it is a model, you can have the skin swapped (this does not work on brushes/patches at all), and also I believe the particle problem is because you have not a model.

 

(Is the lamp supposed to have a flame as light?)

 

As for the standing oil lamp it does toggle on&off for me when I frob it - however, as I said, these should not be frobbable/toggable for the player, as this violates the consistency of these lamps (if one oil lamp is frobbable, theplayer will never expect this so he might miss it - and if he sees it is frobbably, he will try to frob other lamps only to fail so). So all standing oil lamps should really behave the same.

 

btw. nice desk lamp! :)

"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

OK, well I'd suggest exporting an ase and just doing a model based entity. Skin swap is easy, nice model variation too. haven't seen in game yet (having issues still with re-install).

 

I believe the flame issue with that flame based lights need 'extinguished 0' to put out the flame correctly. You has start_off 0.

extinguished 0 is already on the candle flame entity so don't even add it.

I had this issue with a light when working on the test map... I'll try and check in game, I just have to get TDM launching first...

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

Well, tested in my 1.07 for now...

 

The standing lamp does frob highlight, but doesn't turn on/off for me.

 

I can't get the particle to go out either. Don't even know if the code does this (for switches), might be the water/fire stims of arrows that control the flames. So you might be able to rig the dial to send a water stim or fire stim on on/off signals. I haven't messed with stims in so long though...

 

If you want I can export that to a model, clean up the uv's (so the top of glass isn't pinched). All the light entities now have no shadows when on, so a model would be able to swap that too. (currently when on this lamp has huge shadow from glass...good example of why lights have no shadows when on, you just get weird inconsistencies and it's hard to find a good balance between having/not having shadows).

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

yeah BC if you can do that for me it would be greatly appreciated! we can always user more desk lamps. Feel free to use the other 2-sided glass textures (or other if you want to etc). Regarding the shadows, glass would cast a shadow in RL, and having no shadow at all (like the current tdm lamp) just looks wrong - I would prefer a shadow rather than non-at all.

 

How will you integrate the little rotaty switch I have on it though? or will that have to be added manually?

Link to comment
Share on other sites

Well, the glass shouldn't really cast a shadow when light is shining through it right?

Either way, if it's added to tdm it (the entity) will be the same as the rest for consistency, and if you want to have shadows (when lit) in your map that's your choice. (there's now a cvar for that "shadows_lit" I think. - not on all light entities yet as skins make up for some of that in old stuff but it should be on all by 1.08)

 

There's also the option of light shadow textures which works pretty well for streetlamps. It is worse though with indoor lamps as it's just a vertical texture (you get a dark spot shadow in the middle of the ceiling right above a light, so that you'll have shadow at the base of the light) :(

Really having the shadows disabled when on looks best overall IMO. We also had issues on some lamps where part of a lamp casts shadows, other parts don't (so floating shadows, etc..)

 

The switch will just be a new switch model, and you set it up just like you have it now. Not sure if I'll be able to create an entity that just spawns the switch and it works together though, might have to just create a lamp and a switch. So the entity will probably be frobbable for those who don't use switch??? Then you can just check unfrobbable on the lamp if you do use a switch. And you would just link to the lamp itself, not the light attachments.

However, that only takes care of the func_static/model/entity issue.

 

Still not sure what to do about the flame, might need coding.

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

Well, the glass shouldn't really cast a shadow when light is shining through it right?

The only time I would have thought it should have shadows is when its switched off...

 

So the entity will probably be frobbable for those who don't use switch??? Still not sure what to do about the flame, might need coding.

Yeah the switch thing sounds doable and the flame something wierd is going opn as I could have sworn that any flame based light entity kills its particle effect when turned off by a switch...

Link to comment
Share on other sites

I'll see if I can spawn attach a switch and have it work, but I'm skeptical. Would be nice to have all the switches just be an entity. (also chests being able to spawn correctly by just placing a base...)

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

It definitely should be able to define an entity that is a "switch" - after all, a working switch is just some spawnargs on a func_static (that say it is basically a binary_frob_mover). And once you have an entity, you can def_attach to any entity, rotate it etc.

 

Also, with the new "set blah on blah" spawnargs, you might even be able to link the switch to any entity you desire - it might of course be abit cumbersome because IIRC the name of a target must be known, which you don't know for the switch (e.g. when the base lamp is created, it gets assigned a name that is stored in the map, so the entityDef doesn't know this name yet).

 

But I remember that I wanted a "link blah to foo" spawnarg that works like "set" except it sets links between source and target - not sure if I ever did this, but that would be the way you can link the base to the newly spawned switch.

 

Edit: Ah here it is:

 

"editor_var add_link"			

"Adds a link from the source entity to the target entity. The format is 'SOURCE to TARGET', where both source and target
can either be a plain entity name, or a special string of the form 'ENTITY_NAME:attached:ATTACHMENT_NAME'. The
attachment name is usually something like 'flame' or 'candle'. Example adding a link from an attached flame to a light
object: 'atdm_candle_holder:attached:flame to my_light'. Note that the attached entity (here: flame) can also attached
indirectly, e.g. in this example the candle holder has an attached candle (named 'candle') and this candle has an
attached flame (named 'flame'). The 'add_link' spawnarg is useful for adding links to or from entities that are attached
via 'def_attach', as these do not exist prior to the map loading and can thus not be targets in the 'link' spawnarg."

 

I am getting better every day, now I implement stuff before I even know we need it... :D

 

Anyway, it looks like the above still needs an entity name, so you can't do:

 

"add_link" "self:attached:switch to self"

 

and have the switch linked to the base object itself. :angry: That sounds like a very useful addition, and probably is very easily doable. Please file a tracker entry :)

 

(Yes, the code always assumes that an entity name is part of the "add_link" SOURCE and TARGET. Teaching it to also accept "SELF" or "self" as keyword so that refers to the currently entity is very easy and will enhance it greatly. Thus it will work on v1.08. Please still file a tracker entry :)

"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

@Tels,

 

If you can give me one working entity example for this I can go through and make other entites with this set-up.

(ie:switch base with spawned working lever... Just place base in map and link it to a light... frobbing switch in game works (maybe frob peered to created lever?).

 

My main issue is figuring it out in the first place which you're better at no doubt. I can handle the tediuos copy/paste things quite well ;)

 

(I'd eventually like machines with attached levers, etc.../containers with lids and levers/ lamps with switches/ any of these combo items that mappers now have to do a piece at a time... would also help with entity rotations like the issues with the chest prefabs)

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

Baddcog, sorry, that needs first a bit of codesupport. The code for the "add_link" spawnarg always assumes that the names of the entities are know - but if you just spawned entity "foobarbarg" and the switch "bagfuselbog", then this isn't know at the time you write the entityDef - therefore you must be able to refer to the entity base as "self" and the attached switch as "self:attached:switch" - but both cases do not work.

 

Its easy to add, but I need a tracker entry first :)

"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

alright, I'll add one.

 

Hold your horses :D I think, after reading the code, that this might work:

 

"add_link" ":attached:switch to "

 

Because when the entity name is empty, it assumes itself as the entity. However, this syntax is quite wierd, and adding support for "self:attached:switch to self" is definitely desireable :)

 

I see that you added http://bugs.angua.at/view.php?id=3048 - thanx, I'll add the new syntax and make a testmap with both the old and new one to see if it works, and post here later :)

"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

Baddcog, could you maybe add a small switch model (rotating wheel, rotating lever, flipping lever, whatever) to our assets? We only have these huge levers, which are not nec. a good addition to such a lamp :)

 

I am trying to build the testmap right now, but not having a suitable model makes it harder, as it is not possible to have "func_statics" inside an entityDef. :)

"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

Yeah, but I won't be around until tomorrow. Just use one of the huge ones, I'll deal with the actual model issues later. (there's actually a tiny dial on Biker's lamp up there that I'll probably export/edit.

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

Baddcog, could you maybe add a small switch model (rotating wheel, rotating lever, flipping lever, whatever) to our assets?

Yeah, but I won't be around until tomorrow. Just use one of the huge ones, I'll deal with the actual model issues later. (there's actually a tiny dial on Biker's lamp up there that I'll probably export/edit.

 

hehe, BC beat me too it...!!! BC feel free to use another sound if you like, I think 1.08 might have a small/tiny squeek which is what i actually wanted when I built that lamp.

Link to comment
Share on other sites

All right, I use a placeholder for now.

 

However, someone changed the light on the desklamp, and it is now brighter than the sun! Can someone please reverse that change? I don't mind someone improving the entities, but please don't destroy all the hard work I have put into it - esp. if this changes existing maps!

 

(Would have posted a screenshot, but the damn screen shot cannot be found anywhere in my d3 directory *sigh*)

 

Edit: For whatever reasons the screenshot landed under "fms/darkmod/screenshots"... here it is:

 

 

 

This image is not brightened and you can see that even a few meters away I am fully lit.This is definitely wrong!

 

(Btw, the smoldering fires are supposed to have a small glowing light, and I don't think it should be changed. Whether they should just smolder again if you relight them, or convert to a fully lit fire is debatable, but currently the engine does simply not support it. It is either "off" or "smouldering", we cannot have "smouldering" => "off" => "lit").

 

So please, before you change light colors, boundaries or light brightness on the existing entities, make sure it is an improvement, and doesn't just break any map thats using these entities.

"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

Like I said (several times in several places now), there is a test light_entities map and if any wants to look at it before 1.08 so I can tweak ;)

 

I did change that light from yellow to more white. One of the few changes of that type I did (just because every light in game is yellow), a few nicer/newer lamps are now white®. Though I'm pretty sure I didn't change the radius/brightness, but I will double check.

 

But is that an entity in 1.08? I don't notice the projected texture at all and I did have that working.

------------

 

Also, tels, check the fires in the test map. Part of the issue may be that they are next to a wall, so in an area where they aren't next to a wall they might not seem like they have much light at all. Also after Springheel mentioned it it seemed to me that they light was white, but I'll look again. Would definitely be better as orange since they are just embers.

 

I really didn't go haywire on changes, but barely anybody has looked so...

Mainly all I did was get all the entities working, and the few changes I did make were minimal and only done to improve them. (Doesn't mean everyone will like them, but that's why I've asked people to look, so 1.08 goes out better than 1.07 was and nothing needs tweaked afterwards)

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

I think that you actually haven't changed the color, or maybe in a different way.

 

What I see is that the desk lamp itself is a light with this color:

 

0.48 0.48 0.40

 

Formerly, this was this color, as inherited from the base:

 

0.80 0.50 0.20

 

Apart from changing it to an almost neutral (which I think isn't goinf to fly as it will change the visuals in existing maps in a major way!), it doesn't make it much brighter (or so I think).

 

HOWEVER, there is also this light attached: "light_lamp_desk"

 

and it now has this light color:

 

"_color"			    "0.86 0.76 0.51"

 

That's quite bright! And it comes in addition to the other light! So I think the brightness change is because there are now two lights on this lamp?

 

Plus the shadow from the base is missing - I think this shadow is what obscured maybe the base light, and so it is now brighter?

 

 

Fires, smouldering: I tested them in the "test/candles.map" and they are in the middle of a room and looked fine to me.

 

(Btw the candles.map seems to get broken every other week, usualy either the player is stuck in the floor, or the sky flashes, I don't know what is up with that map :( This isn't your fault, badcog, it has been like this for a year or two - d3 sometimes is wierd :(

 

 

Anyway, I am trying to do 15 things at once, so forgive me that I didn't have time to check out your work on the light entities... way too many things to :(

 

 

Btw, the "add_link" works, I'll commit a testmap (test/add_link.map), test entity and the code in 5 minutes. However, it has a problem: As soon as you flip the lever, it seems to also send a signal to itself, so it just starts t flip-flop between on/off - seizure-inducing and needs to be stopped :) But that is for another day...

"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

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

    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 3 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 7 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...