You could do this in the data editor. I don't know that you can teleport the unit to the closest Town Hall, but I think what you're asking is basically like Recall except the target isn't an area, but a unit. If that's the case, you can change the target of the ability to a Unit. I don't know off the top of my head how to exactly go about doing this, I would need to look directly at it. But it's somewhat possible with Triggers. Triggers are almost exclusively reserved for map events and gameplay initialization, such as button panels and cameras. You might be able to do something with an Unit Uses Ability event and Move Unit Instantly action, but it would be easier imo to just change the target of the preexisting Recall ability
the problem I have with the data editor solution is that I fail to make units teleport to their own town hall. The spell never checks for that, it teleports the wrong players units to the wrong town halls. Maybe there is a better solution with triggers?
You pretty much would use an Effect - Instant ability that uses a global Search Area effect that has the filters set to player that uses a Teleport Effect which teleports the caster to the target. You then validate the teleport effect based on Unit Type.
Thank you, the problem is that when I use "Player" the teleport effect always teleports all units to my town hall since I am the "player", it never teleports the corresponding unit to its owner's town hall. That is the problem I have - how to teleport every unit to its corresponding town hall? (Player 1 units to player 1's town hall, player 2 units to player 2's town hall, and so on)
THANK YOU!!! The trigger works!! Ahhh I am so glad that it works..
I agree with you - this should be doable in the data editor and I have built the entire spell. But for some reason that I cannot understand, units are not teleported to their corresponding town hall and I don't know why T_T ... but your trigger fixes that!
May I bother you with two additional short questions? (I promise, then I will be quiet)
1) How do I make the Event in the trigger check for an effect or a behavior? My ability adds a buff or an effect to the targeted unit, then it becomes teleported by the trigger. I find no good Event for that :O 2) Now units are teleported "inside" the town hall model and it looks odd. Is it possible to teleport it next to the structure? In the data editor there is a field "Placement range" that places teleported units near a structure. I check in the trigger fields for "Points" and I find X,Y,Z offsets, but the town halls migh be on different locations on different maps.. Hmm
Tip for anyone finding this thread in the future - if your teleported unit gets stuck "inside" a building that it is teleported to, you can make your ability give it the unit a Wander behaviour and then remove if after 1 second. This makes your teleported unit go into a random direction, thus moving away from your building and not being stuck anymore.