ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator How to stop Shift from doing anything...
person icon
luposian
Registered User
Quote
2023-07-28 08:32:22

I've removed everything that [Shift] would alter in my character's animation, but if I press it, while walking (or just idle), my character goes into the 1st frame of his walk cycle and just freezes there. But I want [Shift] to do absolutely nothing, if pressed. I want [Shift] to be completely ignored, if pressed. But not sure how to completely disable it.

UPDATE: Ok, I've got it where pressing [Shift] by itself does nothing, but if I'm walking and press [Shift] he goes into the 1st frame of his walk cycle and then shudders in place. I want [Shift] to be completely ignored, even when combined with forward or backward walking animation

person icon
VP
Guest
Quote
2023-07-28 09:43:54

Set walk-speed to be the same as run-speed, set run animation to be the same as walk animation.

person icon
VP
Guest
Quote
2023-07-28 10:10:01

Also, if you're using windows (and depending how you have your game set up), turn off "Windows Key-repeat" to stop the key being pressed repeatedly - just in case this is re-triggering the animation.

person icon
luposian
Registered User
Quote
2023-07-28 22:44:51

In every instance, when a movement key (W, S, or Up/Down arrow) is mentioned in control, it's always "key left up" and Idle animation is the default. It never mentions when those keys are actually depressed, what the animation would be. [Shift] somehow plays into the run animation when moving forward or backward, but I don't know why. Now that I've disabled Run (removed all references to it and set Run speed to 0.0), now [Shift] just causes him to freezes (stop moving forward or backward) and shudder in the 1st frame of his walk animation,. If I disable key repeat, in Windows 11, that will make deleting large swaths of text very arduous, because I'll have to keep hitting the backspace key a bazillion times. It might fix one thing, but break another. Not exactly an acceptable tradeoff.

UPDATE: Ok, by setting [Shift] to Walk animation (instead of Idle), if I press it while moving forward/backward, now he just freezes in place at the 1st frame of his walk animation and then advances one more frame and nothing more (no more shuddering). Still trying to figure out how to get CC to ignore the Shift key entirely, so if you press it while walking forward/backward, he simply keeps walking in either direction, as though the [Shift[ key were never pressed (i.e. it's completely ignored). However, if I press [Shift] by itself, he doesn't move, but he shudders as it looks like he's trying to go through frames of his walk animation, but can't.

And if I press the [Space] bar (Jump) while walking forward/backward, he freezes in the first frame of his walk animation and just floats wherever I move him! ARRRRGH! I thought by getting rid of key presses I don't want to do/affect anything, they'd be totally ignored, but they're now just TRYING to do something, but can't, and just make things look... glitchy!

person icon
Guest
Guest
Quote
2023-07-29 07:22:22

Did you try setting run speed to your walk speed and the run animation to the walk animation? The problem is most likely how that behavior is programmed and there isn't anything you can do about that besides program your own behavior or try and use the other behaviors/actions to make the player move and animate like you want.

person icon
luposian
Registered User
Quote
2023-07-29 08:34:13

Guest wrote:
Did you try setting run speed to your walk speed and the run animation to the walk animation? The problem is most likely how that behavior is programmed and there isn't anything you can do about that besides program your own behavior or try and use the other behaviors/actions to make the player move and animate like you want.

Yes, I did and it didn't improve anything. Is there a way, via JavaScript, to circumvent (disable) certain keys, like [Shift] and [Space]? Anyone done this or tried?

person icon
Guest
Guest
Quote
2023-07-29 12:05:03

Well the problem is you are using a behavior that uses those keys so there is no way for you to disable them without getting rid of the behavior. Your options are finding another behavior that suits your needs or writing your own from scratch.

person icon
luposian
Registered User
Quote
2023-07-30 06:29:19

Guest wrote:
Well the problem is you are using a behavior that uses those keys so there is no way for you to disable them without getting rid of the behavior. Your options are finding another behavior that suits your needs or writing your own from scratch.

What behavior does [Shift] associate with? I assumed it was a modifier key... pressing [Shift] with forward/backwards would activate the Run cycle animation. And it worked great. But I don't want the Run cycle animation til later in the game. I also don't want [Space] bar to do anything either.

I've told CC to not do anything for Run or Jump (set them both to zero speed) and even removed the behavior script entry for [Shift] completely (nothing seems to exist for the spacebar, that I can find). But that doesn't seem to work... well, it doesn't work ideally. I can get Shift to do nothing, if pressed by itself, but it stops/freezes my character in the 1st frame of his walk cycle, if I'm moving, which looks weird. As well, pressing Space also freezes my character in the 1st frame of his walk cycle, but I can still move anywhere I want, except I'm now floating (as long as I'm holding the spacebar down)!

Aren't all character-related key behaviors ([Shift], [Space], [Up], [Down], etc.) within the character node? They wouldn't be put or found anywhere else, would they? Trying to figure out if I've accidentally overlooked something. Are there any hard-coded key behaviors that default to something, if not specifically assigned to something else? If so, where are they located and can they be changed or removed entirely?

person icon
Guest
Guest
Quote
2023-07-30 07:09:01

I assume you're using "Object or Person controlled by keyboard" behavior. That has the Shift key associated with run and the Space key for jumping. Whenever you press those two keys it's going to interrupt the other parts of the behavior because that is how it's programmed. You can't change it unfortunately because the default behaviors/actions are programmed differently than the behaviors/actions made with the JS API.

person icon
luposian
Registered User
Quote
2023-07-30 08:19:23

Guest wrote:
I assume you're using "Object or Person controlled by keyboard" behavior. That has the Shift key associated with run and the Space key for jumping. Whenever you press those two keys it's going to interrupt the other parts of the behavior because that is how it's programmed. You can't change it unfortunately because the default behaviors/actions are programmed differently than the behaviors/actions made with the JS API.

Ok, so I'm completely skunked on trying to get around that? It's hard coded into the engine? Or would I have to circumvent that behavior by duplicating the aspects I need from it, in JavaScript, while ignoring those I don't? Thus avoiding the whole [Shift] and [Space] bar issue entirely?

UPDATE: Ok, I removed the offending "Object or Person..." behavior, which of course meant ALL he could do was just stand there, in his idle animation. So, I added an Up arrow behavior, triggering his Walk Cycle, so now he walks in place! I just need to get him moving forward now!

I will have things the way I want them, or go crazy, trying! emoji icon_grin

person icon
VP
Guest
Quote
2023-07-30 10:36:24

Did you try disabling windows key-repeat?

person icon
VP
Guest
Quote
2023-07-30 10:37:24

Did you try using variables to control the events - instead of when key is left-up?

person icon
luposian
Registered User
Quote
2023-07-30 16:35:40

VP wrote:
Did you try using variables to control the events - instead of when key is left-up?

Can you disable key repeat just in CC and not from within Windows itself?

What variables are you referring to? How would I use/invoke them?

UPDATE: I just realized that, while I can make Luposian walk, he isn't going anywhere, because... there is no movement speed! How do I create movement speed without using the native keyboard controlled character behavior?

person icon
VP
Guest
Quote
2023-07-30 17:40:00

If yoou;re happy to share the file, we can get it working for you - or if you prefer to do it yourself, from the limited info you've provided, try the following....

For movement speed (special variavble) you can to use the "(hashsymbol)luposiannode.movementspeed" to set the speed. Or you can enter numerical values in the "Walk Speed" and "Run Speed" entries in the game-character behaviour options.

As for variables, An example I use is something like the following:
When W is pressed, set variable "W" =1
When A is pressed, set variable "S" =1
Every Few Seconds (30ms):
If variable "W" =1, If variable "S"=0, Set variable "Walk"=1
If variable "W" =0, If variable "S"=1, Set variable "Walk"=1
If variable "W" =0, If variable "S"=0, Set variable "Walk"=0
If Variable Walk =1, Set animation (luposiannode) = "Walk"
If Variable Walk =0, Set animation (luposiannode) = "Idle"

This way,you can control every aspect of the node, depending on the variable conditions. It's complicated but it offersa lot more control than the default game-character behaviour.

If that's too complicated, I think several users have made their own character controllers which you can use as script/plugin for your Luposian character - or, if you ask, I remember several members saying they'd be happy to code it for you.

person icon
VP
Guest
Quote
2023-07-30 17:45:48

Key repeat is a windows "feature", I guess you could pass a system command from coppercube to try to turn it off - but my guess is that the user would need to provide permission for that to happen - as it's a UAC setting - so using variables is easier...

an example is

When "W" pressed, if Variable "SND" =0, PlaySound "Jump.ogg", set Variable "SND" =1.

When "W" is released, set SND=0

In the example, jump sound will only be played once, each time the W key is pressed. Without the "SND" variable, the sound would be played repeatedly on Windows (due to key-repeat).


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |