So, today I came up with this crash function:
If not the first call, then a half-dozen calls will 100% crash your WC3 TFT 1.31. However, angles between -50 (aka 310) degrees and 230 degrees seem quite safe. [Edit: -40 to 220. Probably the danger zone is 270 ± 45.]
On a side note, SetCameraField(CAMERA_FIELD_ROTATION, ...) is in degrees, whereas GetCameraField(CAMERA_FIELD_ROTATION) returns radians. (What a hell...)
Just wanted to share this if someone else is wondering why their camera operations crash. I encountered this when I introduced SetCameraBounds in my map where camera rotation is bound to Hero facing. (Heroes travel through different locations, and in each location the minimap shows only the current location, not the entire map; redraw of minimap works terrible, but it at least shows units properly.) So, now I'm going to rotate all Heroes from the danger zone [220..320] to the closest safe angle right before updating camera bounds.
(I know that generally this is an overkill, because you EITHER lock the camera to a certain region OR lock it to a certain unit and follow its movement and rotation, but in my exact case, I needed both.)
Code:
function Crash takes nothing returns nothing
call SetCameraField(CAMERA_FIELD_ROTATION, GetRandomReal(240, 300), 0.00)
call SetCameraBounds(-1000, -1000, -1000, 1000, 1000, 1000, 1000, -1000) // just any bounds, even GetWorldBounds()
endfunction
If not the first call, then a half-dozen calls will 100% crash your WC3 TFT 1.31. However, angles between -50 (aka 310) degrees and 230 degrees seem quite safe. [Edit: -40 to 220. Probably the danger zone is 270 ± 45.]
On a side note, SetCameraField(CAMERA_FIELD_ROTATION, ...) is in degrees, whereas GetCameraField(CAMERA_FIELD_ROTATION) returns radians. (What a hell...)
Just wanted to share this if someone else is wondering why their camera operations crash. I encountered this when I introduced SetCameraBounds in my map where camera rotation is bound to Hero facing. (Heroes travel through different locations, and in each location the minimap shows only the current location, not the entire map; redraw of minimap works terrible, but it at least shows units properly.) So, now I'm going to rotate all Heroes from the danger zone [220..320] to the closest safe angle right before updating camera bounds.
(I know that generally this is an overkill, because you EITHER lock the camera to a certain region OR lock it to a certain unit and follow its movement and rotation, but in my exact case, I needed both.)
Last edited: