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

[Trigger] Lumber cost of an item.

Status
Not open for further replies.
Level 3
Joined
Aug 11, 2007
Messages
36
I'm having some slight trouble with a set of triggers I'm trying to make.

In theory, it would make it so you require X amount of lumber to get an item, but you wouldn't actually lose the lumber. There doesn't seem to be a "Lumber Cost of Item" variable of any variety, nor do I want to risk setting the life of items to super low values that this might need and syncing the life and lumber cost.

Is there a way to have it just cost nothing but require X lumber?

Thanks in advance.
 
Level 8
Joined
Mar 23, 2007
Messages
302
y, ofc there is a way.
would look like this , Theoretical:

Unit buys Item
Trigger checks if Player has X lumber

If then else:
If y then do nothing
else drop item and remove/destroy it
 
Level 4
Joined
Mar 15, 2008
Messages
71
A better idea would be :
Set the lumber cost of an item to X ,meaning that a player must have that much lumber to buy the item,and when he buys it just give him back the lumber he spent,simple,fast,efficient :)
  • Untitled Trigger 001
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to <Your Item Type>
    • Actions
      • Player - Add <X> to (Owner of (Buying unit)) Current lumber
 
Level 3
Joined
Aug 11, 2007
Messages
36
I suppose that's how it'll have to go, but there's going to be dozens/hundreds of items to do and a trigger that runs through the list in some fashion might be counter productive. I think I'll just set their life to their lumber cost and use that (you can find the life, you can't find the cost :( )
 
Level 3
Joined
Aug 11, 2007
Messages
36
There's a lot of different items with a lot of different costs.

And even if I did make a couple hundred triggers that check for Item-type = something condition, I know that I will make the mistake often of changing the lumber but not the trigger.
 
Level 5
Joined
May 27, 2007
Messages
126
if you want the items to have different lumber requirements then AKI_SER's way is the only way you could do it. But you dont need to make countless new triggers, you could also make it a if, then, else multiple functions trigger for it so you dont have to make countless triggers just 1 very big one :)

like this:

  • Trigger
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to <You're FirsItem>
        • Then - Actions
          • Player - Add X* to (Owner of (Buying Unit)) Current lumber
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Sold Item)) Equal to <You're SecondItem>
            • Then - Actions
              • Player - Add Y* to (Owner of (Buying Unit)) Current lumber
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Sold Item)) Equal to <You're ThirdItem>
              • Then - Actions
                • Player - Add Z* to (Owner of (Buying Unit)) Current lumber
                • Else - Actions
X* = lumber cost of your first item
Y* = lumber cost of your second item
Z* = lumber cost of your third item

SIDENOTE - I didn't test this trigger ingame yet, so you MIGHT need to add in the "Else - Actions" te following action: Do Nothing
 
Status
Not open for further replies.
Top