• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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