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

[Trigger] Advice on building/auto-train trigger

Status
Not open for further replies.
Level 2
Joined
Jan 21, 2015
Messages
5
Hey guys, just started editing about a week ago so I'm downright amateur with trigger building, however I've made everything work so far with the following outside of one thing that bothers me about it.

The triggers I have start training units automatically once the structure has been created. My intention is that regardless of how many structures are alive, they only spawn a maximum of 100 units collectively before they stop, or are removed from the game, is the only way I've been able to make it work so far.

Everything works except the following problems:

-When I reach the unit limit, it destroys my structures.
-When I reach the unit limit and build the structure again, it removes the structure but creates one extra unit that remains after the limit, this happened after I changed the limit of units to: greater than or equal to 100 because when I had equal to 100, building a new structure caused the process to repeat itself to the next interval of 100.

My intentions:

1-My structures to remain once I've hit the unit limit.
2-My structures to remain and continue training units when the limit is below cap.
3-My structures buildable at unit limit, but it doesn't train anything unless the limit is below cap and doesn't remove the structure.
4-To allow only a maximum of 5 structures (of any combination, ie: 5 barracks, or 2 barracks and 3 town halls, or 3 barracks, 1 town hall, 1 blacksmith, etc) for each player (there are only 3 available structures total on the map) to be built at any one time. (I do not have a trigger for this one yet)

I'm sure I've just worded the conditions poorly or what have you but here are the ones i am currently using, and any help to redesign or make them functional would be hugely appreciated, thank you :)

Please note that this is a 2 player only map, if that makes any outcome easier.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Felblood Rift Green
    • Actions
      • Unit - Order (Constructed structure) to train/upgrade to a Felspawn Hunter
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Felfire Rift Red
    • Actions
      • Unit - Order (Constructed structure) to train/upgrade to a Felspawn Soldier
  • Untitled Trigger 001 Copy 2
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Felshard Rift Blue
    • Actions
      • Unit - Order (Constructed structure) to train/upgrade to a Felspawn Conjuror
  • Untitled Trigger 002
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Unit - Order (Triggering unit) to train/upgrade to a (Unit-type of (Trained unit))
  • Untitled Trigger 003
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Number of units in (Units owned by (Owner of (Triggering unit)))) Greater than or equal to 100
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: General, our army h...
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
  • Untitled Trigger 003
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Number of units in (Units owned by (Owner of (Triggering unit)))) Greater than or equal to 100
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: General, our army h...

This has to have a little rework.

1. Name your ******* triggers.
2. Unit - A unit Finishes training a unit
- Unit - A (Triggering unit) Finishes training a unit
- Unit - Remove (Triggering unit) from the game
- Unit - Remove (Triggering unit that Finished training a unit) from the game
Do you see the problem?
Always take a moment to find out who (Triggering unit) is.
In this case you need (Trained unit) Look at the description to find out what it does:
Ai2xAqi.png


3. Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: General, our army h...
You should consider (Convert (Player) to player group) instead of (players matching (condition)).
 
Level 2
Joined
Jan 21, 2015
Messages
5
Those small fixes literally fixed every one of my problems.

I think I just spent too much time over thinking it and was getting frustrated, I should have named the triggers but I kept on deleting old ones and trying new things, I'll remember next time.

Really appreciate it though thank you Wietlol.

+rep
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
To allow only 5 structures is a bit harder.
This is what I have so far:
  • Remove Structure
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Barracks
          • (Unit-type of (Triggering unit)) Equal to Town Hall
    • Actions
      • Set TempInteger = (Player number of (Owner of (Triggering unit)))
      • Set CountStructures[TempInteger] = (CountStructures[TempInteger] - 1)
  • Restrict building
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(Town Hall))
          • (Issued order) Equal to (Order(Barracks))
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempInteger = (Player number of (Owner of TempUnit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • CountStructures[TempInteger] Greater than or equal to 5
        • Then - Actions
          • Game - Display to (All players) the text: no new structure
          • Game - Display to (All players) the text: (TempUnit = + (Name of TempUnit))
          • Unit - Order TempUnit to Stop
        • Else - Actions
          • Game - Display to (All players) the text: new structure
          • Set CountStructures[TempInteger] = (CountStructures[TempInteger] + 1)
The problem is that:
- issure order to stop doesnt work.
- If you stop the unit before building, the CountStructures[] is still added.

If anyone has some ideas concerning this it will be very appreciated... by Icedchambers... not me, idc.

BTW: I suppose this should be in WE help zone. Am I right?

EDIT: Issue order to stop works. Added pause unit + unpause unit
The other bug is still there
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Instant cast???
I actually thought that you use the regular wc3 building system.

I cannot cancel the constructing of a building properly when it has started constructing.
On the other hand, this trigger runs when you order the unit to walk to the targeted area and build a structure there.
In the time between those, there could be another unit that constructs a building or the unit could have canceled/overwritten the order.
 
Status
Not open for further replies.
Top