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

Removing an Item through triggers results in keeping Item Stats

Status
Not open for further replies.
Level 10
Joined
Jan 20, 2011
Messages
492
Hey guys I've made a small crafting system where if I get a certain amount of an item I go through a trigger and I delete the charges of the item, and then the normal buy procedure occures.

In the off occasion that the person has the money/lumber required by not the charges as well, the money/lumber will be refunded and the bought item will have to be removed from the inventory to simulate that you haven't bought the item. The problem with this is that when I buy this item that gives +3 armor, and everytime I click to buy the item when I have enough gold/money but not enough item charges I permanently keep the +3 armor even when I don't have the item in my inventory since it has been removed.

Does anyone know a way to fix this problem

Trigger:
Crafting Init
Events
Map initialization
Conditions
Actions
Set CraftGold[1] = 200
Set CraftGold[2] = 300
Set CraftMaterial[1] = 4
Set CraftMaterial[2] = 6
Set CraftCharges[1] = 2
Set CraftCharges[2] = 3
Set CraftItem[1] = |cff00ff80Shimmerweed String|r
Set CraftItem[2] = |cff00ff80Shimmerweed String|r
Set CraftFinish[1] = |cffffff80Rough Leather Armor|r
Set CraftFinish[2] = |cffffff80Fury Helm|r
  • Craft Item
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Elin
    • Actions
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CraftFinish[(Integer A)] Equal to (Item-type of (Sold Item))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Charges remaining in (Item carried by (Buying unit) of type CraftItem[(Integer A)])) Greater than or equal to CraftCharges[(Integer A)]
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by (Buying unit) of type CraftItem[(Integer A)]) to ((Charges remaining in (Item carried by (Buying unit) of type CraftItem[(Integer A)])) - CraftCharges[(Integer A)])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Charges remaining in (Item carried by (Buying unit) of type CraftItem[(Integer A)])) Greater than or equal to 0
                    • Then - Actions
                      • Item - Remove (Item carried by (Buying unit) of type CraftItem[(Integer A)])
                    • Else - Actions
                • Else - Actions
                  • Item - Remove (Sold Item)
                  • Game - Display to (Player group((Owner of (Buying unit)))) for 1.25 seconds the text: You don't have enou...
                  • Special Effect - Create a special effect attached to the origin of (Buying unit) using Abilities\Spells\Other\Transmute\PileofGold.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Player - Add CraftGold[(Integer A)] to (Owner of (Buying unit)) Current gold
                  • Player - Add CraftMaterial[(Integer A)] to (Owner of (Buying unit)) Current lumber
            • Else - Actions
 
Level 10
Joined
Jan 20, 2011
Messages
492
The sold item gets removed if I dont have enough charges on the crafting material otherwise I can buy items without the required crafting item

also the sold item is what the shop owner sells, not me

anyway I think I have a way around it I will use a dummy item (tome) and add the real item if conditions are met


thanks for the link it gave me the idea
 
Last edited:
Status
Not open for further replies.
Top