• 🏆 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!

Custom mouse wheel scroll zoom

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,853
Hello, with the recent addition of the zoom with the mouse wheel I think that the people will get used to that instead of a zoom system with commands, so I wanna know if there is a way that I can make the zoom lesser than it normally is when the people use the mouse scroll, for example, instead of 1650 of distance it is 1240 and so on, how can I do that?
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Check that the player's camera distance is not above the threshold periodically. If the player's camera distance is higher than threshold, set the camera distance to threshold for player.
I don't wanna change the limit the camera distance, I wanna change the camera distance to another value instead of what should be normally when you scroll.
 
Level 18
Joined
Oct 17, 2012
Messages
822
That is the purpose of the periodic trigger. The periodic trigger will prevent the player from zooming higher than the limit you are going for.
A very fast timer will make the camera jumps not as noticeable.

You could forgo the periodic trigger and check the camera distance on a middle mouse button detection event on the new patches.
I am not too sure how responsive that is compared to polling.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,853
That is the purpose of the periodic trigger. The periodic trigger will prevent the player from zooming higher than the limit you are going for.
A very fast timer will make the camera jumps not as noticeable.

You could forgo the periodic trigger and check the camera distance on a middle mouse button detection event on the new patches.
I don't get you, can you pass me an example?
 
Level 18
Joined
Oct 17, 2012
Messages
822
Here's a simple example.
Wurst:
function timeout()
    if GetCameraField(CAMERA_FIELD_TARGET_DISTANCE) > 1240
        SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 1240, 0)
init
    TimerStart(CreateTimer(), 1/60, true, function timeout)

Now, if you don't like the above method, this thread showcases an incomplete method using frame natives.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,853
Here's a simple example.
Wurst:
function timeout()
if GetCameraField(CAMERA_FIELD_TARGET_DISTANCE) > 1240
SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 1240, 0)
init
TimerStart(CreateTimer(), 1/60, true, function timeout)
This is not what I want, I wanna do something for example: I scroll and then the zoom instead of 1650 is 1240, instead of 1500 is 1100, instead of 1350 is 1000, instead of 2000 is 1600 (I'm not sure if the measures are correct, but is just to explain what I want).
Now, if you don't like the above method, this thread showcases an incomplete method using frame natives.
I read that only something like this is the best alternative, I could give it a try.
 
Status
Not open for further replies.
Top