Page 1 of 1

unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:09 am
by BugMeNot
Need help guys this is just my concept I had a trigger that if you comes to a unit within 300 range an ability of heal will be added it was successful but I dont know how to make if you leave that unit the ability will be remove what i did was i put another unit in different angle so that if you pass to that unit the ability will be removed... What if the unit teleports??? it will not pass to the triggered unit

--Adrian

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:09 am
by 3ICE
Periodically apply a 0.1 sec buff while in range. As soon as you leave 0.1s later it will fall off because it is no longer re-applied by the periodic trigger.

Or every 0.1s check if distance between position of unit1 and position of unit2 > 300. If yes, remove ability and turn off the constant checking

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:13 am
by BugMeNot
Should I used variables for many players or just triggering unit?
I stole your question to my website, hope you don't mind http://forum.3ice.hu/viewtopic.php?f=14&t=987
I dont mind still I'm willing to learn

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:13 am
by 3ICE
Yeah, neither. Some kind of unit indexing system is recommended for triggered MUI spells. Or at the very least an array of units currently being checked if you prefer to do it by hand.

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:15 am
by BugMeNot
If I used triggering units, what if an enemy approaches that unit he will acquired the healing ability

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:15 am
by 3ICE
Yes, that's exactly why we don't use triggering unit in periodic triggers
As there's only a timer event, not a unit event available. Triggering unit will be garbage value or null

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:17 am
by BugMeNot
How about unit group?

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:18 am
by 3ICE
Won't work, how do you decide which unit from the unit group comes within x of which unit from the other group.

(If there are more than one units that check 300 range, that is.)

If you're checking just 1 healing fountain unit, then a pair of groups will work, yes. Units still in range of team 1's fountain. And Units still near team 2's heal fountain for the other group.

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:29 am
by BugMeNot
Allied System?
Then I can use this concept like Lol when you pass to a grass you will become invisible i'll put a blank model in the middle of the grass and if you approach that unit you will be affected by the invisibility effect

Re: unit stops being within x of unit

Posted: Sat Mar 24, 2018 11:29 am
by 3ICE
Regions are more efficient. There are fast "Unit enters" and "Unit exits" region events