[Solved] Trackables not being created

Level 5
Joined
Sep 27, 2011
Messages
141
my trigger is not creating the trackables and i cant figure out why it only creates one of the destructables before stopping each of the regions is different but only the first has the destructable created and no trackables are created or they are not working Hastable was created at init. Can someone help?
  • Trackables Start
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Custom script: local trackable tr
      • Set Angle = 0.01
      • Set Human_Players = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
      • For each (Integer Temp_Int) from 1 to 18, do (Actions)
        • Loop - Actions
          • Set tempLoc1 = (Center of Inventory_Region[Temp_Int])
          • Destructible - Create a Empty Inventory Slot at tempLoc1 facing 180.00 with scale 1.51 and variation 0
          • For each (Integer Temp_Int2) from 1 to 4, do (Actions)
            • Loop - Actions
              • Set Player = (Player(Temp_Int2))
              • Set X_Coordinate = (X of tempLoc1)
              • Set Y_Coordinate = (Y of tempLoc1)
              • Set Inventory_Slot = Temp_Int
              • Set Trackable_Path = <Empty String>
              • Custom script: if udg_Player == GetLocalPlayer() then
              • Set Trackable_Path = war3mapImported\IconBase.mdl
              • Custom script: endif
              • Custom script: call TriggerRegisterTrackableHitEvent(gg_trg_Clicked, tr)
              • Custom script: call TriggerRegisterTrackableTrackEvent(gg_trg_Tracking, tr)
              • Custom script: set tr = CreateTrackable(udg_Trackable_Path, udg_X_Coordinate, udg_Y_Coordinate, udg_Angle)
              • Custom script: set udg_Integer = GetHandleId(tr)
              • Hashtable - Save Handle OfPlayer as 0 of Integer in Track_Table
              • Hashtable - Save Inventory_Slot as 1 of Integer in Track_Table
              • Hashtable - Save X_Coordinate as 2 of Integer in Track_Table
              • Hashtable - Save Y_Coordinate as 3 of Integer in Track_Table
          • Custom script: call RemoveLocation(udg_tempLoc1)
      • Custom script: set tr = null
      • Custom script: call DestroyForce(udg_Human_Players)
 
Last edited by a moderator:
You register the events before you actually create the trackable. Right now you have it like this:
  • Custom script: call TriggerRegisterTrackableHitEvent(gg_trg_Clicked, tr)
    • Custom script: call TriggerRegisterTrackableTrackEvent(gg_trg_Tracking, tr)
    • Custom script: set tr = CreateTrackable(udg_Trackable_Path, udg_X_Coordinate, udg_Y_Coordinate, udg_Angle)
    • Custom script: set udg_Integer = GetHandleId(tr)
It actually should be like this:
  • Custom script: set tr = CreateTrackable(udg_Trackable_Path, udg_X_Coordinate, udg_Y_Coordinate, udg_Angle)
  • Custom script: set udg_Integer = GetHandleId(tr)
  • Custom script: call TriggerRegisterTrackableHitEvent(gg_trg_Clicked, tr)
  • Custom script: call TriggerRegisterTrackableTrackEvent(gg_trg_Tracking, tr)
tr is not declared at the point where you registered the events, so it was actually registering nothing for the triggers. However, with the proper order (as shown above), it will register the events after the trackable is properly declared. :)
 
Top