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

[vJASS] How to activate and deactivate "library" jass triggers

Status
Not open for further replies.
Level 5
Joined
Aug 18, 2013
Messages
85
http://www.hiveworkshop.com/forums/spells-569/cam-system-v3-144480/

The creator of this camera system used to have a disable feature in early versions. But it looks like he removed it in the present version.

All the jass triggers are activated no matter what I do.

How do I disable them or reactivate them?

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
 
Last edited:
Status
Not open for further replies.
Top