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.
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
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.
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
To post a comment, please login or register a new account.
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.
@LostMapmaker: Go
I'm not much of an advanced user, but I usually solve this problem by storing the value in a variable.
E.G.: When the unit is using the ability store the value by changing a variable
or
You can have the EXP variable as either a real or an integer, I use integers because it's easier but I imagine it should work both ways.
EDIT: just now realized, you already said my way. Suffice it to say I'm pretty sure it's your only option.
@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.
@LostMapmaker: Go
Well, I would use an action definition if I were you. In fact I could make you one if you like.