• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Waygate portal cooldown

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
How do I make a cooldown for the Waygates to prevent units from spamming it, like:

Unit A is chasing unit B, unit B enters a waygate and teleports to the other side, unit A goes after him, then unit B goes back, unit A goes back too and so on to infinity.

I'm planning to make a cooldown of 5 seconds for each unit, and I still haven't come up with an idea on how to do that, and it's also not very efficient, cause after 5 seconds you can tp again, maybe I'll have to make it longer but I still need your ideas on this.
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
Don't think there is an "easy" fix to this one. You'd have to make your own teleportation trigger and with that you would lose some of the autmatic path-finding that the waygate provides. But if you don't care about that then it should't be too hard. (Meaning, when you right-click the tp is when you order to tp, and not when you click on the mini-map near the area you want to walk to.)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Lets say waygates are A and B, and letter M represents mountains/cliffs.


A........MMMMMMM..............B

Even though path between A and B is blocked, when you move a unit from A to B it detects there is a waygate which leads to point B and goes to that waygate.
 
Level 11
Joined
Jan 23, 2015
Messages
788
That's actually possible, but I need to check every time a unit moves, which will make the game lag hardly.
Well, I guess I'll just have to remove the waygates, they aren't really suitable for my map after all. Anyways, thank you guys! :)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Actually I think there is a way of detecting waygate use by combinating region enter/leave events.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
If you want a 5s cooldown for every single unit, you need some sort of unit indexer. If you don't want to use unit indexers you can add an dummy ability with x number of levels as a count reference.

I myself often add a dummy ability with x number of levels, maybe 5 levels in your example. Set the ability at level 5 when entering the gameway (ability that is hidden, (phoenix fire for example with 1 range, target nothing)) and decrease 1 level pr sec and then remove the unit from the unit group and the ability when its level 1 which acts as a index counter for that unit.

You need 2 Different abilities as each region end will be triggered before actually entering the gateway (but perhaps you can make the region smaller than the range of the gateway and thus avoid this.)
 
Status
Not open for further replies.
Top