Array With Multiple Conditions

Hello!

I’ve been messing around with the workshop lately trying to mimic the way Mercy’s old ressurect would work (kind of). But I have one problem, I have no idea how to make an auto-updating (looped) array containing players that are dead AND within a radius of 40 meters. The center being Mercy, I want the array to constantly look for dead players within 40 meters and update itself.

Thanks a lot to whoever could help me with this!

You do not need to update it because each time you use it the data will be auto-updated.

code
actions
{

	Resurrect(All Dead Players(Filtered Array(All Players(Team Of(Event Player)), Compare(Distance Between(Event Player,
		Current Array Element), <=, 40)))));
}

More info about me and my game mods you can find here.

1 Like

In case you will find yourself in another situation, where you want to check for multiple things in a filtered array, in the future, you can do it like this:

filtered array(*array*, and(*condition1*, and(*condition2*, and(*condition3*, ...))))
1 Like

Hello! Thanks for your replies. I’ve ended up trying this code as a condition for a series of custom actions to follow, but it still doesn’t seem to be working.

conditions
{
Number of Dead Players(Filtered Array(All Dead Players(Team Of(Event Player)), Compare(Distance Between(Event Player,
Current Array Element), <=, 5))) > 0;
}

I set the distance to 5 meters for testing purposes, but the rest seems fine to me. Could you help me identify the problem?

Thanks!

Instead of this, use “count of” wich gives you the size of an array:

Count Of(Filtered Array(All Dead Players(Team Of(Event Player)), Compare(Distance Between(Event Player,
Current Array Element), <=, 5))) > 0;
1 Like

Thank you so much! It works perfectly now!

Btw, is there a way to spawn a player at a specific distance in front of a player? For example, I want to teleport someone 1 meter in front of me when a certain button is pressed.

Is it possible to code that?

1 Like
teleport(*player*, world vector of(multiply(forward, *distance*), event player, rotation and translation))
1 Like

Thank you! It works:)

1 Like