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

[Solved] Unit train crafting system

Status
Not open for further replies.
Level 4
Joined
May 24, 2017
Messages
93
  • Smelt Rock
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
      • (Trained unit-type) Equal to Smelt Stone
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Stone) Equal to True
          • (Charges remaining in (Item carried by (Triggering unit) of type Stone)) Greater than or equal to 5
          • ((Triggering unit) has an item of type Wood) Equal to True
          • (Charges remaining in (Item carried by (Triggering unit) of type Wood)) Greater than or equal to 5
        • Then - Actions
          • Item - Set charges remaining in (Item carried by (Triggering unit) of type Stone) to ((Charges remaining in (Item carried by (Triggering unit) of type Stone)) - 5)
          • Item - Set charges remaining in (Item carried by (Triggering unit) of type Wood) to ((Charges remaining in (Item carried by (Triggering unit) of type Wood)) - 5)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by (Triggering unit) of type Wood)) Equal to 0
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) of type Wood)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by (Triggering unit) of type Stone)) Equal to 0
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) of type Stone)
            • Else - Actions
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000You need ...
          • Wait 0.01 seconds
          • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 851976 )
I want to use this trigger to create a smelting system hat can be queued up. This trigger works but it has two issues that I hope can be fixed.
1. This only triggers on the first training order, so it wont check the conditions when it queues up the second training. How do I make it work on more then one training?
2. Is there a way to remove the wait at the end? I guessed that it happened before the training happened which is why it would not cancel before I added the wait. Just the way "A unit takes damage " happens.

Any help is good. Thank you
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
So what you want to do is change your Event to use Orders instead.

Create a trigger like this to figure out the name of the order associated with training Smelt Stone:
  • Get Order Name
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Game - Display to (All players) for 30.00 seconds the text: (String((Issued order)))
Then edit your Smelt Rock trigger to look like this:
  • Smelt Rock
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(smeltstone))
    • Actions
      • -------- Do the rest of your Actions --------
Replace "smeltstone" with the name of the order associated with your Smelt Stone unit.

If it's a custom unit it will have an order string like: "custom_" + the unit's rawcode: "h000".
Resulting in something like: custom_h000
 
Level 4
Joined
May 24, 2017
Messages
93
Thank you so much for the solution. It worked.

I have one more question. I have been importing icons for the first time. What is the disabled icon for? does importing that get rid of the green squares when you pause?

Thank you for the help.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Is the disabled version just the regular file with a different path?
No, the disabled version has a black filter over it and the icon border is removed.

Here's an example: Zeus Strike
Click that link and scroll down a bit to see the different types of icons.

You can see the BTN (default), DISBTN (disabled default), PAS (passive), DISPAS (disabled passive), ATC (autocast), DISATC (disabled autocast) files.

What people do is create a BTN icon, that is the standard icon format, and then use a program to create alternate versions of it.

For example you can use Button Manager v1.8.2 to create a new version of your Icon using one of the many different border styles.
 
Status
Not open for further replies.
Top