[Trigger] Sticky Mouse Camera in MMORPG System. SOLVED

Status
Not open for further replies.
Level 5
Joined
Jun 28, 2010
Messages
41
While I can read and write Jass I'm not the best at it and instead prefer to use the bare minimum I have to in Jass and use gui for the rest. The result is what I feel a much more user friendly map for people who use gui and jass. I took the mouse camera system demo made by Brilock and broke it down into the base parts and remade it using only gui with the exception of declaring the frames that the mouse uses to control the camera and it all works as it does in his map with one issue.. The camera is prone to sticking; for example:

1. Player holds down either left or right mouse button
2. Mouse is hidden and then the player is able to move the camera via their mouse as long as it is held down.
3. Player releases mouse and the mouse will reappear and no longer control camera movement.

However sometimes on step three when the player lets go of the mouse button it just keeps controlling the camera as if the game never got the message that the mouse button is no longer held. You can click the mouse button a few times and it will then realize it is no longer beng held and stop contoling the camera. Everything seems to work right with my code but this is not an issue that appears in the demo map by Brilock.

So I have a trigger mouseDown that detects when and which player has issued either a right or left click and it sets the players leftClick or rightClick variable to true. It then moves the mouse to the center of the screen, hides it and enables the custom frames that detect mouse movement for the player. So as long as leftClick or rightClick is true it will move the camera using the mouse. Now when the player lets go of the mouse button it should run mouseUp which is the opposite of the mouseDown trigger. It will set the leftClick or rightClick variable to false and then unhide the mouse and disable the mouse capture frames.

Any ideas? I really want to submit this as a resource for other people to use but I don't want to throw it out there with this bug in it. The map also features a full wads movement system to mimic MMORPG play as faithfully as possible with my ability. My goal was to have a scaleable system that is as easy to use as possible for beginners and veterans alike.


This works completely, feel free to use this in your own map. It should be really easy to use as I included a really basic character selection system however as its been a few years since I looked at this... I'm pretty sure the only thing you have to do is

1. Create a region called characterSelection
Wherever this region is will be where the Hero Tavern trigger will spawn a wisp at as well as giving the player enough gold and lumber to purchase a hero.

2. Create a region called characterSelected
This should be wherever you want the chosen hero to pop out at, it also serves to initialize the camera system.

3. Enable vjass and jasshelper
4. Export the triggers from my map and import them into your own map.

Neat Features
Character movement can be controlled using the W, A, S, D, Q and E keys as well as holding both mouse buttons down like a standard MMORPG camera.
Holding down the left mouse button will let you pan the camera around your character while holding down the right mouse button will turn your character.
Smart camera system that detects obstructions to the camera and adjusts the camera distance accordingly. This can be turned off.
Ability to properly calculate unit height to terrain height. This means if you walk over a hill the camera will raise and lower accordingly.

Hotkeys
Up Arrow - Increase camera height
Down Arrow - Lower camera height
Left Arrow - Increase view distance
Right Arrow - Decrease view distance
PauseBreak - Disable smart camera
Home - Increase camera distance to unit
End - Decrease camera distance to unit
F4 - Reset camera to defaults
F6 - Update camera defaults to current view
Esc - Clear unit selection
 

Attachments

  • ACMS.w3m
    443.4 KB · Views: 2
Last edited:
Level 5
Joined
Jun 28, 2010
Messages
41
What version are you on? It's using some of the new Reforged Jass calls so if you aren't on... whatever patch they added that it will probably crash. Also fixed a bug where holding left and right mouse buttons to move forward would stutter walk instead of walking straight.
 
Level 5
Joined
Apr 13, 2019
Messages
56
Just tested your map ITS FUCKING AWESOME looks very much like the 2010 ROC mod program where you could do similar things, but then i have a simple question HOW could i import the triggers on a new map and make it work, i tried i made the needed regions and unit but when i test it there are so many variables errors do you have a tutorial?
 
Level 5
Joined
Jun 28, 2010
Messages
41
Just tested your map ITS FUCKING AWESOME looks very much like the 2010 ROC mod program where you could do similar things, but then i have a simple question HOW could i import the triggers on a new map and make it work, i tried i made the needed regions and unit but when i test it there are so many variables errors do you have a tutorial?
Sorry about the late reply, October is my con month where I gotta finish my costume or cry. If you still need a hand I just rejoined the Hiveworkshop discord. Should be listed under Xain.

That being said you should just be able to import the triggers and the variables and then it should be ok. I can write up a tutorial if you need. Oh and you haev to enable vjass in the trigger option thing.
 
Status
Not open for further replies.
Top