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

Would Combinging All these triggers Help in anyway?

Status
Not open for further replies.
Level 8
Joined
Nov 21, 2008
Messages
316
  • Troll Axe Thrower
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8c00Battle Axe|r
    • Actions
      • Unit - Add Chaos (Axe Thrower) to (Triggering unit)
  • Troll Mammothhunter
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8c00Mammoth Blade|r
    • Actions
      • Unit - Add Chaos (Mammothhunter) to (Triggering unit)
i Have over 20 kinds of simple triggers like those two. If i combined them all in one would that be beneficial. Mind You, the map doesn't lag.
 
Level 8
Joined
Nov 21, 2008
Messages
316
Yes, it reduces function calls.

When you acquire an item, all those 20 triggers will do the check. If you have only one trigger with IF/THEN/ELSE, it will do an average of 10 checks, assuming there's an equal chance of acquiring each item.
thankyou. So i should just keep adding if then else and filling in each?

  • Troll Axe Thrower
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8c00Battle Axe|r
    • Actions
      • Unit - Add Chaos (Axe Thrower) to (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to |cffff8c00Assassin Dagger|r
        • Then - Actions
          • Unit - Add Chaos (Assassin) to (Triggering unit)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to |cffff8c00Mammoth Blade|r
        • Then - Actions
          • Unit - Add Chaos (Mammothhunter) to (Triggering unit)
        • Else - Actions
          • Do nothing
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Troll Axe Thrower
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • Unit = Triggering Unit // unit variable
      • Item_Type = Item type of (item being manipulated) // item type variable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Item_Type Equal to |cffff8c00Assassin Dagger|r
        • Then - Actions
          • Unit - Add Chaos (Assassin) to Unit
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Item_Type Equal to |cffff8c00Mammoth Blade|r
            • Then - Actions
              • Unit - Add Chaos (Mammothhunter) to Unit
            • Else - Actions
 
Last edited:
Level 13
Joined
Mar 24, 2010
Messages
950
you need to add the OR condition so it knows it can be any of those 20 items.

also i know it only runs 1 trig instead of 20 BUT out of those 20 alls it does is a simple instant check only 1 of those 20 actually continues running the trigger, so now your going to have ONE huge trigger always running doing alot of checks which over all is doing more work and running more lines of code, so its hard to say whats less work on the processor while running the game.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
you need to add the OR condition so it knows it can be any of those 20 items.

I don't see how OR would be needed there.

also i know it only runs 1 trig instead of 20 BUT out of those 20 alls it does is a simple instant check only 1 of those 20 actually continues running the trigger, so now your going to have ONE huge trigger always running doing alot of checks which over all is doing more work and running more lines of code, so its hard to say whats less work on the processor while running the game.

No.

In best case scenario, with that IF/THEN/ELSE thing, you're only doing one item type check. 20 checks in worst case scenario.

With 20 separate triggers, you'll do 20 checks every time.

It shouldn't bee too hard to tell which uses less resources. I/T/E -> less lines of code, less resources, less work.
 
Level 13
Joined
Mar 24, 2010
Messages
950
nvm you edited your post to fix it you had
(Item-type of (Item being manipulated)) Equal to |cffff8c00Battle Axe|r
condition before so it wouldnt have ran all 20 it would have just checked for that if you didnt have a Or for all or none at all like you have now.

But yea that will work unless he has some other trigger that has a uses item action and then you will need the OR all 20 items to make it more efficient.


Edit:
No actually i was right becuz unless those 20 items are the only "usable' 20 items in the game that trigger will check all 20 of those items anyway thus running the whole line of I-T-E's which in that case would be better to check it before it even goes to run the trigger, its a faster check in that initial condition area.
 
Status
Not open for further replies.
Top