• 🏆 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] Extra Stacking

Status
Not open for further replies.
Level 10
Joined
May 20, 2008
Messages
433
I have a trigger that allows item stacking of certain items, but when you first pick up that item, you get double its normal charge, then as you pick up more, you get the correct amount. In other words: you pick up a medpak with 3 charges in it. You have no other medpaks in your inventory, and when you pick it up, you have 6 medpaks. The medpak was also spawned just before you pick it up, so it wasn't used before. You pick up another, and you have a total of 9 (from 2 packs)
Heres the trigger (might look familiar to the tutorials):
  • Stacking
    • Events
      • Unit - A unit owned by Player 1 (Red) Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Medpak k
          • (Item-type of (Item being manipulated)) Equal to Medpak
    • Actions
      • Set Item_TempItemCount = 0
      • Set Item_TempChargeCount = 0
      • 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
              • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Medpak k
            • Then - Actions
              • Set Item_TempItemCount = (Item_TempItemCount + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Item_TempItemCount Equal to 2
        • Then - Actions
          • Set Item_TempChargeCount = (Charges remaining in (Item being manipulated))
          • Item - Remove (Item being manipulated)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Item_TempItemCount Equal to 1
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to Medpak k
                • Then - Actions
                  • Set Item_TempChargeCount = (Charges remaining in (Item being manipulated))
                • Else - Actions
            • Else - Actions
              • Hero - Create Medpak k and give it to (Hero manipulating item)
      • Item - Set charges remaining in (Item carried by (Hero manipulating item) of type Medpak k) to ((Charges remaining in (Item carried by (Hero manipulating item) of type Medpak k)) + Item_TempChargeCount)
Its from the tutorials, so look there for more clarification. Medpak and Medpak k are the same, but (as in the tutorial) medpak is used when you pick it up.
Man this map is getting many glitches (wonder what others there are:bored:).
 
Level 11
Joined
Nov 15, 2007
Messages
781
  • Events
    • Unit - A unit owned by Player 1 (Red) Acquires an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Medpak
  • Actions
    • Hero - Drop (Item being manipulated) from (Hero manipulating item)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Hero manipulating item) has an item of type Medpak) Equal to True
      • Then - Actions
        • Item - Set charges remaining in (Item carried by (Hero manipulating item) of type Medpak) to ((Charges remaining in (Item carried by (Hero manipulating item) of type Medpak)) + (Charges remaining in (Item being manipulated)))
        • Item - Remove (Item being manipulated)
      • Else - Actions
        • Trigger - Turn off (This trigger)
        • Hero - Give (Item being manipulated) to (Hero manipulating item)
        • Trigger - Turn on (This trigger)

This one always works for me.
 
Status
Not open for further replies.
Top