Jump to content
The Dark Mod Forums

Damaging Traps


Springheel

Recommended Posts

I tried something like this a year ago without much luck, but I'm trying again, since there must be some way to do this.

 

What I'd like to do is create a simple trap, like a spiked board, that smacks the player when they trigger something, doing a set amount of damage.

 

I've tried both func_damage entities and func_statics with a damage stim. I couldn't get func_damage entities to work at all, even though they seem to be designed to do exactly what I want. The damage stim works, but it either fires continuously (meaning it kills the player instantly since it fires every millisecond), or I have to set it to fire irregularly, which means the trap can trigger without damaging the player at all. There are various stim spawnargs to "reload" and "sr_timer_time", but I don't understand how they're supposed to work, and experimenting with them has got me nowhere.

 

 

All I want is to have a trap that reliably damages the player on contact, once, and then won't damage him again for X seconds. Surely that must be possible?

Link to comment
Share on other sites

I tried something like this a year ago without much luck, but I'm trying again, since there must be some way to do this.

 

What I'd like to do is create a simple trap, like a spiked board, that smacks the player when they trigger something, doing a set amount of damage.

 

I've tried both func_damage entities and func_statics with a damage stim. I couldn't get func_damage entities to work at all, even though they seem to be designed to do exactly what I want. The damage stim works, but it either fires continuously (meaning it kills the player instantly since it fires every millisecond), or I have to set it to fire irregularly, which means the trap can trigger without damaging the player at all. There are various stim spawnargs to "reload" and "sr_timer_time", but I don't understand how they're supposed to work, and experimenting with them has got me nowhere.

 

 

All I want is to have a trap that reliably damages the player on contact, once, and then won't damage him again for X seconds. Surely that must be possible?

 

I think you need to use a stim effect with "effect_damage" and "player" as target,

 

       "sr_type_1"                     "3"            // STIM_DAMAGE -> script/tdm_stim_response.script
       "sr_radius_1"                   "15"            // Radius in Doom 3 units
       "sr_state_1"                    "1"       // unsure about this
       "sr_collision_1"        "1"               // stim fires when things collide with it
                                                 // hopefully this means every 3s (see below)
       "sr_falloffexponent_1"  "1"               // does this mean you get less damage if you are further away?
       "sr_duration_1"                 "0"          // always activeparticle effect)
       "sr_time_interval_1"    "3000"           // stim check is made every 3s

 

(this seems all a bit undocumented... a tutorial would really really help, or at least a description of all the possible variables and their deeper meaning.... :unsure: )

 

At least we have: http://wiki.thedarkmod.com/index.php?title=Stim/Response_Key/Values

 

and then use an appropriate damage entity like:

 

entityDef atdm:damage_simple
{
       "inherit"                                       "atdm:damage_base"
       "damage"                                        "10"
       "no_sound"                                      "1"
       "noArmor"                                       "1"
       "no_pain"                                       "1"
       "editor_usage"                          "Defines a simple damage base class with 10 points, with no sounds or anything."
}

 

(I do wonder, however, why our player has two damage response:

 

       // The damage response
       "sr_class_2"                                    "R"
       "sr_type_2"                                             "STIM_DAMAGE"
       "sr_state_2"                                    "1"
       "sr_effect_2_1"                                 "effect_damage"
       "sr_effect_2_1_arg1"                    "_SELF"
       "sr_effect_2_1_arg2"                    "atdm:damage_low"

       // The "Thief" stim
       "sr_class_3"                                    "S"
       "sr_type_3"                                             "STIM_PLAYER"
       "sr_state_3"                                    "1"
       "sr_radius_3"                                   "350"
       "sr_falloffexponent_3"                  "1"
       "sr_magnitude_3"                                "1"
       "sr_time_interval_3"                    "1500"

       // The damage response
       "sr_class_4"                                    "R"
       "sr_type_4"                                             "STIM_DAMAGE"
       "sr_state_4"                                    "1"
       "sr_effect_4_1"                                 "effect_damage"
       "sr_effect_4_1_arg1"                    "_SELF"
       "sr_effect_4_1_arg2"                    "atdm:damage_low"

 

greebo, this looks like an accidental duplication?

"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

All I want is to have a trap that reliably damages the player on contact, once, and then won't damage him again for X seconds.

 

Does that mean the spiked board resets itself and the player gets hit again if he stands still?

 

Sounds like what you want is a one-time event. I sure wouldn't hang around after getting smacked.

Link to comment
Share on other sites

Theoretically, the player could trigger the trap more than once (though that would be kind of silly of them). The functionality would be needed for any traps that reset, or swing back and forth--I wanted to do the same thing for a swinging ball and chain trap a while back.

 

I don't know if damage stims can be triggered directly...if so, could I set the stim to fire only once, but the trigger to fire multiple times (thus doing damage once, each time it is triggered)?

Link to comment
Share on other sites

I don't see any direct way to do it because the stim doesn't 'know' if it is effective so it cannot try to harm the player say every 1/3rd of a second then if successful wait say 10 seconds before it tries again. A response could control it by turning of the stim for 10 seconds after damage - but the response in this case is on the player so don't want to meddle with the damage response on the player because it would affect damage from anything.

 

The only workaround I can think of this:

 

Place a trigger_multiple brush and add a deactivated rapid-firing stim to it.

Set the wait spawnarg so it will always trigger at least once if the player is in contact briefly.

When the player steps into the trig then it targets something to activate the stim for 1/Nth of a second then de-activates it then delays n seconds before it works again. Probably use a script for this.

The script removes the target from the trig multi then adds it back again after so it can only fire once every N seconds.

 

[mmm.... seems all the forum posting options are broke. anyone else seeing that?]

Link to comment
Share on other sites

How do weapons damage things? Could I do something ridiculously hacky and attach an invisible attacking md5mesh or something?

 

edit: Based on the wiki, it seems like these spawnargs might do what I want, but I'm not sure how to use them:

Key: sr_timer_time_N (Format: hhhh:mm:ss:ms, for example: 0:3:20:0 which means 3 minutes and 20 secs) (s & r editor = Activation Timer.) This can be used to enable the stim after a certain amount of time. Depending on the sr_timer_waitforstart key the timer is started on spawn or on a "StartTimer" event. Use this to setup a stim that has its sr_state_N set to 0 at start and gets enabled after a certain amount of time. This is only effective if the sr_state is 0 (disabled) by the time this timer is elapsing (s & r editor = Active checkbox.)

 

Key: sr_timer_type_N | possible values: "RELOAD" or "SINGLESHOT" (default) When this is set to RELOAD, the timer is reactivated after the stim has been fired.

 

Key: sr_duration_N This specifies how long the stim is active before it gets disabled.

 

Sounds like what I want to do is start the timer at the moment the trap is triggered, let it be active only for a couple milliseconds, and then set it to reload. After firing for a millisecond it should stop firing and wait for a trigger again.

 

But I don't understand how to trigger the stim. The "a "StartTimer" event" line doesn't make sense to me.

Link to comment
Share on other sites

Well, I'm stumped. There doesn't seem to be a way to do the seemingly simple task of causing damage whenever something is triggered. That really limits the possibilities for traps. I'll file a feature request.

Link to comment
Share on other sites

I remember trying to do something like this in my gas room. When you open the door I wanted a damaging gas-stim but it didn't work, no damage, so just threw in a triggered cough bark.

 

Someone should also write some tutorials for basic custom S&R situations. I felt lost how things worked.

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

Link to comment
Share on other sites

This may or may not work at all, and might not have any benefits over S/R even if it works, but for completeness, I found this:

 

entityDef trigger_hurt {

"inherit" "atdm:entity_base"

"editor_color" "0.8 0.1 0.2"

"editor_mins" "?"

"editor_maxs" "?"

"editor_material" "textures/common/trighurt"

"editor_displayFolder" "Triggers"

"editor_usage" "Damages the activator. Can be turned on or off by other triggers."

"editor_bool on" "Whether or not it is active."

"editor_var delay" "Delay between damage in seconds defaults to 1"

"editor_var def_damage" "Damage def to use, common ones are damage_painTrigger, damage_triggerhurt_100, damage_triggerhurt_1000"

 

"spawnclass" "idTrigger_Hurt"

 

"on" "1"

"def_damage" "damage_painTrigger"

}

 

Next time I come back to this issue I might try it out.

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...