Jump to content
The Dark Mod Forums

Trigger a speaker when spotting an AI?


Springheel

Recommended Posts

I have an AI patrolling around, and I want to trigger a voice-over when the player gets a good look at him. The vo is commenting on the AI's appearance, so it won't make sense if the player says it when the AI is far away.

 

What is the best way to accomplish this? I don't want a static trigger, since the player could trigger it when the AI is at a different spot on his patrol.

 

I was thinking about maybe def_attaching a trigger to the AI, so it moves with them, but I don't know if that's even possible, or if there is a better solution.

 

Anyone know an effective way of doing something like this?

Link to comment
Share on other sites

Unfortunately a trigger big enough to trigger the player at a reasonable distance could also contact the player through walls when they can't actually see the AI. Or the player could trigger it while their back is turned, so they haven't seen the AI yet.

 

Unless there's a trigger that requires the player to be able to see the origin?

Link to comment
Share on other sites

  • Unfortunately a trigger big enough to trigger the player at a reasonable distance could also contact the player through walls when they can't actually see the AI. Or the player could trigger it while their back is turned, so they haven't seen the AI yet.

Unless there's a trigger that requires the player to be able to see the origin?

  • ah ok, in that case will the player only be able to see said Ai from a few locations? then just place a info_tdm_objective_location to play a speaker once the player and the Ai are both inside it..?

no idea, that sounds like a Steve/Grayman question.

Link to comment
Share on other sites

The first thing that comes to mind is having an invisible objective where two objects need to be w/in a certain distance of each other, which causes a script to run or a target to be activated.

 

Unfortunately, that suffers from the same problem you cited above; this can fire when there's no LOS.

 

My next thought was a conversation where the player and the AI are the actors. You'd probably want to use the 'talk distance' requirement, though, to guarantee that the player could see the AI. But that might be too close. (I don't know what the talk distance is currently set to.)

 

My third thought was to script this. Every second or so, have the script run and do these things:

 

1 - See if the distance between the player and the AI is short enough to make sense.

2 - See if the player can see the AI, taking into account the player's FOV and lighting on the AI. (Or perhaps ignore lighting.)

3 - If 1 and 2 are good, then trigger your favorite method for making the player speak. Then exit.

4 - If 1 or 2 fails, the script sleeps for another second or so, and tries again when it wakes up.

Link to comment
Share on other sites

If you script the whole thing (as I think you will have to do), I would also suggest to lock the camera on the AI for as long as the sound plays. That way the player knows for sure what exactly the voice over is about. This would also help,that the player actually sees the AI and does not start the voice over when he gets into the right distance, but has his back turned or looks at another direction. Although writing this I notice that it also makes no sense to suddenly be turned around to watch an AI, that you did not notice before... Anyway, it might still be a problem, if you can only check the distance and not the line of sight. Is it possible to check for a vector (line of sight) to cross a point/area/space (volume around the AI) as a trigger in a script? I am not well versed in scripting, but this could be added to the distance condition. If there is only a few entrance points, you could add the "looking a specific direction" Moonbo suggested, for each entrance point, if it covers the possible positions of the AI.

 

And another idea, that just popped into my head: If you want better control over where the AI actually is, you could let the guard stand there and just start the patrol a second before the player is able to see it. That way it would look like the AI is always patrolling and you don't have the problem, that you don't know where the AI is, when the player might see it.

Link to comment
Share on other sites

Another way, more of a hack but maybe with the least work, would be to attach a func_securitycamera to the AI. Those things detect the player even in complete darkness as long as there's line of sight. The camera could be set to have a 360° field of view, have a fast reaction time, and trigger the voiceover when alerted. It could also delete itself afterwards because it won't be needed anymore.

Link to comment
Share on other sites

If you want better control over where the AI actually is, you could let the guard stand there and just start the patrol a second before the player is able to see it. That way it would look like the AI is always patrolling and you don't have the problem, that you don't know where the AI is, when the player might see it.

 

 

Hmm, that sounds like the least work intensive way to handle it...thanks!

Link to comment
Share on other sites

check out Obsttorte's thread, he has a custom trigger that activates when looking at a specific direction.

http://wiki.thedarkmod.com/index.php?title=Triggering_events_when_looking_at_something

  • Like 1

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

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