{{tag>event ranger}}
{{htmlmetatags>metatag-keywords=(pac3, wiki, event, collide)
metatag-description=(Triggers based on distance.)
metatag-og:title=(Ranger | Event)
metatag-og:description=(Triggers based on distance.)
}}
====== Ranger ======
Triggers based on distance. Ranger casts a ray starting at the location of the parent model, in the direction of the red positional arrow. [[#distance|Distance]] is the %%max%% length of the ray. [[#compare|Compare]] is the distance you want to compare to using an [[#operator]]. The event shows a distance preview while editing.
{{:part:event:ranger:ranger.png?direct}}
===== Operator =====
== above ==
Ranger set to above will hide attached parts when the distance to an object is higher than [[#compare]].
== below ==
Ranger set to below will hide attached parts when the distance to an object is lower than [[#compare]].
{{fa>info?color=#3bb0ff&fw&lg}} This behavior can be inverted by using [[:part:event#invert]].
===== Arguments =====
^name^type^description^
|**{{anchor:distance}}[[#distance]]** | number | The %%max%% length of the ray. Needs to be higher than [[#compare]]. The actual value only matters when using [[#npcs_and_players_only]] (BUG?). |
|**{{anchor:npcs_and_players_only}}[[#npcs_and_players_only]]** | boolean | Ignores world collision. Only triggers when a player or an NPC is detected. |
|**{{anchor:compare}}[[#compare]]** | number | The number that you want to compare the distance to. |
===== Usage & Examples =====
==== Basic usage ====
- Add a dummy model to your outfit and attach the ranger event to it.
- Use the dummy to set a direction of the ranger. (Red arrow means //forward//)
- Enable [[:part:event#affect children only]] and attach other parts to the event.
{{:part:event:ranger:event_ranger.png?direct|}}
==== Simple ranger ====
Set [[#distance]] to 200, [[#compare]] to 100, operator to above, the event will trigger when an object appears closer than 100 units away from you.
{{fa>fas fa-arrow-alt-circle-down?color=#7ab353&fw&lg}} **Download:** {{:part:event:ranger:event_ranger.txt}}
===== Similar Events =====
* [[:part:event:collide]]
* [[:part:event:is_touching]]