User Tools

Site Tools


dromed:alertgoodai

Alerting Friendly AI with Lockpicking

This tutorial describes a way of allowing lockpicking to have an object teleported nearby, the sight of which will make an AI remove any metaproperty that is being used to make it friendly (e.g. M-AlertCapZero or M-Front Gate Guard).

Before you begin, install a reasonably recent version of Telliamed’s custom scripts. For this tutorial, you need to have tnhScript.osm in your Thief folder, and you need to load it into your mission (script_load tnhScript).

Setup

Adding the Scripts

  • To each lockpick, add the script PickHelper.
  • To the door (other lockable objects will work as well, e.g. containers) add the scripts LockHelper and TrigWorldFocus. The purpose of the second script will be explained later.

Teleporting the Marker

  • Create two TeleportTraps. Place one near the door, and place the other in a blueroom. Give each of them a ControlDevice link to a Marker.
  • Create a ScriptParams link from the door to the nearby TeleportTrap. Data: PickBegin
  • Create another ScriptParams link from the door to the other TeleportTrap (the one that will be in the blueroom). Data: PickEnd

Now, when lockpicking starts, the nearby TeleportTrap will be activated. When lockpicking ends, the blueroom TeleportTrap will be activated.

There’s one more case to consider. PickEnd will not be sent if the player looks away from the door while still using the lockpick. This can be easily fixed:

  • Give the door a ControlDevice link to an Inverter, which has a ControlDevice link to the blueroom marker. The TrigWorldFocus script will see to it that when focus is lost (when the object stops being highlighted), a TurnOff message will be sent along ControlDevice links. The Inverter will then send a TurnOn message to the blueroom TeleportTrap.

Making the AI React to the Marker

For each AI that is likely to see you picking the lock, create an AIWatchObj link from the AI to the Marker, with the following link Data:

Watch Kind: Self Entry
Priority: Very High
Trigger: Radius: Your choice. 8 or 10 should be good values.
Height: Your choice again. 8 is okay unless there is a lot of elevation in the area (e.g. balconies).
Line Requirement: Line of Sight (None might be better)
Response Step 1: Add/Remove Metaproperty
Argument 1: Remove
Argument 2: M-AlertCapZero (or M-Front Gate Guard if that’s what you used)

Feel free to experiment with other values, and of course you can add other actions besides removing the metaproperty.

  • If there will a be a lot of links, first create just one for testing, and when you’re happy with the response of the AI, make use of the AI→Utility→Watch: Watch link defaults property to have the link data set automatically.
dromed/alertgoodai.txt · Last modified: 2009/02/12 08:45 by r_soul