Jump to content
The Dark Mod Forums

Spawning an AI alarm


Springheel

Recommended Posts

Because speaker has this setting, and I assume the alarm entity inherits from it:

 

entityDef speaker {
   "inherit" "atdm:entity_base"
   "editor_color"				  "0 1 0"
   "editor_mins"				   "-8 -8 -8"
   "editor_maxs"				   "8 8 8"
   "editor_material"			   "textures/common/speaker"
   "editor_transparent"		    "1"

   "editor_usage"				  "A generic sound source."
   "editor_displayFolder"		  "Sound"

   "editor_snd s_shader"		   "The sound shader or wavefile."
   "editor_snd snd_demonic"	    "demonic sound shader."
   "editor_var overlayDemonic"	 "set to 1 overlays the demonic sound instead of replacing it."
   "editor_var s_waitfortrigger"   "play on load or play when triggered."
   "editor_float s_volume"		 "Override shader volume level."
   "editor_var s_mindistance"	  "override shader minDistance."
   "editor_var s_maxdistance"	  "override shader maxDistance."
   "editor_var s_omni"			 "force omnidirectional"
   "editor_var s_looping"		  "force looping"
   "editor_var s_occlusion"	    "force no portal occlusion"
   "editor_var s_global"		   "force no falloff at all"
   "editor_var s_shakes"		   "this entity can make the screen shake when the sound is loud."
   "editor_bool s_music"		   "Set to 1 to let the settings menu influence the volume of this speaker"
   "editor_var wait"			   "when set > 0, seconds between triggerings.  time between sounds is wait + or - random"
   "editor_var random"			 "wait variance."

   "editor_setKeyValue s_shader"	   "thunder"
   "spawnclass"				    "idSound"
}

 

I am not sure, but I think the reason that it sets this is so that you can see the value exists and replace it by one that you want.

"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

Hm, it seems if you delete the spawnarg, then it does what it should (no sound). Also, setting it to empty should work, too. So

 

Set f.i.:

 

"editor_SetKeyValue s_shader"				""

 

inside entityDef atdm:alarm_sound and if you create a new one, you end up with an empty spawnarg, and this would disable the sound.

 

I added this setting, can you please update and test it by creating a new alarm entity in DR?

"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

When I deleted that spawnarg, everything seemed to work properly. It's just odd because I don't remember that problem the first time I used them.

Link to comment
Share on other sites

  • 2 weeks later...

Resurrecting this, why do alarm entities come with a built-in "s_shader" "thunder" sound? When I add the alarm to the map, thunder sound starts playing constantly, everywhere. Oddly the one in the trigger_alarm testmap doesn't have that spawnarg, but any new alarm entity I create does.

 

So how do I change the actual alarm sound then?

 

And what is defining in which area the AI will come to the alarm sound? Is it s_maxdistance or alert_volume_mod?

 

Do I need to set a atdm:stop_alarm entity all the time? I inserted just a duration for the alarm and after that the alarm seized (the AI stopped searching too). So I guess this stop_alarm only necessary if I want to stop the alarm manually. It isn't possible to stop the alarm with the same switch that pulled it on, is it?

 

Mysterious entity I would say.. ^_^

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

Oh well, I should have documented it better. But such is life, when you build something, and a year afterwards comes someone along and wants to actually use it...

"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

So how do I change the actual alarm sound then?

 

And what is defining in which area the AI will come to the alarm sound? Is it s_maxdistance or alert_volume_mod?

 

Do I need to set a atdm:stop_alarm entity all the time? I inserted just a duration for the alarm and after that the alarm seized (the AI stopped searching too). So I guess this stop_alarm only necessary if I want to stop the alarm manually. It isn't possible to stop the alarm with the same switch that pulled it on, is it?

 

Mysterious entity I would say.. ^_^

 

Besides this, I noticed that the AI will not use "alert_only paths" (why is it called alert_idle_only in DR btw?) after calming down from the alarm. I guess this really is depending on the situation:

If you raise an alarm (maybe by a trap) when the player steps in, the AI would search for the player and if he don't find him they may say "Hm, false alarm, maybe critters). Then they'll follow their idle_only path. Thats nice.

But what if the mapper says: "No, if this alarm has sounded, there must be an intruder so the guards should use their alert_only paths!" It would be cool to have a spawnarg letting the mappper deceide what happens. Or maybe you can set the "raise alerm level this high" spawnarg.

 

Tels, would be nice indeed if you could help out with the documentation of this entity. I did a little test map for myself to explore the functionality and it's still quit unsure about the things listed above. :wacko:

 

Besides of my previous questions and the suggestion, I want to ask:

Currently the alarm could be triggered by the player itself. That is nice to set up a trap or something like that.

But let's say we want the alarm switched on by the concerned AI? This could be a serveant who runs to a flee point and uses path_interact for switching the trigger. It could also be a guard who, when he's raised to a high alert level, goes to the switch instantly.

I can't think of a solution for this yet. Don't know if it's even possible somehow. The only thing is setting up an alert_only path with trigger_interact at the very beginning. But that's kinda inappropriately because the guard would see a body / player, then search for the player, then after calming down setting the alarm, and then search again.. :mellow:

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

Hm, looking at the actual entity documentation, I am unsure why you are asking some of these questions :) (Also, I forgot how that all works, I have to look it up just like you...)

 

"editor_snd snd_alarm"		  "The name of the sound shader you want to be audible to the player."
"editor_snd snd_propagate"	  "The name of the sound you want to be propagated to the AI. Default is 'alarm'."
"editor_float active_duration"  "Time in seconds the alarm sounds. Set to 0 for infinite."

   "editor_float alert_volume_mod"		 "A factor to multiply the alert volume with. Values higher than 1.0 draw the AI in a greater area, smaller than 1 in a smaller area."
   "editor_SetKeyValue alert_volume_mod"   "1"

 

So you use "active_duration" to change the time the alarm rings (it rings every second). Set it to 10 for 10 seconds, 0 for infinitely long (then you can shut it down via other means).

 

And you use alert_volume_mod to modify the area (e.g. the distance the sound travels) where the sound is heard (1.0 default, 2.0 twice as large, 0.5 half as large).

 

You use "snd_alarm" for the sound the player hears (the default is "default_door_unlocked" which is I think a D3 sound, we need to replace it), and snd_propagate for the sound that is propagating to the AI.

 

Here is the alarm sound that is the default (you should not need to change it):

 

// Tels: Used by atdm:alarm_sound
entityDef sprGS_alarm
{
    "inherit"	   "atdm:propagated_sound_base"
    "vol"		   "98"
    "dur"		   "500"
    "alert_factor"  "3.5"
    "alert_max"	 "50"

    "prop_to_friend" "1"

    "editor_usage"  "Propagated sound by atdm:alarm_sound, intended to alert everyone."
}

 

 

As for stopping the alarm with the same lever that starts it,well that might work, I never tried it. You'd need a lever that does one thing when it is on, and another when it is off.

 

The "alert_factor" was supposed to scale the value the AI get alerted (e.g. how much), unfortunately this was not supported by the code and it was never added. So his doesn't work.

 

Technically, you can also stop/start the alarm by script calls. The alarm entity supports start_alarm() and stop_alarm(), so you might do:

 

$alarm0->start_alarm();   // if your alarm entity is named alarm0 inside DR

 

Technically, I think it must be possible to trigger a script call every time the lever is open or closed, but for the moment I cannot find the spawnargs to do so. (there is only "frob_action_script"). If this is indeed missing, we might add support for this.

 

Anyway, the question about the AI I cannot really answer, I am not a mapper and have no experience with AI at all. Butyou might fake it with something like add a path_node where he walks to the lever, a path_wait a path_anim (or what it is called) and a script that starts the alarm. But you need someone with scripting experience and AI and mapping experience to answer all that.

"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

Hello Tels, thanks for your post!

 

Hm, looking at the actual entity documentation, I am unsure why you are asking some of these questions :) (Also, I forgot how that all works, I have to look it up just like you...)

 

"editor_snd snd_alarm"		  "The name of the sound shader you want to be audible to the player."
"editor_snd snd_propagate"	  "The name of the sound you want to be propagated to the AI. Default is 'alarm'."
"editor_float active_duration"  "Time in seconds the alarm sounds. Set to 0 for infinite."

"editor_float alert_volume_mod"		 "A factor to multiply the alert volume with. Values higher than 1.0 draw the AI in a greater area, smaller than 1 in a smaller area."
"editor_SetKeyValue alert_volume_mod"   "1"

 

Where can I find this? It is not listed in the wiki tutorial, nor in the "add spawnargs" for the alarm entity.

 

For what is snd_propagate? I mean yes "The name of the sound you want to be propagated to the AI. Default is 'alarm'." is okay, but why change this? Isn't it regardless for the AI which sound file is propagated to them?

 

The question for "alert_volume_mod" is what is this "factor"? How can I estimate the area in which it operates exactly so that I know which numeral works for me? Is it a multiple of the s_maxdistance?

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

Hello Tels, thanks for your post!

 

 

 

Where can I find this? It is not listed in the wiki tutorial, nor in the "add spawnargs" for the alarm entity.

 

They are inside the definition of the entity and the "editor_XXX" should indeed make them visible inside DR. Huh?

 

For what is snd_propagate? I mean yes "The name of the sound you want to be propagated to the AI. Default is 'alarm'." is okay, but why change this? Isn't it regardless for the AI which sound file is propagated to them?

 

Yes, they don't hear a "sound", but the "sound" just defines how far it reaches, how loud it appears to them, and how alerted they get by it.

 

The question for "alert_volume_mod" is what is this "factor"? How can I estimate the area in which it operates exactly so that I know which numeral works for me? Is it a multiple of the s_maxdistance?

 

It is a factor because that was the only argument that the propSoundMod() function takes - I have not build that function, just used it. And I have no idea what "s_maxdistance" is, I guess that is something to do with the speaker (e.g. the sound the player hears).

"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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 1 reply
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...