• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

WASD Movement Works but i have a Problem

Status
Not open for further replies.
Level 12
Joined
Mar 13, 2020
Messages
421
Hi guys i have a little issue on the Wasd Movement i work on, the original one is from Arrow Movement from Moon_assailant 99% of the Credits go to him im a realy noob in jass so i did my best and performed a gui version of a wasd movement with Tasyens oskey key event

now my question how i remove this shitty hotkeys from the command buttons a and s because i need them for the movement...
and why the hell it saves the Map as Scenario?
Please Help im a Noob

thats all Test map for the Wasd i upload

Credits:
@Tasyen
@Moon_assailant
 

Attachments

  • WASD MOVEMENT.w3x
    30 KB · Views: 182
Level 12
Joined
Mar 13, 2020
Messages
421
Bump...

9E7B2A53-4AE1-4D9B-BE15-BDA600FD421A.png

Brains of Hive I Summon you..
 
Level 19
Joined
Feb 27, 2019
Messages
577
The obvious option is to change classification to Ward but I doubt thats a viable option since it removes everything in the UI. What I managed so far is if you set Combat - Attack - Show UI to false it will ignore the A button. Then if you add an ability, lets say Roar and set Button position X and Y to 0 and set hotkey to S it will try to cast Roar instead of using Stop,. But youll be spammed with a lot of Not enough mana and clicks. Perheaps there is a viable ability that wont be noticed if spammed? Other than that I heard something about changing some .txt file to be able to modify the Move, Patrol, Hold position and Attack abilities and it seems like a clean option if it still works.
 
Level 4
Joined
Jun 28, 2010
Messages
38
So when I found this I wondered; is it possible to have even less Jass code? And the answer I came up with was yes.
Apparently there is a GUI Action that allows you to add an event to another trigger; so I did just that and it means that you only need to add in your map initialization trigger 8 custom lines of code and delete the original events in the triggers.

So basically one for each key press and release

call BlzTriggerRegisterPlayerKeyEvent(gg_trg_Up_Press,Player(0),OSKEY_W,0,true)
call BlzTriggerRegisterPlayerKeyEvent(gg_trg_Up_Release,Player(0),OSKEY_W,0,false)
 

Attachments

  • WASD-Movement-Less-Code.w3x
    28.4 KB · Views: 92
Level 12
Joined
Mar 13, 2020
Messages
421
So when I found this I wondered; is it possible to have even less Jass code? And the answer I came up with was yes.
Apparently there is a GUI Action that allows you to add an event to another trigger; so I did just that and it means that you only need to add in your map initialization trigger 8 custom lines of code and delete the original events in the triggers.

So basically one for each key press and release

call BlzTriggerRegisterPlayerKeyEvent(gg_trg_Up_Press,Player(0),OSKEY_W,0,true)
call BlzTriggerRegisterPlayerKeyEvent(gg_trg_Up_Release,Player(0),OSKEY_W,0,false)

the only problem is when you use oskey key events... when you use your mouse you will disable the oskey key events for each time you click..

here is a example where i used wasd and disabled the mouse and the command buttons if you need anything to improve your map and find a even better way to add wasd as a system

Btw the Example Map and this post was on the beginning of my mapping history before i ever did anything in jass.... :)
 

Attachments

  • Big Bosses 0.1.w3x
    185.8 KB · Views: 55
Last edited:
Level 4
Joined
Jun 28, 2010
Messages
38
I took a look at your map and the only real flaw I see if you should start using arrays so you don't have to make a trigger for every single character. See my uploaded map for a reference.
Feel free to use my triggers if you want, I have a nice retro camera system that uses absolutely no custom code and I also went and completely rewrote the WASD movement system to better suit a third person camera such as mine. Now if you hold Q and E your hero will strafe. A and D will make the unit turn left and right as long as its held down. Q and W will run diagonally while A and W will run while turning.
All of my triggers are commented for people to easily learn from.

When you first start the map, select Arthas and then walk him to the center where the switch is. That will activate the whole process of applying the third person camera, allowing you to use WASD as movement and giving the hero the camera control spell. You can also you the arrow keys to control your camera. Left and Right to manual rotate and disable auto rotate while up and down changes camera angle. May redo later with left and right handling distance or something.

You should navigate to your C:\Users\USERNAME\Documents\Warcraft III\CustomKeyBindings.txt
and change the hotkey of Attack and Move to something else then enable custom hotkeys in the Warcraft 3 options. I've yet to figure out another way of doing it but plan on it in the future.

Also I plan on trying to remake this JASS camera system using mostly GUI. As its just what I want but too much written code that can be GUI triggers. I like my map to only use custom code if it has to.
Mouse camera system with WASD
 

Attachments

  • WIP-CamSystem.w3m
    411.1 KB · Views: 61
Last edited:
Level 4
Joined
Jun 28, 2010
Messages
38
Just realized I hate the current trigger file structure, fixed it. Also fixed the turnRate variable to be faster and in line with how the others were declared.

-EDIT Also I fixed the choppy stop and go when hitting keys.
 

Attachments

  • WIP-CamSystem.w3m
    407.3 KB · Views: 52
Last edited:
Level 4
Joined
Jun 28, 2010
Messages
38
And finally a perfected Camera and WASD system. You move your camera with the mouse. Holding Right click lets you move the camera and the facing of the unit to match. Holding left lets you pan around your character. Holding both and moving allows you to zoom in and out. The WASD still work the same and everything is built to handle up to 24 characters with no additional code needing to be written. 15 years later and I finally made the system I wanted in WC3 using almost all GUI, I can now die in piece.

Also the reason why every single unit is shown as edited is because I sized every single one of them so that they were proportionate lore wise to each other. All humans of similar height, orcs taller than them, elves taller then them, ect.
 

Attachments

  • MouseCamera&WASDMovement.w3m
    433.5 KB · Views: 120
Level 4
Joined
Jun 28, 2010
Messages
38
Nope, I edited my CustomKeys and forgot about it xD
However if I completely hide the UI that solves the problem so I was thinking of making an action based battle system to go along with it. Like hit the number keys to have your character attack in a cone in front of him if he is melee or cast a spell/shoot a bow if ranged.
 
Level 12
Joined
Mar 13, 2020
Messages
421
Or you just create simple buttons (just visual for the spells) and hp/mana bars like I did and you create a sort of Arpg like darksouls / Diablo

like moving with wasd (dodging attacks)
Mousclick left is your sword attack
And q is drink your health pot
And e is arrow using

and items gives effects like when you hit with your sword 10% chance to cast a lightning chain

or you get 3 sec of Immolation

or whatever you want
 
Level 4
Joined
Jun 28, 2010
Messages
38
we know That the problem is the Oskeykey Event will be disabled when you press the mouse... and it can only be fixed when hiding all of the UI seems...
I was able to finally fix that. No matter what you are holding down if you click either or it will still work. Also made it so that it ignores movement commands from the right mouse button but you can still right click friendlies, enemies and items. I had to rewrite basically the entire damn thing from scratch but because of that my logic is cleaner, its easier to read and nearly everything works. I just need to fix my logic on strafing when W is pressed first. Also I am implementing running forward when right and mouse buttons are held at the same time, did it before the logic rewrite but have yet to add it again. Also need to make it so that you strafe when holding both mouse buttons and hitting either A, Q or QA.

Here's what it is looking like now, though the mouse is a bit buggy because I disabled the mouse scroll system that zooms the camera in and out when you mouse scroll. When done the controls should be EXACTLY like playing any mmorpg
 

Attachments

  • MouseCam&WASDMovement.w3m
    434.2 KB · Views: 64
Last edited:
Level 12
Joined
Mar 13, 2020
Messages
421
Been I while since I updated this thread but I fixed every single problem. From

I was able to finally fix that. No matter what you are holding down if you click either or it will still work. Also made it so that it ignores movement commands from the right mouse button but you can still right click friendlies, enemies and items. I had to rewrite basically the entire damn thing from scratch but because of that my logic is cleaner, its easier to read and nearly everything works. I just need to fix my logic on strafing when W is pressed first. Also I am implementing running forward when right and mouse buttons are held at the same time, did it before the logic rewrite but have yet to add it again. Also need to make it so that you strafe when holding both mouse buttons and hitting either A, Q or QA.

Here's what it is looking like now, though the mouse is a bit buggy because I disabled the mouse scroll system that zooms the camera in and out when you mouse scroll. When done the controls should be EXACTLY like playing any mmorpg

k i will check it out later :p
 
Level 4
Joined
Jun 28, 2010
Messages
38
k i will check it out later :p
oof, don't do it, I just realized I uploaded the wrong map. This is the right one. I am at the stage where I need to test if this actually works in multiplayer
Also the last thing I want to add is this guys advanced camera detection system to my system. His Arrow Key method of movement is buggy with the new version of WC3 but everything else seems solid.


^- I am sad that I am just now finding this OTL
 

Attachments

  • MouseCam&WASDMovement.w3m
    433.9 KB · Views: 60
Last edited:
Level 4
Joined
Jun 28, 2010
Messages
38
ugh, I'm useless. I was testing and running around and after a while my unit would do a stuttering of going and stopping. I forgot to fucking put conditions on the unwanted mouse movement so I kept the wanted WASD movement and it was only randomly firing because it didn't always get a chance to.


-edit Mouse Timer trigger just hates player groups, no fucking idea why
 

Attachments

  • MouseCam&WASDMovement.w3m
    446.1 KB · Views: 134
Last edited:
Status
Not open for further replies.
Top