Disallow leaving temporary camera view, while still allowing keyboard events? - by qolelis
qolelis on 22/1/2014 at 02:39
I just woke up in the middle of the night and couldn't get back to sleep. Thanks everyone for helping out! I have a few more options now. :D
Quote Posted by LarryG
Maybe do a cutscene instead? Record what you want the player to see and then play it instead of doing it live.
Quote Posted by R Soul
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.
Hmmm, yeah, I kind of never thought of that. I would have to record two different videos, since the cutscene may play out differently depending on certain decisions the player makes prior to the cutscene - but if I can record one, I can record two, so that shouldn't be a problem. A video being pretty fixed in all other regards won't matter, I think, in this particular situation. Using a prerecorded cutscene is definitely an option.
Quote Posted by R Soul
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.
The thing is that Garrett will be
hiding in a pretty tight spot (it's a main event, so I don't want to spoil it (even though that makes it harder to discuss...)) and he will be literally kept from looking around. He might be able to to turn his head from side to side, but that's all.
Quote Posted by Yandros
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.
Well, if
you do it; I think I could "get away" (without meaning to sound
too cheeky ;)) with it too. I honestly don't even remember that I couldn't use the keyboard during that event in DP2, but I do remember having a great time playing it, so maybe I worry too much... (maybe I should rename the thread to "How I stopped worrying and learned to love disabling the keyboard."...)
Quote Posted by Nameless Voice
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!)
Hmmm, from the sound of it, that would solve all my problems (How did you manage allowing only Escape?). I do have one question, though ("Oh, Qolelis, sometimes you're such an ungrateful bastard." :erg:), regarding Escape:
Quote:
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.
Would that work even if
sim_menu happens to be bound to something arbitrary (not necessarily the Escape key)?
Thanks, I'm eager to try it out as soon as possible and, what the heck, I can't sleep anyway, so I might as well do it now; I'll be back.
Nameless Voice on 22/1/2014 at 02:46
As far as I know, you can't rebind the esc key from the in-game configuration.
If someone is crazy enough to change the binding manually in the binding files, I think they deserve to not be able to escape out of the cutscene.
It just checks for the escape key, explicitly. It doesn't bother to check the bindings.
If I really wanted to do a through job of it, I'd be more interested in working out what key is assigned to quickload, and keeping that available too, rather than worrying about people rebinding sim_menu.
As for how it's done: a timer checking if the escape key is being pressed, every 20ms while the remote camera is active.
qolelis on 22/1/2014 at 03:12
Shouldn't DescribeKeyBinding (I haven't tried it myself, though) do the job (both for finding out which key is bound to sim_menu and which is bound to quick_load, so that you then can listen to only those two keypresses)?
I was going to edit my previous post to add the following, but since you already replied, it may be a moot point by now:
That's almost perfect. Everything seems to be working as expected, but you seem to have hardcoded the Escape key: If I bind sim_menu to Enter instead (and Escape to +use_item (to which Enter was previously bound)), Escape still takes me to the menu when your script is active, which is inconsistent with what happens when your script is not active. I might be talking out of my rear parts now, but if you can check keypresses directly, shouldn't it be simple enough to check if the key pressed is actually bound to sim_menu before invoking it, or is there a lot of trickery involved to read the keyboard (as you hinted on earlier)?
Edit:
Oh, I'm pretty used to editing the .bnd files by hand now, so I never even use the in-game editor.
Yandros on 22/1/2014 at 03:13
NV, I love you. This not only solves the problems described in this thread, it also combines several scripts into one. Thanks!
So, qolelis, I plan to change to this in my future missions, including DCE.
LarryG on 22/1/2014 at 04:18
Quote Posted by qolelis
Oh, I'm pretty used to editing the .bnd files by hand now, so I never even use the in-game editor.
:wot: There's an in-game editor for the key bindings?? Actually I knew that, but never found it as convenient as manually editing the bindings. It's really painful to scroll through them in the editor.
qolelis on 22/1/2014 at 05:07
I hear ya, LarryG.
[rant]
I, for example, had to edit user.bnd to be able to temporarily disable texture filtering in-(proto-)game, because it wouldn't work for some reason putting the keybinding in Default.bnd. I probably even can't use the in-game configurator anymore, since that would delete my own special and carefully edited user.bnd-keybindings; at least I think so, but, anyway, I just find it a lot easier to edit them by hand being able to search to avoid conflicts etc...
[/rant]
Nameless Voice on 22/1/2014 at 08:33
The in-game binding shouldn't interfere with any bindings made manually, so long as you don't rebind the key.
Either way, did any of you actually rebind sim_menu to something other than escape?
Plus, you're editors, not normal players.
qolelis on 22/1/2014 at 11:13
Quote Posted by Nameless Voice
Either way, did any of you actually rebind sim_menu to something other than escape?
Yeah, I prefer Ctrl+Shift+K for accessing the menu, that's what I always use. Not really, but, for all we know, it could be bound to anything.
My point is that hardcoding things is generally a bad idea, especially if it can be avoided. My experience is that if something is possible, then someone will eventually come along and do it - especially if it has the potential to break things. If you would be willing to invest time in finding out what quick_save (and quick_load) is bound to, then doing the same with sim_menu wouldn't require any extra effort. Now, this might of course not be possible, after all, or be too complicated for it to be worth it, but you know you want to. :p
Quote Posted by Nameless Voice
Plus, you're editors, not normal players.
:laff: "We're all crazy down here, Henry! We're all crazy! When you're down here with us, you'll be crazy too!"
"Editors are people too, and if you prick us, do we not bleed?" Editors play games too, every once in a while.
Nameless Voice on 22/1/2014 at 12:01
If everything stops working, you panic and press Escape, seems logical to me!
The reason I didn't try to figure out the bindings is that it looks like it returns some kind of human-readable string, such as "Escape"; how do you convert that into the VK_ESCAPE (0x1B) constant without a huge lookup table?
qolelis on 22/1/2014 at 17:48
Quote Posted by Nameless Voice
If everything stops working, you panic and press Escape, seems logical to me!
Oh, I'm not arguing that; I'm just trying to encourage consistency and generalization based on how LGS decided to set things up.
Quote Posted by Nameless Voice
The reason I didn't try to figure out the bindings is that it looks like it returns some kind of human-readable string, such as "Escape"; how do you convert that into the VK_ESCAPE (0x1B) constant without a huge lookup table?
Aah, I finally tried that function and I see what you mean; that indeed presents a bit of a challenge - or a slight bit of tedious handywork. It also returns multiple key descriptions (separated by " or ") in the same string if there are multiple keys bound to the same command, which presents even more work (together with extracting info about modifier keys being involved or not). Okay, I'm convinced now that it probably isn't worth it. Oh well, I'll move on now. Thanks for writing the script. :D