Do you search a event like "Player brings a unit from region A to region B"?
There's none, but you can do it with unit enters/leaves.
Event:
- Unit enters Region A
Condition:
- Region B doesn't contain Position of Triggering Unit
Action:
- Set Variable X = 1
Event:
- Unit enters Region B
Condition:
- Region A doesn't contain Position of Triggering Unit
Action:
- Set Variable X = 2
Event:
- Unit leaves Region A
- Unit leaves Region B
Condition:
- Region A doesn't contain Position of Triggering Unit
- Region B doesn't contain Position of Triggering Unit
Action:
- Set Variable X = 0
Well, what I am trying to create is a "Teleportation Portal".
To activate this portal, you must be on the portal (Region A). If you are on Region A and NOT Region B, Variable X would be set to 1. You must then press "T" when Variable X is equal to 1 to activate the portal. Next, you will be transported to Region B, the other portal. Then what happens is that if you are NOT on Region A but on Region B, Variable X would be set to 2. Again, in order to start up this portal, you will have to press "T".
But if you are on neither portal, Variable X should be set to 0. This is important because if it's not equal to 0, it means that you can teleport to the portal from anywhere else on the map.
Of course the leaves event works. And of course you DO have to leave the region, but it doesn't matter how you do. Just walking away or moving the unit instantly via triggers.. doesn't matter. You leave the region and trigger the event.
Note: If the regions don't overlap each other you can leave the conditions for the trigger away.
But I would like Variable X to be 0 without having to "Leave" the region.
Take the SC1 "Brings" condition for example:
Player 1 Brings 0 any unit to Region A
It does not require you to "leave" the region, it only needs you to not be in the region.
However, when I do the "Leave" event, it requires me to "leave" the region for it to activate.
Yea, but let's say you initially set X to 0 and your hero doesn't start on a teleporter field. That means everything is correct in the very beginning.
X will only change when your hero enters a teleporter field. And if he enters one he MUST also leave it again. I don't think there's a way to get out of a region without triggering this event.
You know when he's leaving the region and when he's entering it - which means you automatically know whether he is in this region and when not.
I know there is no such thing as a "Brings" event, but is there a way to simulate it?
What I am trying to do is this:
If "Unit P" is in "Region A" and not "Region B", then set "Variable X" to 1.
If "Unit P" is in "Region B" and not "Region A", then set "Variable X" to 2.
If "Unit P" is in neither "Region A" or "Region B", then set "Variable X" to 0.
But I realized the "Enters/Leaves" event fails to do what I originally thought it could do.
Explain further.
Member since 2010. Made the -The Thing- [Revival] game. Nostalgic of the WC3 days.
@Vicboy: Go
What certain details are you looking for?
I don't know, how about this. What are you trying to achieve?
Member since 2010. Made the -The Thing- [Revival] game. Nostalgic of the WC3 days.
Do you search a event like "Player brings a unit from region A to region B"?
There's none, but you can do it with unit enters/leaves.
Event:
- Unit enters Region A
Condition:
- Region B doesn't contain Position of Triggering Unit
Action:
- Set Variable X = 1
Event:
- Unit enters Region B
Condition:
- Region A doesn't contain Position of Triggering Unit
Action:
- Set Variable X = 2
Event:
- Unit leaves Region A
- Unit leaves Region B
Condition:
- Region A doesn't contain Position of Triggering Unit
- Region B doesn't contain Position of Triggering Unit
Action:
- Set Variable X = 0
@Vicboy: Go
Well, what I am trying to create is a "Teleportation Portal".
To activate this portal, you must be on the portal (Region A). If you are on Region A and NOT Region B, Variable X would be set to 1. You must then press "T" when Variable X is equal to 1 to activate the portal. Next, you will be transported to Region B, the other portal. Then what happens is that if you are NOT on Region A but on Region B, Variable X would be set to 2. Again, in order to start up this portal, you will have to press "T".
But if you are on neither portal, Variable X should be set to 0. This is important because if it's not equal to 0, it means that you can teleport to the portal from anywhere else on the map.
@s3rius: Go
Does the "Leaves" event work at all? I thought in order for that to work, you must leave the region.
Of course the leaves event works. And of course you DO have to leave the region, but it doesn't matter how you do. Just walking away or moving the unit instantly via triggers.. doesn't matter. You leave the region and trigger the event.
Note: If the regions don't overlap each other you can leave the conditions for the trigger away.
@s3rius: Go
But I would like Variable X to be 0 without having to "Leave" the region.
Take the SC1 "Brings" condition for example:
Player 1 Brings 0 any unit to Region A
It does not require you to "leave" the region, it only needs you to not be in the region. However, when I do the "Leave" event, it requires me to "leave" the region for it to activate.
@Nothing5: Go
Yea, but let's say you initially set X to 0 and your hero doesn't start on a teleporter field. That means everything is correct in the very beginning.
X will only change when your hero enters a teleporter field. And if he enters one he MUST also leave it again. I don't think there's a way to get out of a region without triggering this event.
You know when he's leaving the region and when he's entering it - which means you automatically know whether he is in this region and when not.
@s3rius: Go
My bad, I believe you're right. I'll test it out first. Thanks!
Edit: This works perfectly!