Sperry on 16/10/2018 at 07:09
I remember there being some missions in which the AI acts a specific way (ex. speech or attack) as long as the player has them in their POV. How is this achieved?
ZylonBane on 16/10/2018 at 16:00
Quote Posted by Sperry
I remember there being some missions in which the AI acts a specific way (ex. speech or attack) as long as the player has them in their POV. How is this achieved?
Field of view. If an AI was in the player's point of view it would mean they were inside the player's head.
I don't know how this was achieved in the past, but there's a script service accessible to Squirrel that lets you query whether an object was rendered on the last frame. This seems like the most direct solution.
Yandros on 16/10/2018 at 17:23
I did it with an AI in mission 6 of DCE, but I don't honestly remember how without looking as I basically just did what NV suggested and it worked. I do recall that it had to do with a TweqFlicker though, so it may be similar to how Haplo did it in UVI.
Haplo on 28/10/2018 at 03:43
Yes I did this in Unholy Vivid Innocence and Insanity's Crescendo.
Give your AI (or object) the TrigFlicker script. Set the "Tweq\Flicker\Halt" to "Continue", and "Rate" to 1000 (or how often you want to be informed of the object being in field of view). Leave the rest as "None".
For "Tweq\FlickerState", go for "On, [None], 0, 0".
You'll get periodic "TurnOn" messages along the ControlDevice links as long as the object is in field of view, and one TurnOff when the object exits the field.
vfig on 28/10/2018 at 19:40
Quote Posted by Haplo
You'll get periodic "TurnOn" messages along the ControlDevice links as long as the object is in field of view, and one TurnOff when the object exits the field.
Oh, that's clever! Tweqs only running when they're in the field of view is done as an optimisation, but I like the way you've turned it around to detect where the player's looking :D
I guess in the same way you could use TrigFlicker and the SimSmallRad or SimLargeRad flags to have something that fires only when the player is nearby. A handy technique I'll have to remember!