• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

W/A/S/D/Space Bar Events

Status
Not open for further replies.
Level 10
Joined
Oct 31, 2009
Messages
352
As for the rest of the keys, pressing can be detected by giving units spells with the hotkey of the key you want to detect.
But only pressing is detectable, not releasing and holding.

Damn, well I suppose I could just use the arrow keys, but your saying its not even possible using vJass?

Spacebar detection is only achievable in single player because of desyncs.
My map is single player so this isn't a problem, but how do I refer to the event? (can it be done in GUI?)
 
It's not a built-in event - there's a way of doing it by setting the "home camera point" or whatever, I forgot what it's called, but it defaults to your start location (you press space, the camera instantly goes to your start location). What you can do, is, every X seconds, depends how responsive it needs to be (I'd use 0.02), check if the camera position is exactly at the "home" position, and if so, you have your "spacebar pressed" event. You can't detect releases, however, AFAIK.
 
Yeah, for the Spacebar event, I've also thought of Element of Water's solution, but apparently, that way can be inefficient, because some player may keep his camera hovering over the spacebar point, yet he has no spacebar button pressed. You would need some sort of camera lock to detect that, but still, this is something I haven't thought through enough.
 
Level 13
Joined
Mar 16, 2008
Messages
941
Yeah, for the Spacebar event, I've also thought of Element of Water's solution, but apparently, that way can be inefficient, because some player may keep his camera hovering over the spacebar point, yet he has no spacebar button pressed. You would need some sort of camera lock to detect that, but still, this is something I haven't thought through enough.

Then just move the camera by 0.1 to the x-axis in the event and you're done. I don't think that there is a chance of setting a camera position to exactly 0.0 in coordinates (yes, it could happen, but the chance is very small).
 
Status
Not open for further replies.
Top