StarCraft® II

Getting which CERTAIN unit was created?

Posts: 143
Right now, I'm stuck at finding the "name" of the last created unit.

If player 1 is Protoss (Which I have made compulsary for my game) and they build a gateway, I want an action to fire.
Reply Quote
Posts: 1,239
You need a comparison condition, along the lines of: Unit Type of (Last created unit)=Gateway .
Reply Quote
Posts: 143
Thanks, I'm testing that now.
Reply Quote
Posts: 143
It doesn't work... perhaps because I made a probe while it was building.
Do you think (Triggering Unit) will work?
Reply Quote
Posts: 143
Bump?
Reply Quote
Posts: 130
If you're using the "Unit construction progress" event, then yes the failure would most likely be because of making the probe in between. In which case

Use "Triggering Progress Unit Type" to get the unit type of the unit that is under construction. Use "Triggering Progress Unit" to get the unit that is under construction.

And that's a quote from the trigger editor.

If you're using the "Unit Is Created" event, the event will fire as soon as construction is started, which depending on what you're trying to do may mess up your results. "Last Created Unit" should reliably refer to the created unit in this case, I believe, but you can also use "Created Unit", which is for this exact context and will surely be dependable.
Reply Quote
Posts: 143
You are my saviour! Thanks!
Reply Quote
Posts: 156
I think this should work... didn't test.

Events
Unit - Any Unit construction progress is Completed
Local Variables
Conditions
(Unit type of (Triggering unit)) == Gateway
Actions
Reply Quote
Posts: 2,541
09/09/2012 11:24 AMPosted by TheFed
If you're using the "Unit Is Created" event, the event will fire as soon as construction is started, which depending on what you're trying to do may mess up your results. "Last Created Unit" should reliably refer to the created unit in this case, I believe, but you can also use "Created Unit", which is for this exact context and will surely be dependable.

"Last Created Unit" refers to the most recent unit that was created using the "Create unit" trigger actions.

Turtle's solution should work the best (although "Triggering unit" might need to be changed to "Triggering progress unit").
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]