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

Combining Items of the same type.

Status
Not open for further replies.
Level 4
Joined
Feb 5, 2017
Messages
9
Hello everyone. I am new here and wanted to ask for some help. I have been making Warcraft 3 maps over the years out of fun however I am new to triggering.

I started a campaign where I want consumable items to stack and items of the same type to combine into a more powerful one. The first one I got working.

However the second one is too complicated for me. What I would like to do is if my hero has two "Ring of Protection +1" in his inventory, they would combine into "Ring of Protection +2".

I would really appreciate your help. Best way could be if someone could create a map as an example so that I could study it. Thank you in advance.
 
Here a fusion-System. It will fuse 2 same items into a new: A simple needing one Trigger for each Item-Type to fuse.
The Second one is alot more advanced, has a Init in which you setup the fusions before and a "complex" fusion.

If you want other Items to fuse copy this Trigger and change the Item Type
  • Fuse Ring of Protection
    • Events
      • Unit - Gains an Item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal Ring des Schutzes +2
    • Actions
      • -------- Loop inventory of Hero --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Schleifen - Aktionen
          • -------- Is the ItemType at Slot 1/2/3/4/5/6 =the same as the gained? --------
          • -------- But not the gained --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal Ring des Schutzes +2
              • (Item carried by (Triggering unit) in slot (Integer A)) UnEqual (Item being manipulated)
            • Then - Actions
              • Gegenstand - Remove (Item carried by (Triggering unit) of type Ring des Schutzes +2)
              • Gegenstand - Remove (Item carried by (Triggering unit) of type Ring des Schutzes +2)
              • Held - Create Ring des Schutzes +4 and give it to (Triggering unit)
              • -------- Eye Candy --------
              • Spezialeffekt - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Spezialeffekt - Destroy (Last created special effect)
              • -------- End THis Trigger --------
              • Skip remaining actions
            • Else - Actions


Detail:
  • This Requiers knowlage about Arrays.
  • But requiers later none further Change in the Fusion Trigger.
  • All Data is set before.
  • Fuse same Items init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Set Fusion_Type_Last = -1
      • -------- Create a Entity --------
      • Set Fusion_Type_Last = (Fusion_Type_Last + 1)
      • Set Fusion_Type_Amount[Fusion_Type_Last] = 2
      • Set Fusion_Type_Mat[Fusion_Type_Last] = Ring des Schutzes +2
      • Set Fusion_Type_Target[Fusion_Type_Last] = Ring des Schutzes +4
      • -------- ----- --------
      • Set Fusion_Type_Last = (Fusion_Type_Last + 1)
      • Set Fusion_Type_Amount[Fusion_Type_Last] = 2
      • Set Fusion_Type_Mat[Fusion_Type_Last] = Oger-Kraft-Handschuhe +3
      • Set Fusion_Type_Target[Fusion_Type_Last] = Gürtel der Gigantenkraft +6
      • -------- ----- --------
  • Fuse same Items better
    • Events
      • Unit - Accquiers an Item
    • Condtions
      • ((Item being manipulated) is a Powerup) Equal False
    • Actions
      • Set Item_Type = (Item-type of (Item being manipulated))
      • Set Counter = 0
      • -------- Loop inventory of Hero --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Schleifen - Aktionen
          • -------- Is the ItemType at Slot 1/2/3/4/5/6 =the same as the gained? --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal Item_Type
            • Then - Actions
              • -------- Yes increase Counter for each found type --------
              • Set Counter = (Counter + 1)
            • Else - Actions
      • For each (Integer B) from 0 to Fusion_Type_Last, do (Actions)
        • Schleifen - Aktionen
          • -------- Find the Right Fusion and check if needed ammount of Mats is avaible? --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Item_Type Equal Fusion_Type_Mat[(Integer B)]
                • Counter Greater Equal Fusion_Type_Amount[(Integer B)]
              • Then - Actions
                • -------- Fuse --------
                • -------- The Ammount of Items to destroy --------
                • Set Counter = Fusion_Type_Amount[(Integer B)]
                • -------- Destroy and Count down --------
                • For each (Integer A) from 1 to 6, do (Actions)
                  • Schleifen - Aktionen
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal Item_Type
                        • Counter Greater as 0
                      • Then - Actions
                        • Set Counter = (Counter - 1)
                        • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
                      • Else - Actions
                • Held - Create Fusion_Type_Target[(Integer B)] and give it to (Triggering unit)
                • -------- Eye Candy --------
                • Spezialeffekt - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIem\AIemTarget.mdl
                • Spezialeffekt - Destroy (Last created special effect)
              • Else - Actions
 

Attachments

  • Fuse Items.w3x
    18.8 KB · Views: 186
Last edited:
Status
Not open for further replies.
Top