Issue with ai senses config

I’m not sure if it is a bug. You are right, one could expect to get the array from GetActorsPerception in the order these are defined in the Config, but obviously it is not the case.
Nevertheless, if you look at my example, just iterate the array and make sure that you check the sense class yourself, instead of using that index.

You could do a Switch On String with the Display Name or another way could be to create an array with the AI Senses you expect: hearing and sight and do a find with a follow on SwitchOnInt - so using this int now instead of the returned index

edit: better graphic

As a workaround this will help you to solve your problem.

1 Like

So, the GetActorsPerception out array (which comes from GetCurrentlyPerceivedActors) does not return the senses, the order has nothing to do with the sense configuration.

The data structure that contains that list is actually a TMap that is indexed by the Actor provided. When you call that, you get a list of stimulus events that have recently perceived that Actor. It has absolutely nothing to do with the order of the Senses array, which isn’t even involved in the thing.

1 Like

hmm that make sense

So and how did you get this array variable with senses or you just promoted it from ,Find’'?

Ok I made something like this and it works. I was going to do something like that from the beginning, but i was bothered by ,swapped indexes’‘, but behind that that was ,Get actors Perception’‘,which worked not as i thought. Now i have question how to get from this ,switch’’ to not make ,sequence’’

I just did a promote to variable from the GetSenseClassForStimulus node, made this an array and filled the desired values.
You could also just use the GetDisplayName from this as in my image and do a Switch On String. But I believe, that the other approach is better than dealing with strings.

This one is ok as well, does basically the same. Just important, that you really check the Sense Class instead of just relying on that index.

Yeah, i thought about that, but writing senses names manually, little bit…you know

Well, I do exactly as you said. Checking by sense class, not index

Ok, now it’s working i guess. At his moment i am using sequences(if i will find something better i will use it ) and of course refused to use indexes(as i understand that problem was the main reason why i mustn’t use indexes there).Ok now what i can say, thank you herb and eblade for help and good luck in your own projects

if you’re still using GetActorsPerception, keep in mind that it will return results for all AIs that perceive, so if you ask to GetActorsPerception on the player, and 3 different AIs have recently seen/heard the player, you’ll get a hit for all of them

2 Likes

I use 3 different ai controllers with 3 different bots(for certain reasons), but still, what i must use, if i will want to duplicate bots with same ai controllers, because if i understand correctly, this problem can arise with bots with same ai controller?