User Tools

Site Tools


tnhscript:highlysuspicious

HighlySuspicious

A replacement for SuspiciousReactions. Responds to a Suspicious message (which is usually sent from a pseudo-script) based on parameters read from the string file Strings\SuspParm.str. The first data parameter is the name or ID of the suspicious object, the second is the suspicious type. If the suspicious type is generic, then it is translated based on the object’s archetype. Windows objects have type glass, ExBanner is banner, and RopeArrowRope is rope. If the type is door or lock then the message will be ignored if the AI that originally frobbed the door is on the same or neutral team as this AI.

Suspiciousness Level

The level of suspiciousness is calculated for the object. If it’s greater than 1.0, then the actions (if any) are carried out. The base level is specified with the string type_factor. The number of other suspicious objects that the AI is aware of is counted, as well as the number that have the same suspicious type. These counts are multiplied by type_factor_others and type_factor_similar then added to the base level. Then a random factor from 0.0 to type_factor_random is added.

Suspicious Actions

The actions that can be performed are to raise the AI’s alert level, add an AIWatchObj link to the suspicious object, or go to then frob the object. The string setting type_alert will raise the alert level to the level specified. The alert level won’t be lowered if it’s already higher. After a period of time, specified in either type_alert_time or a global setting, the alert level will be allowed to go back down. Although, that doesn’t mean that it will be lowered right away. If the string type_watch is set, then an AIWatchObj link is created to the object. The value of the string is ignored. If type_watch_time exists, then the link will be removed after the time specified. If type_frob is set then the AI will first go to the suspicious object and then frob it. The object will not be frobbed if it is no longer suspicious when the AI reaches it. For the gaslight type, the value of the string can be on which will have the AI only frob the light to turn it on. Otherwise, a suspicious light that is on may be frobbed off. (If you’re using the NewGasLight script.) If the suspicious type of the object is lock, then the frob action will set the Engine Features\Locked property of the object instead of frobbing it.

After all the actions are completed, then the other suspicious objects that the AI is aware of are scanned and their suspiciousness levels added together, but disregarding the link-counting factors. Each object will also be adjusted based on the time it was noticed. The global setting fade_time is how quickly the suspiciousness level will be reduced. The level will go down 0.01 for the time specified. If fade_time is 0 (the default), then suspiciousness will not be reduced. The total of all levels is compared to alert_level_3, alert_level_2, and alert_level_1. The alert level for the AI will be raised to the highest alert that the suspiciousness is greater than. Each alert level will be sustained for the amount of time specified in alert_time_3, alert_time_2, and alert_time_1. These alert times will also apply to specific actions which don’t have their own time setting. The default time is 10 seconds for each level.

All these factors take quite a bit of experimentation to get “just-right”. The example SuspParm.str file I’ve included is based on the behavior of SuspiciousReactions. You may get better results with other settings.

Messages Suspicious
Properties Engine Features\Suspicious
Links AISuspiciousLink, AIWatchObj
tnhscript/highlysuspicious.txt · Last modified: 2010/11/22 19:11 (external edit)