[vJASS] How do I stop this trigger from running on intialization

Status
Not open for further replies.
Level 5
Joined
Aug 18, 2013
Messages
85
Please help

JASS:
library CamExampele initializer init requires CameraSystem

    private function rotate takes nothing returns nothing
        // If the pressed key was down, we will rotate the unit by 180°
        // GetTriggerEventId() returns the id so we can check which arrow was pressed or released.
        if GetTriggerEventId() == EVENT_PLAYER_ARROW_DOWN_DOWN then
            call SetUnitFacing(PlayerCameras[GetPlayerId(GetTriggerPlayer())].toFollow, GetUnitFacing(PlayerCameras[GetPlayerId(GetTriggerPlayer())].toFollow) + 180)
        endif
    endfunction

    private function init takes nothing returns nothing
        local group g = CreateGroup()
        local unit  u
       
        // Creating the camera struct for Player 1 (Red)
        local CAMERA cam = CAMERA.create(Player(0))
       
        // Getting the hero of Player 1
        call GroupEnumUnitsInRange(g, 0, 0, 999999, null)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            if GetUnitTypeId(u) == 'Hapm' then
                exitwhen true
            endif
           
            call GroupRemoveUnit(g, u)
        endloop
        call DestroyGroup(g)
       
        // Setting the unit which the camera follows to the hero we just found out
        set cam.toFollow = u
       
        // Change the camera to active
        set cam.active = true
        // This is a member of the keyboard plugin. We have to set a animationIndex (for most units) and a animation duration (for all units).
        // How do you get the index? Seriously. No idea. Play around with numbers from 0 to whatever until you get a good-looking walk
        // animation
        // How do you get the animation duration?
        // Place a unit in the editor, click on it and click through it's animations until you find the walk animation. Write down the duration
        // and you're done.
        set cam.animationDur = 0.766
       
        // Registering a new key event is easy - just like this.
        call cam.registerKeyEvent(function rotate)
       
        // Nulling is cool.
        set g = null
        set u = null
    endfunction
   
endlibrary
 
Status
Not open for further replies.
Back
Top