# Teleport. Switch.

#### Kwah

Level 24
Why does this not work?

• Switch
• Events
• Unit - A unit Starts the effect of an ability
• Conditions
• (Ability being cast) Equal to Switch
• Actions
• Set TempPoint1 = (Position of (Casting unit))
• Set TempPoint2 = (Position of (Target unit of ability being cast))
• Unit - Move (Triggering unit) instantly to TempPoint2
• Wait 0.01 seconds
• Unit - Move (Target unit of ability being cast) instantly to TempPoint1
• Custom script: call RemoveLocation(udg_TempPoint1)
• Custom script: call RemoveLocation(udg_TempPoint2)

#### PurplePoot

Level 40
Target Unit of Ability Being Cast doesn't exist after a wait.

#### Kwah

Level 24
Ahhh, thanks.

Still does not work. Just tested.

Map is enclosed.

Last edited:

#### spiwn

Level 12
Hm
Set the target of the ability to a variable so that u can use it after the wait.
And note that the triggering unit will "bump" at the targeted unit.
Preventing this requires you to move one of the units somewhere else, move second unit, move first.
Or turn pathing off for one of the units.
I would suggest not using the wait, there is no point in it. But if you want to have an wait, use a polled wait.

#### Kwah

Level 24
Umm i have set to variable.

Thae wait was to see if I needed to.

Problem solved.

Switched unit order.

#### spiwn

Level 12
Well when you use set a=b you set b to a variable or that is how I say it

#### Kwah

Level 24
Huh?

I don't get what you are saying.

If you set a = b then b = a? Well, duh.

#### PurplePoot

Level 40
He's trying to say that to swap two variables, a and b, you do

var c = a
a = b
b = c

Though how it has relevance here is beyond me.

#### spiwn

Level 12
He's trying to say that to swap two variables, a and b, you do

var c = a
a = b
b = c

Though how it has relevance here is beyond me.

It has none whatsoever.
And no.
I will paraphrase -
set a=b
You store b in a variable. I just said set, which is somewhat different but hey it is not a big deal

#### Kwah

Level 24
Yes. . . That is obvious.

If TempPoint = Postition of Casting Unit.

Then you dtore "b" in a variable.

It makes sense.

But why are you telling me this?

Level 12

#### Kwah

Level 24
Cool.

I guess.

Thanks.

I still don't really get what you are saying, but hey!

#### spiwn

Level 12
Hm
Set the target of the ability to a variable so that u can use it after the wait.

You did not get what I said at the first place, so I explained.

P.s. If you still think you do not get something(which would be untrue) just forget it

#### Kwah

Level 24
If you look at my trigger.

Switch
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Switch
Actions
Set TempPoint1 = (Position of (Casting unit))
Set TempPoint2 = (Position of (Target unit of ability being cast))
Unit - Move (Triggering unit) instantly to TempPoint2
Wait 0.01 seconds
Unit - Move (Target unit of ability being cast) instantly to TempPoint1
Custom script: call RemoveLocation(udg_TempPoint1)
Custom script: call RemoveLocation(udg_TempPoint2)

You'll note that i do set it to a varialbe (TempPoint2).

It has always been this way.

But anyways. It was the order that the units moved in that was the problem. Thanks.

+rep for no rep!

#### spiwn

Level 12
Store the target of the ability in a variable.
You store the location
And I really do not see where this is going. After all you are done with that spell?

Last edited:

#### Kwah

Level 24
Yes. I am. It is a good idea. But no point. Will stop talking.

[OFF TOPIC] [CLOSED]

lol.

Replies
3
Views
502
Replies
37
Views
2K
Replies
10
Views
3K
Replies
8
Views
663
Replies
0
Views
509