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

Profession stuff ?!?

Status
Not open for further replies.
Level 15
Joined
Sep 27, 2009
Messages
669
Hey guys, I made a trigger that should do this:
I use stack system so some items are based on charges...
-When you have 1 charge of Iron Ore, and you buy Iron Bar(dummy) that costs 5 gold, you will should get 1 Iron Bar.
-And when you have more than 1 Iron Ore and make Iron Bar, it should decrease charges of Iron ore by 1.

-In my map it's working like this:
-When I have 1 Iron ore, and it does the job (removes my item)...
-When I have 2 Iron ores (THIS IS BUG) and buy "dummy" It will make 2 Iron Bars...
-If charges of Iron Ore is 3 or more it will do the job and decrease 1 charge...
But if it's 2 it will make 2 Bars...

Here's Trigger:
  • Iron Bar Make
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Iron Bar
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Buying unit) has an item of type Minning Pick) Equal to True
          • (Charges remaining in (Item carried by (Buying unit) of type Iron Ore)) Greater than 1
        • Then - Actions
          • Item - Set charges remaining in (Item carried by (Buying unit) of type Iron Ore) to ((Charges remaining in (Item carried by (Buying unit) of type Iron Ore)) - 1)
          • Hero - Create Iron Bar and give it to (Buying unit)
        • Else - Actions
          • Player - Add 5 to (Owner of (Buying unit)) Current gold
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Buying unit) has an item of type Minning Pick) Equal to True
          • (Charges remaining in (Item carried by (Buying unit) of type Iron Ore)) Less than 2
        • Then - Actions
          • Item - Remove (Item carried by (Buying unit) of type Iron Ore)
          • Hero - Create Iron Bar and give it to (Buying unit)
        • Else - Actions
          • Player - Add 5 to (Owner of (Buying unit)) Current gold
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
  • Your Trigger
    • Events
      • Unit - A unit Sell a unit
    • Conditions
      • (Unit-type of (Sold unit)) Egal to Iron_Bar_dummy
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • ((Buying unit) has an item of type Mining_Pick) Egal to TRUE
          • ((Buying unit) has an item of type Iron_Ore) Egal to TRUE
        • Alors - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • (Charges remaining in (Item carried by (Buying unit) of type Iron_Ore)) Egal to 1
            • Alors - Actions
              • Objet - Remove (Item carried by (Buying unit) of type Iron_Ore)
              • Heros - Create Iron_Bar and give it to (Buying unit)
            • Sinon - Actions
              • Objet - Set charges remaining in (Item carried by (Buying unit) of type Iron_Ore) to ((Charges remaining in (Item carried by (Buying unit) of type Iron_Ore)) - 1)
              • Heros - Create Iron_Bar and give it to (Buying unit)
        • Sinon - Actions
          • Joueur - Add 5 to (Owner of (Buying unit)) Or actuel
take your exact trigger and change it like this...
(i wanted to do fast so i didn't created unit and item, i just used variable, but don't care about that, do it just like you did, but modify it structure to be like mine...

event: unit sold
condition: unittype of sold unit
action:if/then/else

If buying unit has item 1 and 2

then do:check the iron ore charge
. . . .if charge =1
. . . .then remove item and create iron bar
. . . .else set charge of item to charge of item -1 and create iron bar

else: do nothing and return the 5 gold
 
Status
Not open for further replies.
Top