Is there a way to shorten the following code:
(Distance Between(Event Player, Global. VariableA)<2 || Distance Between(Event Player, Global. VariableB)<2 || Distance Between(Event Player, Global. VariableC)<2 || Distance Between(Event Player, Global. VariableD)<2 )== True
This is basically saying if your within 2 meters of Global variable A,B,C, or D then… I’ve tried making it so that the <2 is at the end and removed it from the other equations but it doesn’t seem to work. Does anyone know if I could shorten it somehow? Thanks!
Another way to go about it. Still pretty clunky, but possibly a bit cleaner than what you have now, just because you only need one comparison. (But also, a bunch of nested MINs might be confusing when you read it later too, so, pick your poison)
conditions
{
Min(Min(Min(Distance Between(Event Player, Global.A), Distance Between(Event Player, Global.B)), Distance Between(Event Player,
Global.C)), Distance Between(Event Player, Global.D)) < 2;
}
2 Likes
You could use “is true for any” with an array containing A,B,C and D.
5 Likes
Would I do the same thing if I wanted them all to be further than two meters? Would I still use min, but the final would be >2 instead? Thanks!
Put these spots on an array, then do this:
conditions
Count of (Filtered array (Global variable ("a") Compare
distance between (event player)(current array element)<=
number (2))
This will check if the player is in any of the spots on the array.
instead of Count Of(Filtered Array), just use Is True For Any