So, kind of like a lot of things, I may have realized a possible solution as I came here to type something like a lot of other things I have figured out, but I am dumb and curious if there was a simple way to do this within one action.
Bit of a summary idea of what I am doing and want:
Is there a simple way to grab highest / lowest values from a specified filtered array of all players to a specific player variable? (yeah idk how to word this).
There is a player level variable. Let’s say we have 3 players, level 5, level 40, and level 100. I have a bot I want to spawn, also with a level, but only in a random range of the human player with the lowest level and the player with the highest (multiplied a small amount, like 1.15 x more than the player with the highest level, so the bot can spawn up to level 115 if there is a level 100). I am also using min/max to be able to set minimum and maximum possible values this will output so it doesn’t get too high, that part I already understand.
Is there an easy way to be able to grab these values without having to setup another rule that is creating a separate array in a different variable? Like what can I do so I can just use “current array element” within a filtered array? And keep in mind, I need to only grab this value from human players, so we got to exclude bot players (with either “is dummy bot” or a specified bot variable) from a filtered array.
I have made something that does seem to work the way I want, but as soon as another player joins in, it only cares about the newly joined player’s level, no matter what level they are, or what slot they are in, it ignores the player’s level who was in before they joined.
Here it is, I already know it’s wrong though. I may just be over thinking this.
actions
{
Event Player.level = Random Integer(Max(Min(First Of(Sorted Array(Filtered Array(All Players(All Teams),
Current Array Element.bot == False).level * 0.600, Current Array Element.level)), 200), 1), Max(Min(Last Of(Sorted Array(
Filtered Array(All Players(All Teams), Current Array Element.bot == False).level * 1.150, Current Array Element.level)), 500),
35));
}
I am pretty sure it’s because of the way I am calling the filtered array within that level variable. It’s not actually an array? I think. It probably just lists one player but it’s also odd it ignores all but one player completely, but I’m not really sure how else I can grab the levels of players in that piece.
Using these min/max’s in the spots they are, to prevent it from going to 0 if there were no players loaded in yet or have a flat range, and to hard limit it so it doesn’t get too high of a level (for my mode).
This also might not be that great for an idea in the first place. It might be better to go for an average level of human players, which will still have this filtered array stuff involved that I want to figure out. If I need to make another global variable for it that’s fine, but I don’t even know a proper way to set that up either atm, but I do have ideas.
THX