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

[Trigger] Is this going to cause any problems if used with multiple items 40-50 lets say?

Status
Not open for further replies.
Level 2
Joined
Mar 30, 2010
Messages
10
WoodenShield
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to |c00959697Wooden Shield|r
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (Unit-type of (Triggering unit)) Equal to Paladin
            • (Unit-type of (Triggering unit)) Equal to Archmage
            • (Unit-type of (Triggering unit)) Equal to Mountain King
      • Then - Actions
        • Hero - Drop (Item being manipulated) from (Triggering unit)
        • Floating Text - Create floating text that reads Warrior only item! above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 75.00%, 50.00%), and 0.00% transparency
        • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        • Floating Text - Change (Last created floating text): Disable permanence
        • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
        • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • Else - Actions
  • [/hidden]
 
Level 7
Joined
Oct 19, 2015
Messages
286
The only problem I can foresee is you having to manually make this many triggers.

I would strongly recommend systematizing the solution so that one trigger can handle all the cases.
 
Level 6
Joined
Mar 17, 2012
Messages
105
The only problem I can foresee is you having to manually make this many triggers.

I would strongly recommend systematizing the solution so that one trigger can handle all the cases.

There are several ways you can do this, by the way. I see you're using a sort of "class" system, so you could simplify it like this:

Make all warrior items the item-class of, say, "Purchaseable", while all mage items are class "Permanent". Then you can have a number of triggers (as many as you have classes) and instead of the condition directly checking the item-type, check the item class.

Alternatively, if you don't want to use item-classes, you could make an in-game list of items for each class.
 
Level 7
Joined
Oct 19, 2015
Messages
286
A third possible method would be to use a hashtable to store hero classes for each class-specific item by using item type ids as hashtable indexes, that way you can have a single trigger handle all the cases without having to do any looping through lists, you'd just get the type ids of the manipulated item and the hero manipulating it and then see if a hashtable entry exists for that item type and if it does, compare it to the hero type and drop the item if the types don't match.

It would be slightly more complicated but still easily doable even if you had items that can be used by multiple, but not all heroes.
 
Status
Not open for further replies.
Top