Zorkaz Posted May 16, 2021 Share Posted May 16, 2021 Is there an Event for when something is a certain distance from the player away? I want to fire a script once an NPC comes near but I only find GetDistance() Link to comment Share on other sites More sharing options...
dylbill Posted May 16, 2021 Share Posted May 16, 2021 I don't think there's an event, but you can make your own. Make a spell ability and put it on the NPC. Have the condition GetDistance() > SomeNumber on the spell. Then use the OnEffectStart event on the spells magic effect. The magic effect will become active when the NPC is far enough away from the player. Link to comment Share on other sites More sharing options...
Zorkaz Posted May 16, 2021 Author Share Posted May 16, 2021 Good idea. Thanks Link to comment Share on other sites More sharing options...
dylbill Posted May 16, 2021 Share Posted May 16, 2021 No problem :) Link to comment Share on other sites More sharing options...
DieFeM Posted May 16, 2021 Share Posted May 16, 2021 Register the event (note that it registers for a single event, if you want to check for every time you need to re-register)RegisterForDistanceLessThanEventThen catch the event (and re-register if needed)OnDistanceLessThan You may want to combine those withRegisterForDistanceGreaterThanEventand OnDistanceGreaterThan The way I see it, you need to register for distance less than and distance greater than, and in OnDistanceGraterThan call RegisterForDistanceLessThan and vice versa (remember those register functions only register for one event so you need to re-register again once the event is triggered), so you you can use OnDistanceGreaterThan and OnDistanceLessThan like OnTriggerLeave and OnTriggerEnter. Link to comment Share on other sites More sharing options...
Zorkaz Posted May 21, 2021 Author Share Posted May 21, 2021 The first version sounded good but yielded no results (Could be that I set it up wrong though) The second one does succed Link to comment Share on other sites More sharing options...
Recommended Posts