• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Inefficient System Needs Pimped

Status
Not open for further replies.
Level 22
Joined
Jul 25, 2009
Messages
3,091
  • Weapon
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Woodcutter's Axe
          • (Item-type of (Item being manipulated)) Equal to Witch Staff
          • (Item-type of (Item being manipulated)) Equal to Great Axe
          • (Item-type of (Item being manipulated)) Equal to Silver Axe
          • (Item-type of (Item being manipulated)) Equal to Hunting Spears
          • (Item-type of (Item being manipulated)) Equal to Steel-tipped Spears
          • (Item-type of (Item being manipulated)) Equal to Heavy Javelins
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Woodcutter's Axe
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Witch Staff
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Great Axe
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Silver Axe
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Hunting Spears
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Steel-tipped Spears
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Heavy Javelins
            • Then - Actions
              • Set AlreadyHasWeapon[(Custom value of (Triggering unit))] = (AlreadyHasWeapon[(Custom value of (Triggering unit))] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AlreadyHasWeapon[(Custom value of (Triggering unit))] Greater than 1
                • Then - Actions
                  • Hero - Drop (Item being manipulated) from (Triggering unit)
                  • Set AlreadyHasWeapon[(Custom value of (Triggering unit))] = 0
                • Else - Actions
            • Else - Actions
I have 4 triggers like this, they all do the same thing, which is to restrict you from carrying multiple items, problem is, it's very inefficient, as you can see. And it has a small glitch, where sometimes unit won't pick up an item, even if they don't have an item of that type on them, it has to do with some kind of delay in the actions, or some inefficient way I'm doing it... So help me out, show me what could be improved, and how to fix this glitch.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,911
which is to restrict you from carrying multiple items
Uh? It restricts you from carrying a type of item that you already have? I'm not sure on what you mean though you should store "Hero manipulated unit" into a variable then use it, which makes more efficient and faster, just move the first "Or-Any conditions" to actions by creating a new ITE (if then else) block and putting all stuff there.
 
Status
Not open for further replies.
Top