Jump to content
The Dark Mod Forums

Trying to create a new Gaslight entity:


Bikerdude

Recommended Posts

So created a new light entity and checked it works -

 

entitydef light_gasflame
{
"inherit"	"light_extinguishable"
"editor_usage"   "Static gas flame with glare"
"editor_displayFolder" "Lights/Light Sources/Gas Flames"
"mins" "-1 -1 -2"
"maxs" "1 1 2"
"model_lit"	"tdm_fire_gaslight_glare_02.prt"
"model_extinguished" "tdm_smoke_candleout.prt"

"falloff"	"0"
"texture"	"lights/biground_candleflicker_shadow"
"_color"	"0.80 0.6 0.23"
"light_radius"   "130 130 110"
"snd_lit"	""
"snd_extinguished"  "tdm_candle_extinguish"
"should_be_vert"  "1" // grayman #2603 - douse if flame orientation is > 45 degrees from vertical
}

 

But when I attached the new light source to the lamp_wall_gaslight entity, it dosent appear.

 

entityDef atdm:lamp_wall_gaslight04
{
   "inherit"                            "atdm:static_electric_light_unlit_base"
   "model"                                "models/darkmod/lights/extinguishable/wall_gaslight03.lwo"
   "editor_setKeyValue model"            "models/darkmod/lights/extinguishable/wall_gaslight03.lwo"
   "editor_displayFolder"                "Lights/Model Lights, Static/Switchable/Gas/DoNotUse/Deprecated"
   "editor_usage"                        "An unlit wall-mounted gas lamp with an open top. Can be toggled on/off when linked from a switch."

   "light_radius"                        "260 260 260"
   "_color"                            "0.60 0.50 0.30"

   "skin"                                "lights/gaslight_brass_unlit"
   "skin_lit"                            "lights/gaslight_brass_noshadow_fix"
   "skin_unlit"                        "lights/gaslight_brass_unlit"
   "texture"                            "lights/biground1"

   "s_volume"                            "-25"
   "s_waitfortrigger"                    "0"

   // need a better sound
   "s_shader"                            "gaslight"

   // add the spawnarg in the editor, to allow easier changing
   "editor_SetKeyValue s_shader"        "gaslight"

   "extinguished"                        "1"

   "light_center"                        "-1 0 7"
   "editor_setKeyValue light_center"    "-1 0 7"
}

entityDef atdm:lamp_wall_gaslight_04_lit
{
   "inherit"                            "atdm:lamp_wall_gaslight03"
   "model"                                "models/darkmod/lights/extinguishable/wall_gaslight03.lwo"
   "editor_setKeyValue model"            "models/darkmod/lights/extinguishable/wall_gaslight03.lwo"
   "editor_displayFolder"                "Lights/Model Lights, Static/Switchable/Gas"
   "editor_usage"                        "A lit wall-mounted gas lamp with an open top. Can be toggled on/off when linked from a switch."

   "extinguished"                        "0"
   "skin"                                "lights/gaslight_brass_noshadow_fix"

}

Link to comment
Share on other sites

Update the OP, as I still cant figure out why this isnt working, I've attached a test map.

 

I think I might be doubling up on the number of lights sources and what I might need to do is create a new light entity base. That said, my original objective was just to add a particle effect to the gaslight entities.

 

Figured it out, has to change the inherited entities from -

 

entityDef atdm:lamp_wall_gaslight04
{
"inherit"							"atdm:static_electric_light_unlit_base"

and

entityDef atdm:lamp_wall_gaslight_04_lit
{
"inherit"							"atdm:lamp_wall_gaslight03"

to

entityDef atdm:lamp_wall_gaslight04
{
"inherit"							"atdm:lamp_gaslight"

and

entityDef atdm:lamp_wall_gaslight_04_lit
{
"inherit"							"atdm:lamp_wall_gaslight04"

 

The primary inherited arg of "atdm:lamp_gaslight" was key, it seems the "static_electric_light_unlit_base" did not want to play ball with my new light source.

Link to comment
Share on other sites

Ok, it seems I am doubling up on light sources and I haven't been able to figure out why -

entityDef atdm:lamp_wall_gaslight04
{
   "inherit"                            "atdm:lamp_gaslight"
   "model"                                "models/darkmod/lights/extinguishable/wall_gaslight03.lwo"
   "editor_setKeyValue model"            "models/darkmod/lights/extinguishable/wall_gaslight03.lwo"
   "editor_displayFolder"                "Lights/Model Lights, Static/Switchable/Gas/DoNotUse/Deprecated"
   "editor_usage"                        "An unlit wall-mounted gas lamp with an open top. Can be toggled on/off when linked from a switch."

   "light_radius"                        "260 260 260"
   "_color"                            "0.60 0.50 0.30"

   // attach the missing gas flame & glare
   "def_attach"            "light_gasflame"
   "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"    "-1 0 7"    // Offset the flame X units in the Z direction

   "skin"                                "lights/gaslight_brass_unlit"
   "skin_lit"                            "lights/gaslight_brass_noshadow_fix"
   "skin_unlit"                        "lights/gaslight_brass_unlit"
   "texture"                            "lights/biground1"

   "s_volume"                            "-25"
   "s_waitfortrigger"                    "0"

   // bikerdude created a better sound.
   "s_shader"                            "gaslight"

   // add the spawnarg in the editor, to allow easier changing
   "editor_SetKeyValue s_shader"        "gaslight"

   "extinguished"                        "1"

   "light_center"                        "-1 0 7"
   "editor_setKeyValue light_center"    "-1 0 7"
}

Link to comment
Share on other sites

If you attach a light to your gaslamp, why do you let the lamp itself emit light, too?

 

Btw.: If the light comes from an attachment, the entity you attach it to should be a func_static, not a light entity, too. ;)

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

Hey obs

 

I have never done this before so I am kinda grabbing at straws, I thoguht it would be a simple case of look at an existing lighht entity with flame based particle and change all the details to suit.

 

I dont fully understand what Im doing wrong or right, spent 3 hours last night and then gave up and went to bed.

Link to comment
Share on other sites

You attached a light entity to an light entity, so both the attached entity and the entity you have attached it to are emitting a light. Simple as that ;)

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

Just trying to figure this out myself. The atdm:lamp_gaslight is a light that has a lamp model specified. So its model slot is used up already and you can't add a particle. To add anything else you'll need to def_attach it like you are doing. Your light_gasflame is another light that but one that has a particle as its model, so attaching that you get the particle but end up with 2 lights.

 

You could make a new entity def that inherits "func_emitter" and that specifies the particle as its model, then def_attach that. That way you get the particle without the extra light. But it probably won't toggle off when you switch the light off.

 

You'd probably be better off starting with a torch entity def and adapting it. Change the torch model for the lamp, and the def_attached light to your light_gasflame.

 

There are two completely different types of entity light in TDM -- the ones with particles like torches have a static model as the base entity, and they def_attach a light that has a particle effect. The other ones like electric lamps have a light as the base entity, with a visible "model" specified instead of a particle. Right now the gaslamp is the second type, but you probably want to change it to the first type so that the particle stays in sync with the light.

Link to comment
Share on other sites

To attach a particle to any other entity, create a custom particle entity like this:

entityDef nameOfMyEntity
{
 "inherit"  "func_emitter" //fs also works, but this way it is more clearer what it does
 "model"  "spectacularParticle.prt" //points to the particle to use
}

You can now attach this entity via an entityDef or simple create this entity in DR and manualy bind it to any entity.

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

The original idea was to try and reduce the entity coun in the map by having a single entity with all the requred items (model, light, particle) etc. Also another advantage of this is the particle will switch off when you switch the light off.

 

And on a related note, correct me if Im wrong but I dont think we have any particle entites like that in the mod?

Link to comment
Share on other sites

And on a related note, correct me if Im wrong but I dont think we have any particle entites like that in the mod?

Aaaaand ... ?

The original idea was to try and reduce the entity coun in the map by having a single entity with all the requred items (model, light, particle) etc. Also another advantage of this is the particle will switch off when you switch the light off.

You can either use a light entity with the lamp as model and a particle def_attached to it or a light entity with the particle as a model def attached to a func_static having the lamp as a model. I don't think one entity can have several models,a lthough I never tried to be honest.

 

So in any way I think you need two entities anyway.

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

There's code for one func emitter to have several particles

At the same time?

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

It is in fact possible to have light, model and particle on the same entity: instead of using def_attach to spawn additional particle/light entities on a base entity, you just make a light or editor_light, give it a "model" spawnarg pointing to your lamp model, and in the model itself you add a single triangle which is the emitter and use a material with the "deform particle" declaration to turn that triangle into a particle emitter rather than rendered geometry.

 

However this does require adding the emitter triangle in the model itself using a 3D application, which might be tricky if you are not used to 3D modelling or you want to use an existing model that isn't in a format you can edit. On the other hand it would achieve the goal of using only a single entity in the map.

Link to comment
Share on other sites

That's clever. I'd never thought of that. How would you tell it which particle to play? Does that go in the material file too?

 

Yep. Check out the entry for "deform particle" in this page. The particle declname goes right after the keyword.

 

I guess you might actually want "deform particle2" which doesn't vary the particle count based on triangle area. I think the first one is designed for the sort of "burning flesh" demon effects in D3 where the actual surface of a monster seems to be on fire.

 

Oh, and in anticipation of the follow-up question "But how would you switch the particles off when the torch is extinguished?", this ought to be trivial using a skin.

Link to comment
Share on other sites

Yes.... I've not tested it but there's code to let you specify model, model_1, model_2 etc along with offset_1 offset_2

 

I'm probably responsible for this, as I added it back when I wanted SEED to be able to combine multiple emitters into one entity. But I never extended it to multi-models in general, and also the specification of the emitters is very clumsy (manually adding the offsets is not fun).

 

Technically, however, multiple models per entity should be easy, instead of just presenting the "one and only" model to the renderer (and saving its renderhandle), present multiple models to the renderer and store (and save/load) all render handles.

 

Basically just extending the scalar var into an array.

"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

    • 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.
      · 4 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
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...