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

Why does adding a conditon disables the trigger ?

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello,

I currently re-write my system http://www.hiveworkshop.com/forums/spells-569/stacking-orbs-system-v1-2-a-268768/ to make it more efficient.

I face a problem I cannot see the reason why multiple error occur concering the custom scripts:


  • Loses Orb
    • Events
      • Unit - A unit loses an item
    • Conditions
    • Actions
      • Custom script: local integer i = 0
      • Custom script: local integer count = 0
      • Custom script: local integer tempItemType
      • Set Orb_TempUnit = (Triggering unit)
      • Set Orb_Count = (Load (Key OrbCount) of Orb_UnitHandleId from Orb_Hashtable)
      • -------- De-index the Orb --------
      • For each (Integer Orb_LoopIndex) from 1 to Orb_Count, do (Actions)
        • Loop - Actions
          • Custom script: set udg_Orb_ItemType = GetItemTypeId(GetManipulatedItem())
          • Custom script: set udg_Orb_HashTempInteger = udg_Orb_ItemType
          • Custom script: set tempItemType = LoadInteger(udg_Orb_Hashtable, udg_Orb_UnitHandleId, udg_Orb_LoopIndex)
          • Custom script: if udg_Orb_ItemType == tempItemType then
          • -------- Transfer Data --------
          • Hashtable - Save (Load Orb_Count of Orb_UnitHandleId from Orb_Hashtable) as Orb_LoopIndex of Orb_UnitHandleId in Orb_Hashtable
          • Custom script: endif
      • Hashtable - Save (Orb_Count - 1) as (Key OrbCount) of Orb_UnitHandleId in Orb_Hashtable

Now I added a condition


  • Loses Orb
    • Events
      • Unit - A unit loses an item
    • Conditions
    • Actions
      • Custom script: set udg_Orb_ItemType = GetItemTypeId(GetManipulatedItem())
      • Custom script: set udg_Orb_HashTempInteger = udg_Orb_ItemType
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • (Load 0 of Orb_HashTempInteger from Orb_Hashtable) Gleich True
        • 'THEN'-Actions
          • Custom script: local integer i = 0
          • Custom script: local integer count = 0
          • Custom script: local integer tempItemType
          • Set Orb_TempUnit = (Triggering unit)
          • Set Orb_Count = (Load (Key OrbCount) of Orb_UnitHandleId from Orb_Hashtable)
          • -------- De-index the Orb --------
          • For each (Integer Orb_LoopIndex) from 1 to Orb_Count, do (Actions)
            • Loop - Actions
              • Custom script: set udg_Orb_ItemType = GetItemTypeId(GetManipulatedItem())
              • Custom script: set udg_Orb_HashTempInteger = udg_Orb_ItemType
              • Custom script: set tempItemType = LoadInteger(udg_Orb_Hashtable, udg_Orb_UnitHandleId, udg_Orb_LoopIndex)
              • Custom script: if udg_Orb_ItemType == tempItemType then
              • -------- Transfer Data --------
              • Hashtable - Save (Load Orb_Count of Orb_UnitHandleId from Orb_Hashtable) as Orb_LoopIndex of Orb_UnitHandleId in Orb_Hashtable
              • Custom script: endif
          • Hashtable - Save (Orb_Count - 1) as (Key OrbCount) of Orb_UnitHandleId in Orb_Hashtable
        • 'ELSE'-Actions


It is absolutely required that the new trigger works to make the system efficient and I do not see any reason why this modification disables the trigger.
The condition stuff works for the acquiring trigger you can see in the resource thread.

I would be glad if you could give me a hint.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
The lines that start with the keyword "local" must be at the top of the trigger.
 
Status
Not open for further replies.
Top