• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Profession stuff ?!?

Status
Not open for further replies.
Level 15
Joined
Sep 27, 2009
Messages
672
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
 
  • 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.
Back
Top