Page MenuHomeFeedback Tracker

[Request] Eventhandler Distance
New, NormalPublic

Description

I'd really appreciate an Eventhandler to detect distance (at least, maybe to a limited distance). This would be very helpful to me, rather than constantly detecting it using conditions in scripts. Thanks

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Feature Request

Event Timeline

dyrmon created this task.May 25 2022, 11:02 PM

There's no such thing. Distance can't be checked by event handlers, because it's not an "event".

This comment was removed by dyrmon.

As? It could detect from a certain distance, so it would be an event.
I have many ways to use it and the current way is terribly limiting. It would help me a lot.

Leopard20 added a comment.EditedMay 26 2022, 3:05 PM

First of all, distance from what to what? You can't make that using event handlers because event handlers only have 1 arg.
Second of all, the only reasonable thing to ask would be an event handler for object position changing, but even that will be too slow because most of the time objects change position every frame. You might as well use a per frame loop.

I'm aware of those limits. I meant from a player or a group of players. Of course, comparing distances with each object is nonsense. Yes, I use a loop, but when you compare distances to 100 or more objects at once, it's really performance-intensive and complex (even if you have them in one array).

You can use inAreaArray which is in-engine distance check and cheap.

Tenshi added a subscriber: Tenshi.May 27 2022, 11:49 AM

I guess if you want to execute something when someone gets close to a object/unit you could use:

setTriggerArea

Create an area the of the size that you need, then when a player walks into the area you can execute code?
I dont do much scripting so there might be limits i'm overlooking

dyrmon added a comment.EditedMay 27 2022, 2:49 PM

Thanks for the advice, but I don't use the trigger, I only do everything via scripts.
To get in context. I use distance control to save resources. From a certain distance (or action) to the player, the unit is only activated (simulated) and visible. In that, Eventhandler would save a lot of work.