Jump to content
The Dark Mod Forums

Auto-lock doors?


Springheel

Recommended Posts

I have two AI enter a room through a locked door and start a conversation. They wouldn't stop and close the door before beginning the convo though, so I set the door to auto-close. Problem is, because the door closes by itself, it's no longer locked, and if the player opens it the AI immediately stop their conversation and search (it's a suspicious door). Is there way to have doors relock by themselves?

Link to comment
Share on other sites

How about having the door trigger something when it closes?

 

That something would call a script function.

 

That script function would have the door execute its "Lock" function.

 

In normal operation, when an AI closes and locks the door, the door would trigger and call its "Lock" function, which would do nothing.

 

In your example, when the door auto-closes, the door would trigger and call its "Lock" function.

Link to comment
Share on other sites

Or the conversation could trigger a script, so other door closings wouldn't autolock it (for example, after the player unlocks it).

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

Why are they not locking it? Is the conversation too close to the door so that when they turn around to lock the door they're triggering the conversation which takes precedence?

 

I'm just curious what's causing the behavior, btw.

Link to comment
Share on other sites

Yes, it seems like the trigger is starting the conversation before the AI is done with the door so he doesn't close it. The room isn't big enough to keep that from happening.

Link to comment
Share on other sites

Untested, but is this a way to do it without using a script?

 

Door has "trigger_on_close" "1" and targets an atdm:target_callobjectfunction which has spawnarg "call" "Lock" and which targets the door.

 

EDIT: Oops, just realised this was grayman's suggestion.

Edited by SteveL
Link to comment
Share on other sites

I know nothing about scripts...how do I trigger the door to change its locked spawnarg, instead of its open/closed state?

Link to comment
Share on other sites

You can use the atdm:target_callobjectfunction for that. Place an atdm:target_callobjectfunction and give it two spawnargs:

"target" "name_of_door"

"call" "Lock"

 

Then to lock the door you can just activate/trigger the atdm:target_callobjectfunction, including from within the conversation using (*quickly checks wiki*) the ActivateTarget conversation option, with the name of the target_callobjectfunction as the parameter.

  • Like 1
Link to comment
Share on other sites

Then to lock the door you can just activate/trigger the atdm:target_callobjectfunction,

 

Hmm, this doesn't appear to be working for me. You can just target the atdm:target_callobjectfunction from a regular trigger?

Link to comment
Share on other sites

Hmm, this doesn't appear to be working for me. You can just target the atdm:target_callobjectfunction from a regular trigger?

 

Didn't work for me either, and I also tried "lock", "Open" and "open" all unsuccessfully.

 

But! This did work, there's a atdm_target_changelockstate just below in targets. Set the "unlock" spawnarg to 0. (It causes the lock sound along with locking it.)

  • Like 1

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

Great that you found a workaround, but *why* doesn't the target_callobjectfunction work? Lock() is a documented scriptevent of binary frobmovers like doors. I did try running a test in my debugger before work but didn't get far enough. The debugger can't step through the idClass template code, so I need another breakpoint in the target's code so I can pick up the thread the other side. I'll try to answer this when I get back from my weekend trip.

Link to comment
Share on other sites

But! This did work, there's a atdm_target_changelockstate just below in targets

 

Yes, this worked perfectly.

 

One thing I haven't had time to test...if I use one of these to change the state of a locked door to be unlocked, and an AI walks through it, will he lock it behind him? Or do they only relock "shouldbelocked" doors? Anyone happen to know?

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