Disallow leaving temporary camera view, while still allowing keyboard events? - by qolelis
qolelis on 21/1/2014 at 07:50
Is it possible to disallow the player to leave a temporary camera view without disabling the keyboard?
I have a situation where I use Telliamed's TrapCamAttach to temporarily switch the camera view, which works, but I would also want to stop the player from leaving the temporary camera view prematurely. Preliminary, I'm using TrapKillEvents to disable both the mouse and the keyboard, but it would be nice to allow the player to exit to the menu just in case something went wrong, which s/he cannot since the keyboard is disabled. If I disable only the mouse, the player can still leave the temporary camera view by pressing return, which of course breaks everything. This happens as the absolute last thing before mission complete, so the camera never has to return to the player's position (it's not absolutely necessary, anyway).
The use of TrapCamAttach is required, because I need the player to always look in a certain direction.
Edit:
I could perhaps retrigger TrapCamAttach every once in a while without it looking too strange; I'll try that later.
Yandros on 21/1/2014 at 15:09
Aside from your last idea, I don't know of any way to do it. It would be great to somehow allow every key other than Enter, but I don't think that is possible with the existing scripts.
qolelis on 21/1/2014 at 16:11
Yeah, or allow only Escape (or, rather, the keys bound to commands one wants to allow, since the key-bindings may differ), so that the player can at least pause or reload etc... I don't think that can be done even in a custom script!?
Nameless Voice on 21/1/2014 at 17:04
Quote Posted by qolelis
Yeah, or allow only Escape (or, rather, the keys bound to commands one wants to allow, since the key-bindings may differ), so that the player can at least pause or reload etc... I don't think that can be done even in a custom script!?
It... is, but it would be a pain. You'd need to disable the normal keyboard input and then code your own instead.
I did once experiment with a script to do this - disable keyboard input and then read from the keyboard itself to allow the player to type in messages. I think it worked, in theory, but I never pursued it far.
qolelis on 21/1/2014 at 18:06
Quote Posted by qolelis
I could perhaps retrigger
TrapCamAttach every once in a while without it looking too strange; I'll try that later.
I did a quick test and it kind of works, but it doesn't look very good when the screen blinks for a split-second before returning to the alternative view, but, on the other hand, If it's dark enough, the player might not notice... hopefully; there are other details that I planned on including, but I might have to skip those, since they will definitely make the player notice the blinking (when pressing enter (even if it might not happen very often, it's enough to bother me)). There will also be a short moment of sudden silence or drop in volume when the player is moved to the dark room before returning when
TrapCamAttach is retriggered. Hmmm...
Quote Posted by Nameless Voice
It... is, but it would be a pain. You'd need to disable the normal keyboard input and then code your own instead.
I did once experiment with a script to do this - disable keyboard input and then read from the keyboard itself to allow the player to type in messages. I think it worked, in theory, but I never pursued it far.
That sounds like some pretty low-level stuff and something I might not want to even try. I imagine it being something like waiting for a keypress event (or... something), check which key was pressed, then check if that key is bound to for example
sim_menu (which can be done via
IDarkUISrv->DescribeKeyBinding), and, if so, pass the keypress further up the chain (or simply invoke
sim_menu), or, if not, cancel it.
LarryG on 21/1/2014 at 20:19
Maybe do a cutscene instead? Record what you want the player to see and then play it instead of doing it live.
R Soul on 21/1/2014 at 20:52
One of Nameless Voice's scripts is NVCutsceneTrap, so you don't have to leave it till the very end of the mission.
There's also a play_movie command, which can be invoked using Telliamed's CommandControl script.
Another option is to use a CamVator. It's doesn't have to move, but you will need one, or maybe two, TerrPts set up. And so what if the player can look around? I'm sure it'll be obvious which way to look, and if the player is too hyper to look in one direction for a couple of minutes, Thief FMs are not suitable for that person.
Yandros on 21/1/2014 at 23:03
For what it's worth, with regards your original concern - there are at least dozen such cutscenes in DCE, and in all of them, I am using TrapCamAttach and TrapKillEvents to prevent keyboard input. And some of them last in the area of minutes, not seconds. I've done it in previous missions also, like DP2, so don't necessarily feel like it's a bad idea or unprecedented. Well, it might still be a bad idea, I don't know - but in the absence of an alternative, I've taken the approach.
That being said, as Robin said, a camvator solves your problem so long as it's OK for the player to look around. I know sometimes it's not, as was the case with the pub cutscenes in DP2; I have used vators where it didn't matter, though, like the cutscenes in Drymian Codex. If you go that route, he's right that the camvators need not move, at least not perceptibly. They actually do need to move at some rate greater than 0, or else the player will not have fully free mouse movement (vertical panning is locked out, they will only be able to pan left and right along whatever plane the camera is at when the attachment occurs).
R Soul on 21/1/2014 at 23:30
They don't have to move at all. I've done it a few times. You only need to set up one or two TerrPts to prevent a pathfinding error. I think what you're thinking of is a non-elevator object. I tried that before I made my last post and it was horizontal looking only.
Nameless Voice on 22/1/2014 at 01:26
You could try this. I've updated NVCameraTrap to let it disable controls, and also added timeout functionality (useful to stop yourself getting stuck in there!)
Quote:
<h1>NVCameraTrap <i>(NVTrap)</i></h1>
<p>Attaches the camera to the script's object on <u>TurnOn</u>, and returns the view to the player on <u>TurnOff</u><br/>You can use <kbd>NVCameraTrapStatic=1</kbd> to make the camera static (immovable).</p>
<p>Note: In SS2, this script will only work if its object has a unique name.</p>
<p>You can also have the remote camera automatically return after a set time via <kbd>NVCameraTrapReturnTime</kbd>, and disable player input while the camera is active by setting <kbd>NVCameraTrapDisableControls=1</kbd>. Note that the Escape key is never disabled, so the player can still escape to the menu. Also note that you must specify a return time when using the disabled controls option - if you do not, it will default to 10 seconds.</p>