1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Trackable bug

Discussion in 'Triggers & Scripts' started by Slaydon, Oct 24, 2009.

  1. Slaydon

    Slaydon

    Joined:
    Jan 6, 2008
    Messages:
    2,432
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    Hi there, these are my jass trigs....
    Code (vJASS):
    function Trig_Ini_Actions takes nothing returns nothing
        globals
            trackable array Track[1]
        endglobals
        local trackable array Track
        set Track[1] = CreateTrackable("empinv.mdx", 14520, 14723, 0)
        set Track[2] = CreateTrackable("empinv.mdx", 14590, 14723, 0)
        set bj_forLoopAIndex = 1
        set bj_forLoopAIndexEnd = 999
        loop
            exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
            call TriggerRegisterTrackableTrackEvent( gg_trg_Track, Track[GetForLoopIndexA()] )
            call TriggerRegisterTrackableHitEvent( gg_trg_Hit, Track[GetForLoopIndexA()] )
            set bj_forLoopAIndex = bj_forLoopAIndex + 1
        endloop
    endfunction

    //===========================================================================
    function InitTrig_Ini takes nothing returns nothing
        set gg_trg_Ini = CreateTrigger(  )
        call TriggerAddAction( gg_trg_Ini, function Trig_Ini_Actions )
    endfunction

     


    Code (vJASS):
    function Trig_Track_Func001Func001C takes nothing returns boolean
        if ( not ( GetTriggeringTrackable() == Track[GetForLoopIndexA()] ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Track_Actions takes nothing returns nothing
        set bj_forLoopAIndex = 1
        set bj_forLoopAIndexEnd = 999
        loop
            exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
            if ( Trig_Track_Func001Func001C() ) then
                set udg_TrackBoolean[GetForLoopIndexA()] = true
                call ConditionalTriggerExecute( gg_trg_TrackMultiboard )
            else
            endif
            set bj_forLoopAIndex = bj_forLoopAIndex + 1
        endloop
    endfunction

    //===========================================================================
    function InitTrig_Track takes nothing returns nothing
        set gg_trg_Track = CreateTrigger(  )
        call TriggerAddAction( gg_trg_Track, function Trig_Track_Actions )
    endfunction

     


    Code (vJASS):
    function Trig_Hit_Func001Func001C takes nothing returns boolean
        if ( not ( GetTriggeringTrackable() == Track[GetForLoopIndexA()] ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Hit_Actions takes nothing returns nothing
        set bj_forLoopAIndex = 1
        set bj_forLoopAIndexEnd = 999
        loop
            exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
            if ( Trig_Hit_Func001Func001C() ) then
                set udg_TrackBoolean2[GetForLoopIndexA()] = true
                call ConditionalTriggerExecute( gg_trg_Hit2 )
            else
            endif
            set bj_forLoopAIndex = bj_forLoopAIndex + 1
        endloop
    endfunction

    //===========================================================================
    function InitTrig_Hit takes nothing returns nothing
        set gg_trg_Track = CreateTrigger(  )
        call TriggerAddAction( gg_trg_Hit, function Trig_Hit_Actions )
    endfunction

     




    and some gui
    • Hit2
      • Events
      • Conditions
        • lol Equal to False
      • Actions
        • For each (Integer A) from 1 to 150, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • TrackBoolean2[(Integer A)] Equal to True
              • Then - Actions
                • Game - Display to (All players) the text: test
              • Else - Actions
        • For each (Integer B) from 1 to 2, do (Actions)
          • Loop - Actions
            • Set TrackBoolean2[(Integer B)] = False


    • TrackMultiboard
      • Events
      • Conditions
        • lol Equal to False
      • Actions
        • For each (Integer B) from 1 to 2, do (Actions)
          • Loop - Actions
            • Multiboard - Hide ItemMultiboard[(Integer B)]
        • For each (Integer A) from 1 to 2, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • TrackBoolean[(Integer A)] Equal to True
              • Then - Actions
                • Multiboard - Show ItemMultiboard[(Integer A)]
                • Multiboard - Maximize ItemMultiboard[(Integer A)]
              • Else - Actions
        • For each (Integer B) from 1 to 2, do (Actions)
          • Loop - Actions
            • Set TrackBoolean[(Integer B)] = False


    The problem is "Hit", if i have it "off", the tracking works, if i have the Hit trigger on, nothing works, help
     
  2. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    445
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    How do you have global blocks in functions? Is that some new zinc feature?
     
  3. b_a_d

    b_a_d

    Joined:
    Sep 4, 2007
    Messages:
    161
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    its vjass thing and zinc

    edit: well first off your jass code is poorly made looks mostly converted gui and a few things added
     
  4. Slaydon

    Slaydon

    Joined:
    Jan 6, 2008
    Messages:
    2,432
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    i got it to work ;D The problem was that i used
    Code (vJASS):
        set gg_trg_Track = CreateTrigger(  )


    instead of

    Code (vJASS):
        set gg_trg_Hit = CreateTrigger(  )
     
  5. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    445
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Hey, I didn't know that (about the globals inside functions).
    Won't make much of a difference though.

    Oh and great you solved your problem Slaydon.