How to get an actor class from an array of actors?

Hello everyone , just a small problem. I have to get a value from the array to the left (which contains a list of Actor Class) and give it to the function to the right.

How can I do that please?

Don’t you just drag from the get on the left onto the purple class pin on the right?

but first I have to select an item from the array, even randomly but I don’t know how to properly do that, can I ask you how to do it please?

@KhappaMJ

Use Random Integer to get an index.

wonderful :slight_smile: many thanks

Per docs “Returns a uniformly distributed random number between 0 and Max - 1”

Array (0, 1, 2, 3, 4) returns a length of 5
Random Integer (max 5) would choose a random from 0-4

Not sure where the problems is?

Gotcha :wink:

I worked with databases (oracle, mysql etc) and arrays daily for work so it’s kind of a given to me. numrows() / length() in my field are constantly used before update/insert/get similarly to is valid. There should be no assumption that an array or any other variable has a value. Yet if you know by design that there will always be n values in an array, then x approach is fine. Otherwise you code for variance.

Using last index on an empty array. Coder has to learn, failure teaches.

IF(!empty(n)) { do this }else{ can’t I’m empty }

I don’t think there’s a real need for it. Coders need to simply learn and apply proper if conditional logic. Can I … jump, prone, crouch, sprint, shoot, reload, equip, drop, add, interact etcetera and so forth?

The volume of “is valid” based questions we get here and answer hub is astounding. says quite a bit.