I am trying to build a teleport spell that works like this:
Science Vessel has an ability that spawns a "Teleport Robot" at target location.
Both the Teleport Robot and the Vessel can move around on the map.
If any ground unit comes close to the Teleport Robot, that unit will immediately be teleported to the current location of the Vessel.
BUT! Units can only be teleported between the Robot and the Vessel that created the Robot... So there is like a connection / link between them...
A player can have many Vessels in play at the same time, but each Vessel can only have one Robot in play at the same time. If the Vessel would die, then the Robot would not teleport units anymore. (And be useless)
My major concern is how to create the "teleport link" between a specific Vessel and the Robot... I assume when a unit is teleported, it will use a search effect that checks where the Vessel is on the map. A persistent effect is created at that location, which is then linked to the teleport effect... Hmm..
Any ideas or suggestions?
Ps. I add some pictures below to illustrate the concept, in case my written description is not clear enough
if you add a buff from the vessel to the robot you can reference the vessel from the robot. it's the caster unit from the buff. so the search effect on the buff should be able to teleport it back to caster.
Assuming the Vessel creates the robot you can use the "Creation Effect" field on the Create Unit effect. If everything is part of one effect chain you can call up the scopes of individual effects to select targets, in this case Caster for the Scivessel and variations of Source and Target for the robot and teleport victim. Iirc the creation effect is executed with the creator as the Caster, created unit as the Source and Target will bei either the created unit or where the creation occured. Note scope assignments used to be inconsistent with these auxilliary effect fields, some used to assign the spawned unit as the Caster.
In general just try all possible combinations of scopes until you get the hang of it, and test with child effects like Psi Storm or Blinding Cloud for easy visualisation.
For your specific case probably just set the Creation Effect to a Persistent->Search->Teleport and aim the TP at Caster Point.
I have experimented in a test map now during the evening, but units refuse to be teleported to the Vessel. I have checked other threads about teleport as well. I think I am screwing up on the location and target / impact fields (caster unit, target unit, source unit etc.)
In my test map I use Auto-Turret as the teleportation robot, and the Raven as a Science Vessel.
Here is how I try to set it up:
Raven spawns Auto-Turret: adds a buff to the Auto Turret. (That will let the Raven be referred to as a "caster unit")
The buff on the Auto-Turret has a search effect that checks for nearby ground units. (These units will be teleported away)
The search effect creates a persistent at the location of each nearby ground unit.
The persistent effect runs another search effect that checks where the players Raven is. (Range 500 so it searches the entire map)
A persistent effect is created at the location of the Raven, which runs the teleport effect.
The teleport effect is setup like this:
Target+ Persistent at Raven: Caster unit (This is the location where units should be teleported to)
Source+ Persistent at ground unit: target unit (This is the location where units are teleported from)
I attach my test map here, in case anyone has time to take a look at it. I have tested different variations on it, so it looks a bit messy now. All custom effects and behaviours start with 111 in their name, so it is easy to search for them at least.
Two problems - when the PortalBot dies the persistent remains, which causes units to still be teleported from that location. When the Raven dies, units are still teleported to the location of its death. (So if both the PortalBot and the Raven are dead, units teleport between their graves... :p)
One problem - when the Raven dies, units are still teleported to the location of its death.
I have tested:
- Exclude "Dead" from the search effects
- Validators that checks if units are dead (both in the teleport and the search for Raven effects)
- Destroy Persistent effect to "clean up" the location where the Raven dies
- Use a short duration on both periodic effects, so they are removed after a few seconds...
But none of it appear to work...
Any ideas how to get the teleportation to stop when the Raven dies?
Ps. It would probably be easiest for players if the Teleportation Robot also dies when the Raven dies, to avoid confusion... Here is how I have tried to solve it:
- Raven has a permanent buff
- Buff has Effect Final: - Search effect for entire map
- Search effect applies damage (and should be validated to only check for the Robot created by that specific Raven)
So when the Raven dies, Effect Final happens on the buff, which searches the map after the Robot and kills it... But now it kills all Robots on the map... >_<
you'll add a validator to the buff which validates if caster unit is alive (to the remove behaviour field), effect final on the buff is a damage effect with kill flag for source unit. so when the caster (raven) unit dies the buff gets removed on all sentries which kills them.
How's the persistent is not necessary? you surely missed something. You need either persistent or buff to keep the caster reference within the effect's scope to perform the teleport. For the two problems you mentioned: just combine two validators in one 1) Caster Not Dead and 2)Target Not Dead. And put it in periodic validator field of the persistent.
Do you know any concrete advantage to using a Buff over a Persistent? The need for an Apply effect and having to scroll between the "Behavior" and "Effect" tabs during future tweaking always seems like an unnecessary hassle to me, and the end result is functionally identical for "simple" setups.
Of course if your setup involves buffing the host anyway, might as well host the aura on that too.