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

Combining Items of the same type

Status
Not open for further replies.
Level 3
Joined
Feb 5, 2011
Messages
32
Hello,

I understand that there are literally thounsands of posts on this website and many others for the very same function, but nowhere I could find an answer that helped me, so I decided to post this myself, should any kind soul see and lend their help.

I have been trying to figure this one out for literally ages, and still haven't found a satisfactory solution / come to a good understanding of this trigger.

Issue is I am not very familiar with trigger / less with variables. I tried to follow the triggers written on the forums but whenever there's variables etc I seem to get stuck, and can never solve this problem.

Please could someone explain this trigger function from the basic and also post an example of such a trigger so I can download and see for myself what's inside?

What I specifically want to do is:

1) combine Claws of Attack +5 *3 = Claws of Attack +9
2) combine Claws of Attack +5 *2 + Gloves of Haste = Dagger (Atk speed +10%, Dmg +8)
3) combine Claws of Attack +9 *2 + Special Item(or Recipe) = Searing Blade

If doing all this is too complicated or you think takes of a lot of your time, I would be very happy if only 1 could be solved.

Thank you very much and have a good day,
 
Level 18
Joined
Mar 16, 2008
Messages
721
are you on wc3 patch 1.35?
so if you have 3 claws of attack(+5) you want them to combine into claws(+9)?

Ideally you would have an item hastable/index but I could make a simpler solution for you.

A bit of a rough draft could be improved with more variables instead of "event responses". probably a lot of other ways to make this trigger better or completely different concepts that would be more ideal but I think this will accomplish what you want at a minimum:
  • item combine trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Hero manipulating item) is A Hero) Equal to True
    • Actions
      • -------- sets counting variables back to zero --------
      • Set VariableSet claws5_count = 0
      • Set VariableSet claws9_count = 0
      • Set VariableSet gloves_of_haste_count = 0
      • -------- checks hero inventory slots 1 to 6 for claws+5 and counts them with the variable --------
      • For each (Integer counting_variable[(Player number of (Owner of (Hero manipulating item)))]) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot counting_variable[(Player number of (Owner of (Hero manipulating item)))])) Equal to Claws of Attack +5
            • Then - Actions
              • Set VariableSet claws5_count = (claws5_count + 1)
            • Else - Actions
      • -------- checks hero inventory slots 1 to 6 for claws+9 --------
      • For each (Integer counting_variable[(Player number of (Owner of (Hero manipulating item)))]) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot counting_variable[(Player number of (Owner of (Hero manipulating item)))])) Equal to Claws of Attack +9
            • Then - Actions
              • Set VariableSet claws9_count = (claws9_count + 1)
            • Else - Actions
      • -------- checks hero inventory slots 1 to 6 for gloves of haste --------
      • For each (Integer counting_variable[(Player number of (Owner of (Hero manipulating item)))]) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot counting_variable[(Player number of (Owner of (Hero manipulating item)))])) Equal to Gloves of Haste
            • Then - Actions
              • Set VariableSet gloves_of_haste_count = (gloves_of_haste_count + 1)
            • Else - Actions
      • -------- removes items and gives "created" item to hero --------
      • -------- problem is what if you have 3 claws and 1 glove of haste? Order matters here i guess then. . . --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • claws5_count Greater than or equal to 3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +5)
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +5)
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +5)
          • Set VariableSet claws5_count = (claws5_count - 3)
          • Hero - Create Claws of Attack +9 and give it to (Hero manipulating item)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • claws9_count Greater than or equal to 2
          • gloves_of_haste_count Greater than or equal to 1
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +9)
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +9)
          • Set VariableSet claws9_count = (claws9_count - 2)
          • Set VariableSet gloves_of_haste_count = (gloves_of_haste_count - 1)
          • Item - Remove (Item carried by (Hero manipulating item) of type Gloves of Haste)
          • Hero - Create Kelen's Dagger of Escape and give it to (Hero manipulating item)
        • Else - Actions

edited*
 

Attachments

  • test Fjoelnir.w3m
    11.3 KB · Views: 1
Level 3
Joined
Feb 5, 2011
Messages
32
are you on wc3 patch 1.35?
so if you have 3 claws of attack(+5) you want them to combine into claws(+9)?

Ideally you would have an item hastable/index but I could make a simpler solution for you.

A bit of a rough draft could be improved with more variables instead of "event responses". probably a lot of other ways to make this trigger better or completely different concepts that would be more ideal but I think this will accomplish what you want at a minimum:
  • item combine trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Hero manipulating item) is A Hero) Equal to True
    • Actions
      • -------- sets counting variables back to zero --------
      • Set VariableSet claws5_count = 0
      • Set VariableSet claws9_count = 0
      • Set VariableSet gloves_of_haste_count = 0
      • -------- checks hero inventory slots 1 to 6 for claws+5 and counts them with the variable --------
      • For each (Integer counting_variable[(Player number of (Owner of (Hero manipulating item)))]) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot counting_variable[(Player number of (Owner of (Hero manipulating item)))])) Equal to Claws of Attack +5
            • Then - Actions
              • Set VariableSet claws5_count = (claws5_count + 1)
            • Else - Actions
      • -------- checks hero inventory slots 1 to 6 for claws+9 --------
      • For each (Integer counting_variable[(Player number of (Owner of (Hero manipulating item)))]) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot counting_variable[(Player number of (Owner of (Hero manipulating item)))])) Equal to Claws of Attack +9
            • Then - Actions
              • Set VariableSet claws9_count = (claws9_count + 1)
            • Else - Actions
      • -------- checks hero inventory slots 1 to 6 for gloves of haste --------
      • For each (Integer counting_variable[(Player number of (Owner of (Hero manipulating item)))]) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot counting_variable[(Player number of (Owner of (Hero manipulating item)))])) Equal to Gloves of Haste
            • Then - Actions
              • Set VariableSet gloves_of_haste_count = (gloves_of_haste_count + 1)
            • Else - Actions
      • -------- removes items and gives "created" item to hero --------
      • -------- problem is what if you have 3 claws and 1 glove of haste? Order matters here i guess then. . . --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • claws5_count Greater than or equal to 3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +5)
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +5)
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +5)
          • Set VariableSet claws5_count = (claws5_count - 3)
          • Hero - Create Claws of Attack +9 and give it to (Hero manipulating item)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • claws9_count Greater than or equal to 2
          • gloves_of_haste_count Greater than or equal to 1
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +9)
          • Item - Remove (Item carried by (Hero manipulating item) of type Claws of Attack +9)
          • Set VariableSet claws9_count = (claws9_count - 2)
          • Set VariableSet gloves_of_haste_count = (gloves_of_haste_count - 1)
          • Item - Remove (Item carried by (Hero manipulating item) of type Gloves of Haste)
          • Hero - Create Kelen's Dagger of Escape and give it to (Hero manipulating item)
        • Else - Actions

edited*


Wow.. thank you so much for the fast & very rigorous reply..

I had to take some time to read through what's happening, and I think I got what the trigger means, though with difficulty.

I've tested (copy-pasted yours) on the map I want to use this trigger, and I think it's working. At the moment I'm just at a stage where I just carefully copy paste the triggers you wrote & changing items and such to expand on the items I want to combine, but I am so glad at least something finally seems to be working on the map I want to use. Thank you very much again.

I have seen some other trigger which looked very simple and tried to follow, but again at variables I got stuck, and with the understanding I got from looking at your script I will try to peruse and understand that one again. Basically I want to make triggers to combine many basic items in the game to create the next level version and maybe involve some OP campaign items.

Thank you again for your time and effort,
 
Status
Not open for further replies.
Top