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

Last Created Unit ()

Status
Not open for further replies.
Level 10
Joined
Mar 31, 2009
Messages
732
So um... Here is what I have:

  • Unit - Order Probe [28.52, 143.66] to (Probe - Warp In Forge targeting Wave 4 build forge) (Replace Existing Orders)
    • Variable - Set Forge = Value
How can I set that Variable to the unit that was created by that Issue Order action?
LastCreatedUnit() will only get the unit created by a Create Unit action.

Question 2:
Say I have a Factory, it has the ability Factory - Train. To stop the factory from training anything, I would use action Enable/Disable ability. What if I only want to disable Hellions, how would I go about that?
 
Level 9
Joined
Nov 4, 2007
Messages
931
To the first question, you will need an event to detect when a units construction is complete, I see no way of detecting it as a product of an order issued from a trigger action to a unit within the same trigger.

To the second question, try using the action Allow/Disallow Unit For Player.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
last created unit and triggering unit is not the same unit at all in wc3. I see no logic in why it would be it here.

Last created unit is responding to a unit which has been created. Triggering unit responds to a unit which is triggering an event.
 
Level 11
Joined
Aug 1, 2009
Messages
963
LastCreatedUnit() now returns the last unit created via unit creation functions.

Also, just make a trigger which has an event of "unit starts constructing" or something like that.

For the second question, just Disallow the unit for the player. if you want to disable certain buildings from building hellions, but not others, add a behavior (hidden) called "can't build hellions" or something like that, and add a requirement to building hellions that requires you not to have that behavior.
 
Status
Not open for further replies.
Top