Thanks for the reply anyways. But yeah, I know I could do it with a global variable, but that would be really sketchy with multiple units being trained by various players on the map. So instead I was trying to grab the "triggering unit" reference from two separate events, and I assume that would have to mean from two separate triggers.
It would be nice to figure out how to link two triggers together in this way, but I did manage to pull off what I wanted by applying a behavior to the newly created unit that searches for a hidden unit and targets it with a dummy ability. This way the two units are linked and I have a trigger go off when that ability is used and I transfer the experience there. It doesn't work well when there are multiple units being trained at one barracks, as it may grab the wrong hidden unit. So I'm trying to figure out a work around for that too now.
So I have an ability that causes the casting unit to walk to a barracks, become hidden and cause the barracks to start training a unit. Both the casting unit and the new unit being trained inside the barracks have Veterancy. What I need is for the newly trained unit to match the amount of experience the casting unit has.
Essentially all I need is to figure out how to reference the completed unit at the end of my ability's effect chain within the trigger, to give it the experience, just not sure how.
My best guess right now would be to create two triggers, one that goes off when "any unit uses myAbility at generic3 - execute stage (ignore shared abilities)", storing how much experience the triggering unit has in a local variable, and then the action would be to wait for a second trigger to go off which would occur when "any unit training progress is completed". Then back in the original trigger, this would be where I would set triggering progress unit *of Trigger 2* experience to my local variable.
But I don't know if this double trigger thing is even possible, or hopefully there's a more efficient way of doing what I need.
@Yaksmanofage: Go
Thanks for the reply anyways. But yeah, I know I could do it with a global variable, but that would be really sketchy with multiple units being trained by various players on the map. So instead I was trying to grab the "triggering unit" reference from two separate events, and I assume that would have to mean from two separate triggers.
It would be nice to figure out how to link two triggers together in this way, but I did manage to pull off what I wanted by applying a behavior to the newly created unit that searches for a hidden unit and targets it with a dummy ability. This way the two units are linked and I have a trigger go off when that ability is used and I transfer the experience there. It doesn't work well when there are multiple units being trained at one barracks, as it may grab the wrong hidden unit. So I'm trying to figure out a work around for that too now.
So I have an ability that causes the casting unit to walk to a barracks, become hidden and cause the barracks to start training a unit. Both the casting unit and the new unit being trained inside the barracks have Veterancy. What I need is for the newly trained unit to match the amount of experience the casting unit has.
Essentially all I need is to figure out how to reference the completed unit at the end of my ability's effect chain within the trigger, to give it the experience, just not sure how.
My best guess right now would be to create two triggers, one that goes off when "any unit uses myAbility at generic3 - execute stage (ignore shared abilities)", storing how much experience the triggering unit has in a local variable, and then the action would be to wait for a second trigger to go off which would occur when "any unit training progress is completed". Then back in the original trigger, this would be where I would set triggering progress unit *of Trigger 2* experience to my local variable.
But I don't know if this double trigger thing is even possible, or hopefully there's a more efficient way of doing what I need.