Jump to content
The Dark Mod Forums
demagogue

Newbie DarkRadiant Questions

Recommended Posts

There's a spawnarg on lights that turn off shadowcasting (for optimization reasons), and these lights will go through all objects and brushes. So the first thing I'd check is that that shadowcasting spawnarg is turned so that it casts shadows.


What do you see when you turn out the light? I can't tell you but I know that it's mine.

Share this post


Link to post
Share on other sites

It's definitely on, and it's definitely casting shadows... everywhere except a tiny polygonal bright patch on a wall, as through it's shining through a little irregular hole. Except that little hole doesn't exist.

In case my earlier explanation was unclear, here's a rough schematic:

 

weirdo.png.419ca1cad0bc73fb32a50e84c56e7ade.png

The beam of light is passing through two func_statics comprising part of my cellar wall, a brush making up the cellar ceiling/house floor, and a pillar that's currently made of brushes. No light falls on the cellar ceiling behind the func_statics or on the pillar, but there's a small illuminated bit on the wall right behind the pillar. It's definitely that light: it's the only one that I made a lurid blue colour.


{ 0 | 🞵 }

My missions:          the Factory Heist

Share this post


Link to post
Share on other sites

Looking at that image, that wall is the 4th element hit by the light after the first func_stat that creates the shadow. That makes it sound like the render engine isn't backtracking far enough to the shadowcasting element. You could test that by moving or temporarily getting rid of some of the middle brushwork and see if the shadow casts then.

But one way you could at least fix the problem if it's a rendering hiccup is to reduce the light radius so it doesn't reach that wall, and then maybe have some invisible lights in the other directions if you want the light to spread in other directions.

  • Like 1

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Share this post


Link to post
Share on other sites

Thanks for the advice. It put me on the right track and I finally found what I think was going on.

Moved the pillar -> problem solved

Replaced it with a simple square brush -> no problem

So I took a very close look at my pillar and found a tiny little bit of caulk from my extensive use of the clipper tool that I'd somehow missed retexturing. When I fixed that, the rendering issue disappeared. I'd guess backtracking and finding some caulk tricks the renderer into doing some sort of hasty and stupid "optimization".

No big deal. My major worry was that light shining from the cellar to the dining room would nullify all the visportals between those areas and lead to performance issued down the track.


{ 0 | 🞵 }

My missions:          the Factory Heist

Share this post


Link to post
Share on other sites

Two more beginner questions:

How come lanterns don't respect the extinguished spawnarg, and how do I make a lantern start switched off?

I have a door that I'd like opened by a key inserted into a secret button, but only if the generator powering the door's mechanism is running. That is, key activated but only if a certain switch is on. Turn the generator off and the door cannot be opened or closed. How would I go about making that?


{ 0 | 🞵 }

My missions:          the Factory Heist

Share this post


Link to post
Share on other sites
1 hour ago, thebigh said:

How come lanterns don't respect the extinguished spawnarg, and how do I make a lantern start switched off?

From a glance at one of the lantern entity classes, it doesn't use a scriptobject (which would read the "extinguished" spawnarg). You could try giving it "scriptobject" "tdm_light_holder". If that fails you could investigate the def_attached light entity if there is one (as an actual light it should respect "start_off" even if you can't get "extinguished" working on it or its holder). I'm looking at atdm:moveable_lantern_bullseye, which actually attaches light_lantern_bullseye_spotlight_unlit by default.

Edited by VanishedOne
  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites
8 hours ago, thebigh said:

Two more beginner questions:

  1. How come lanterns don't respect the extinguished spawnarg, and how do I make a lantern start switched off?
  2. I have a door that I'd like opened by a key inserted into a secret button, but only if the generator powering the door's mechanism is running. That is, key activated but only if a certain switch is on. Turn the generator off and the door cannot be opened or closed. How would I go about making that?
  1. "extinguished" is for flames (candles, torches, fireplaces etc...), electric lights use "start_off" (you cannot extinguish an electric light ;) ) As VanishedOne stated the respective entity probably needs to use the tdm_light_holder scriptobject
  2. you could change the frobability via the generator. So the switch that turns on the generator also changes the frobability of the secret button, which starts unfrobable. Use a target_setfrobable entity for that purpose (that's thesame entity used on footlockers etc... to change the frobability of the items inside, check the respective prefabs to see how it works and you can read up here )
  • Like 1

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

WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Share this post


Link to post
Share on other sites

Is it possible to target all lights of of a spcific type with a single command? I have a switch that turns on a generator, which in turn should switch on all electrical lights. I could target each light with this switch, but since there are over 20 of them, I would prefer, if I could simplify this somehow.

Share this post


Link to post
Share on other sites
37 minutes ago, Destined said:

Is it possible to target all lights of of a spcific type with a single command? I have a switch that turns on a generator, which in turn should switch on all electrical lights. I could target each light with this switch, but since there are over 20 of them, I would prefer, if I could simplify this somehow.

Could call a script like this from the switch:

entity previous_entity = $null_entity;		//assign a starting value to this variable

void lamps_toggle()
{
	float i;
	for (i=0;i<30;i++)			//repeat this up to 30 times
	{
	//look for all lamps with a specific classname
		entity lamp = sys.getNextEntity("classname", "atdm:lamp_type_a", previous_entity);
		previous_entity	= lamp;			//store the search result so the next search doesnt start from scratch

	//if the search has found a valid lamp, trigger it
		if(lamp != $null_entity)
		{
			sys.trigger(lamp);
		}
                       
	//otherwise terminate the search
		else						
		{
			return;
		}                 
	}
}

(Haven't confirmed that this is formatted correctly, might be that I use previous_entity incorrectly. There's probably a way to automatically determine how many times the script needs to repeat.)

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks! I will try that. The switch calls a script, anyway, so I can simply add the one you wrote to that.

Share this post


Link to post
Share on other sites
void lamps_toggle()
{
	light lamp; // using light instead of entity allows access to light specific script functions, although not needed in this specific case
	do 			// using do makes more sense, as you can have as much lamps as you want without having to adjust the script
	{
		lamp = sys.getNextEntity("lightType","AIUSE_LIGHTTYPE_ELECTRIC",lamp); // all electric lights are of the same lightType (I guess ;) )
		if (lamp != $null_entity) sys.trigger(lamp); // brackets not needed if there is only one command to execute		
	} while (lamp != $null_entity); // don't forget the semicolon at the end :)
}

This versions turns lights off that are on and lights on that are off. This should work in your case if all lights start in the same state and there is no other way to change their state (like a button or so). Note that this affects all electric lights, including outdoor street lamps for example.

  • Like 1

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

WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Share this post


Link to post
Share on other sites

@Obsttorte good to see how you'd shorten it and what alternative methods exist to achieve this.

Regarding how it affects all lights of that type, Destined could add a custom spawnarg to all lamps that he wants to be affected i.e. "power_source" "generator_basement1" and then let the script search for that instead:

lamp = sys.getNextEntity("power_source","generator_basement1",lamp);

He'll probably want only the generator to control their lit state, because otherwise the script will need to make the switches become ineffective for as long as the generator is off.

Share this post


Link to post
Share on other sites

My plan was to have one type of lights (to be more accurate: atdm:sphere_brass_ceiling) that will get turned on with the generator in the basement. Having them controlled by additional switches was not planned. So, if I understand "getNextEntity" correctly, I could use "lamp = sys.getNextEntity("classname","atdm:sphere_brass_ceiling",lamp);" to get all lamps of this type? It is very nice to see how a short script can do something that would require a lot of handywork otherwise (it is currently 23 lamps that should be affected).

Thanks a lot!

Share this post


Link to post
Share on other sites
1 hour ago, Destined said:

So, if I understand "getNextEntity" correctly, I could use "lamp = sys.getNextEntity("classname","atdm:sphere_brass_ceiling",lamp);" to get all lamps of this type?

Yep.

  • Thanks 1

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

WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Share this post


Link to post
Share on other sites

I'm trying to create a .tga with transparency, that I can use as a decal. I erased part of the image in Photoshop (old Elements 8 ) to add transparency. I can save as a .png file, and all appeared to be good. But if I try to save as .tga (32 bit, uncompressed), the transparent section comes out white (on reload into PSE, or in TDM). I gather from the Photoshop forums that you have to do backflips and blood sacrifices to get .tga with alpha channel to be emitted. A trip of the .png file through GIMP and exported out resulted in a corrupted .tga

I know there are online file converters, so maybe it will come to that. But I'd like to hear your recommendations.

Share this post


Link to post
Share on other sites
14 minutes ago, Geep said:

I'm trying to create a .tga with transparency, that I can use as a decal. I erased part of the image in Photoshop (old Elements 8 ) to add transparency. I can save as a .png file, and all appeared to be good. But if I try to save as .tga (32 bit, uncompressed), the transparent section comes out white (on reload into PSE, or in TDM). I gather from the Photoshop forums that you have to do backflips and blood sacrifices to get .tga with alpha channel to be emitted. A trip of the .png file through GIMP and exported out resulted in a corrupted .tga

I know there are online file converters, so maybe it will come to that. But I'd like to hear your recommendations.

In my version of Photoshop, the Save As dialog has a Save Alpha Channels checkbox. That does the trick for me. 

Disclaimer: my Photoshop version is very old (CS2) and I'm no graphics expert.

Share this post


Link to post
Share on other sites

Tga with transparency works fine. I'm using Gimp, but Photoshop should work fine too. Gimp requires you to use the layer mask, as selecting and deleting stuff from an image with alpha can cause errors. Otherwise it's just the matter of tweaking alphatest parameter during a diffuse stage.

Share this post


Link to post
Share on other sites

Maybe it just doesn't work if I erase parts of the background directly; the Save As doesn't ask about alpha channels. I guess I'll try to figure out how to do transparency with a layer mask... was trying to avoid that. Thanks

Share this post


Link to post
Share on other sites
12 hours ago, Obsttorte said:

Yep.

The script worked like a charm. Thanks again! Only one thing: TDM does not know the variable type "light", so it has to be entity. Apart from that everything works as intended.

Share this post


Link to post
Share on other sites

tdm_light_holder is the respective type (my fault, it's been a while :) ), but as said in your case it is not required anyways.

  • Thanks 1

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

WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Share this post


Link to post
Share on other sites

In case anyone's interested for future reference, the way id handled control of multiple lights was via the FX system.

Quote

attachlight <light>Attach to external light (a light not defined in the effect) for fading. This is what causes all the lights to fade in/out in alphalabs 2

 


Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

Is there a way to make the "Start mission" button take the player directly to the Objectives screen? I'm playing around with the mainmenu_custom_defs.gui file but I can't figure it out.

Share this post


Link to post
Share on other sites

Wrong file. The "start mission" button and its behaviour is defined in mainmenu_main.gui.


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

WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Share this post


Link to post
Share on other sites

Is it possible for a readable to display text in-game without being frobable?

 

edit: nvm, I fixed it by setting frob_distance to 1. Still technically frobable, but can't be reached.

Edited by thebigh
never mind

{ 0 | 🞵 }

My missions:          the Factory Heist

Share this post


Link to post
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.


×
×
  • Create New...