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

[JASS] Need help with my Camera Trigger

Status
Not open for further replies.
Level 3
Joined
Oct 10, 2017
Messages
32
So, I'm new to Jass, read quite a few tutorials and feel pretty sure about the basics so far. With my current knowledge, I'm trying to create a camera trigger. That trigger is supposed to zoom out the camera of the player (should work for every player) if they type in "-+500" (without the "").

This is my code so far and it gives me lots of compiler (Syntax) errors.

Code:
function CameraSetting takes nothing returns nothing
local integer p = 0

loop
    exitwhen p == 12
    call TriggerRegisterPlayerChatEvent (CameraInit, Player(p), "+500", true)
    set p = p + 1
endloop
endfunction


function Init_Trg_CameraInit takes nothing returns nothing

set gg_trg_InitTrig_CameraInit = CreateTrigger()
call TriggerAddAction(Init_Trg_CameraInit,CameraSetting)

endfunction


1.PNG
 
Level 3
Joined
Oct 10, 2017
Messages
32
Okay, looks much better now, but still 1 error message. I just need to figure out, how to make my trigger variable t be accesible by the CameraSettings function right? Can someone help me with that?

This is my Code now :

Code:
function CameraSetting takes nothing returns nothing
local integer p = 0

loop
    exitwhen p == 12
    call TriggerRegisterPlayerChatEvent (t, Player(p), "+500", true)
    set p = p + 1
endloop
endfunction


function Init_Trg_CameraInit takes nothing returns nothing

local trigger t = CreateTrigger()
call TriggerAddAction(t, function CameraSetting)

endfunction

and here the remaining error. I made a local trigger variable instead and added "function" to CameraSettings. Also added the "t" into the "whichtrigger" parameter from the TriggerAddAction function.

1.PNG
 
Level 3
Joined
Oct 10, 2017
Messages
32
Okay, I did it like this now, after lots of trial and errors, but it still does'nt work. Nothing happens ingame, when I type +500 in chat. What am I doing wrong?

Code:
function CameraAction takes nothing returns nothing

call SetCameraFieldForPlayer(Player(0), CAMERA_FIELD_TARGET_DISTANCE, 5000.00, 0)

endfunction



function InitTrig_Camera takes nothing returns nothing
local trigger t = CreateTrigger()
local integer p = 0

loop
    exitwhen p > 9
    set p = p + 1
    call TriggerRegisterPlayerChatEvent (t, Player(p), "+500", true)
endloop

call TriggerAddAction(t, function CameraAction)

endfunction
 
Status
Not open for further replies.
Top