Hoamaii Posted May 4, 2016 Share Posted May 4, 2016 Hi guys, I'm having a but of an issue with scripted animation events (player) where I use key and controls for the player to move from one state to another. I use 2 keys in my script (after Disabling some player controls): "activate" and "jump". Tested, it works both for keyboard and gamepad. For some reason I can't explain, I had to register a key for jump and control for activate. When tested on forms, like activators for instance, registering 2 different keys, or 2 different controls worked ok - but when I moved to a spell, only one would register, which is why ended using both control and key in the end. Anyway, my issue is that if the player use the "jump" key while in free camera mode, which of course messes up the animation sequence. Using getCameraState() helped me prevent the use of the activation key while in free camera, that much works fine - but no matter what I try, it does not prevent the use of jump. I'm using onKeyDown(...) so I was thinking maybe I should also script an exception for KeyUp with the Jump key? Or is it simply, that there is no way at all to prevent the use of jump key when AI is still enabled? (I only disable controls, not AI). First time I'm using keys in scripts anyway, so if anybody has some advice for me to find a way to prevent users to jump when in free camera, that'd be great! Thanks :) Link to comment Share on other sites More sharing options...
IronDusk33 Posted May 5, 2016 Share Posted May 5, 2016 I know from experience that OnControlDown only works if that control is enabled. For example, if the "Activate" control is disabled then using OnControlDown won't work. So you should use only keys for this if you are disabling controls. If you disable movement controls you shouldn't be able to jump. Link to comment Share on other sites More sharing options...
Hoamaii Posted May 5, 2016 Author Share Posted May 5, 2016 That's another strange thing, onControlDown works fine in my MagicEffect script with if Control == "Activate", even if the activate playerControl is disabled, and it works both for keyboard and gamepad. Calling the "Jump" control however, doesn't seem to work at all once the "Activate" control has been registered (and yes, I registered the Jump Control too). It's like I can only register one control at a time, either activate or jump, but not both in a MagicEffect script. I tried again last night, registering 2 controls or 2 keys works fine on an activator script, but does not on my Magic Effect. I have to register one as a key and the other one as control, then both work. I can't understand why, as MagicEffect is a Form, right? As for blocking the use of Jump key (or control), whether down or up, when the game is in TFC (free camera mode), that doesn't work at all. I can block the activate control adding a simple camera state check, not the jump. And yes, I did disable movement controls too. I guess I'll have to warn users not to use it in TFC mode, and add a debug feature for those who don't read... ;) Link to comment Share on other sites More sharing options...
Recommended Posts