Create a global variable of the Unit type. Then make it so that when the unit is created in Trigger A, that same trigger assigns the last unit created to the global variable. Then just have Trigger B refer to that variable.
Bump i thought ti would work but it didnt. You cant assign (Last created unit) with a unit type variable.
Edit: I tried making a global variable Unit, and then assigning that Unit (Last created unit) in my hero selection trigger. Still didnt recognize the unit.
"Unit" is a reference to a unit object
"Unit Type" is a reference to a class of unit
You cannot have a reference to an object that does not exist, so you cannot reference a unit before it is created.
You're a little vague in what you're trying to do but I assume you have several units standing around and the player "selects" one of them by walking up to it?
What you would need to do is...
step1:playermoveshisselectortoaregionstep2:setaglobalUnitTypevariabletothetypeofunitassociatedwiththatregionstep3:createanewunitoftheunittypeintheglobalvariableyoujustmadefortheplayer#thatmovedthere,step4:createaunitreferenceto"last created unit"
How do you refer to a unit that hasnt been created yet and in another trigger?
Im trying to refer to whatever unit Player one picked, but i cant use Last created unit, because that doesnt take values from other triggers.
Create a global variable of the Unit type. Then make it so that when the unit is created in Trigger A, that same trigger assigns the last unit created to the global variable. Then just have Trigger B refer to that variable.
Wiat a sec this doesnt work. You cant assign a Unit type variable with a last created unit.
Bump i thought ti would work but it didnt. You cant assign (Last created unit) with a unit type variable.
Edit: I tried making a global variable Unit, and then assigning that Unit (Last created unit) in my hero selection trigger. Still didnt recognize the unit.
"Unit" is a reference to a unit object "Unit Type" is a reference to a class of unit
You cannot have a reference to an object that does not exist, so you cannot reference a unit before it is created.
You're a little vague in what you're trying to do but I assume you have several units standing around and the player "selects" one of them by walking up to it?
What you would need to do is...