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

Unit selecting

Status
Not open for further replies.
Level 4
Joined
Jun 14, 2008
Messages
72
hi I am making a map that when you start you get a unit that has the ability to train light heavy and special units, there are more units then there are spaces so the goal is when u click the train heavy units button, it gos to a different unit that's an exact copy but trains the units (same with light and unique) but my trigger doesn't work, it refuses to work the ability does nothing here my code


  • Heavy unit selector
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Heavy units
    • Actions
      • Unit Group - Pick every unit in (Units in Unit picking <gen> matching (((Unit-type of (Picked unit)) Equal to Unit picker Heavy) and ((Owner of (Triggering unit)) Equal to (Owner of (Picked unit))))) and do (Actions)
        • Loop - Actions
          • Selection - Select (Picked unit) for (Owner of (Triggering unit))
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I will start by asking the simple question, are all those units really nescescary? Remember that all units should be usable through out the game if they are available. If a unit becomes obsolete or too weak to be worth building as the game progresses, consider removing it from the build list and replacing it with one which is more usable.

Can we have some more information as to where these buildings are found to be selected. If it is a static building (always on the map) consider using a variable referencing it based on the player (an array of units which index is the number of the player and holds the producer). If they are variable you might whish to attach all the sub buildings to the main building via a trigger system for improved efficency or to swap the main building for the right production building.

Anyway, you should definatly avoid picking large ammounts of units to find the one you are after every time this is run and also especially avoid leaks as the example you posted leaks handle objects.

Also keep in mind that your current idea would allow for them to multi build units. Eg they could be building an experimental, heavy and light unit all at the same time so I advise making sure this is the behaviour you which to obtain.
 
Status
Not open for further replies.
Top