nicked on 12/4/2020 at 19:42
I'm trying to change an AI's Creature > Time Warp property dynamically ingame based on whether the player is looking at the AI.
I've got the AI receiving TurnOn and TurnOff signals when the player is looking or not looking, that part works fine:
A blue room lever (on by default) is ControlDevice-linked to an NVRelayTrap (NVRelayTrapExclusiveDelay=1; NVRelayTrapRepeat=-1; NVRelayTrapDelay=500)
The NVRelayTrap is ControlDevice-linked to two VisibleRelays, both linked to the AI with a ScriptParams (Visible) link.
The first VisibleRelay is ControlDevice-linked to the AI.
The second has Trap Control Flags: Invert set, and is ControlDevice-linked to an Inverter, which is ControlDevice-linked to the AI.
If I stick NVSpy on the AI, I can see it working beautifully. Every half second, the AI receives TurnOn if you're looking at them, and TurnOff if you're not.
That's where I'm stuck.
I was originally planning to use NVMetaTrap to add a metaproperty with the new Time Warp value, but the problem then is it adds a new one every half second, which is obviously bad for a number of reasons, but also stops the TurnOff message from having any noticeable effect.
NVSetPropertyTrap doesn't look like it responds to TurnOff.
I've probably just thought myself into a corner here, but I can't figure a way to get the AI to smoothly change its Time Warp value based on TurnOn/TurnOff.
Yandros on 13/4/2020 at 00:30
I usually use receptrons to SetProperty in cases like this. So the NVRelayTrap could instead of sending TurnOn and TurnOff send a custom stim at two different intensities, and two receptrons for those could use SetProperty to set the Time Warp value based on any object with the property, or the metaproperties you already have set up as the agent.
nicked on 13/4/2020 at 06:33
That sounds like it'll do the trick. Except, how do I get the relay trap to send a stim? Maybe I've missed something in the documentation...
Edit: Yes, yes I did. It's right there in the NVScript docs.
nicked on 13/4/2020 at 07:16
Yep that works almost perfectly. Only problem now is that when the Time Warp value is very slow, it also delays the time that the new Time Warp value takes to apply. Might need to try something other than Time Warp to freeze the AI.
Edit: Using AI from M-PosedCorpse did the trick. Now if you're looking at the AI, they are frozen. Look away and they come to life. Works like a charm. I'll see if I can record a video.
Edit again:
[video=youtube;vjgF5hj12Ic]https://www.youtube.com/watch?v=vjgF5hj12Ic[/video]
The Watcher on 13/4/2020 at 09:27
Next step: statues that move when you're not looking! :cheeky:
Nameless Voice on 14/4/2020 at 00:52
While NVSetPropertyTrap doesn't respond to TurnOff, you can kind of cheat by using NVRandomPropertyTrap, set to activate on TurnOff.
(NVRandomPropertyTrap is identical to NVSetPropertyTrap, but you can put both on the same object with different configuration.)