I am not a JASSer, as such. I can understand snippets but not really the thing as a whole, and certainly I cannot write my own code without reference material. However, in my quest to get a good third/first person camera, I ended up venturing into JASS territory because I was not satisfied with the GUI ones I could make and the GUI systems available. So, I came across http://www.hiveworkshop.com/forums/...ials-280/advanced-third-person-camera-145836/ which I tested in the world editor and it worked perfectly. However, once I change anything at all, or import it into my map, the trigger can be saved without NewGen throwing up any errors, but I cannot test the map. If I do try to test the map from WE I just get sent to the main menu of Warcraft III.
The below code is the same as the code in the attached map of the linked system, with the minor change of replacing udg_player with udg_Hero (for the sake of integration with my own map).
So, what is the problem and how can I fix it?
The below code is the same as the code in the attached map of the linked system, with the minor change of replacing udg_player with udg_Hero (for the sake of integration with my own map).
Code:
//TESH.scrollpos=5
//TESH.alwaysfold=0
function Trig_Multiplayer_Camera_Actions takes nothing returns nothing
local boolean b
local integer i = 1
local location l
local real aoa
local real v
local real x
local real y
local real z
local real x1
local real y1
local real z1
loop
if udg_Hero[i] != null and (GetWidgetLife(udg_Hero[i]) > 0.405) then
set v = 25
set x = GetUnitX(udg_Hero[i])
set y = GetUnitY(udg_Hero[i])
set l = Location(x, y)
set z = GetLocationZ(l)
call RemoveLocation(l)
set x1 = x + 64 * Cos(GetUnitFacing(udg_Hero[i]) * bj_DEGTORAD)
set y1 = y + 64 * Sin(GetUnitFacing(udg_Hero[i]) * bj_DEGTORAD)
set l = Location(x1, y1)
set z1 = GetLocationZ(l)
call RemoveLocation(l)
call SetCameraZ(Player(i - 1), z + 128)
loop
set x1 = x - v * Cos(GetUnitFacing(udg_Hero[i]) * bj_DEGTORAD)
set y1 = y - v * Sin(GetUnitFacing(udg_Hero[i]) * bj_DEGTORAD)
set b = IsTerrainPathingType(x1, y1, TERRAIN_PATHING_WALKABLE)
if ((b == true) and (v < 450)) then
set v = v + 25
elseif ((b == false) or (v == 450)) then
exitwhen true
endif
endloop
if GetLocalPlayer() == Player(i - 1) then
call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(udg_Hero[i]), 0.08)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, v, 0.08)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 335 + ((z1 - z) * 0.5), 0.32)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, 120, 0)
call SetCameraField(CAMERA_FIELD_FARZ, 5000, 5)
call SetCameraTargetController(udg_Hero[i], 0, 0, false)
endif
exitwhen i == 1
set i = i + 1
endif
endloop
set l = null
endfunction
function InitTrig_Multiplayer_Camera takes nothing returns nothing
set gg_trg_Multiplayer_Camera = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Multiplayer_Camera, 0.04 )
call TriggerAddAction( gg_trg_Multiplayer_Camera, function Trig_Multiplayer_Camera_Actions )
endfunction
So, what is the problem and how can I fix it?