How AI can get actor's variables (i.e. health)?
Sorry, if I haven't found the existing answer, but I was trying hard to. I'm very beginner in UE4 and programming also.
I'm trying to make a AI's world, where they interact only with each other (not with player). So I want to spawn the same AI actors and let them Pawn Sense each other. I've found how to get "Pawn" out of "On See Pawn". But how to make AI_001 get AI_002's variables, such as health, mana, age, whatever? And how to make sure that i'm getting AI_001's variable, not AI_001?
I guess I need to assosiate "On See Pawn" with variable, i.e. "Health", and use only variable that is assosiated with particular Pawn's actor.
Thanks in advance!
Hi! I can really recomend you a free plugin from the marketplace, it is called Faction Extension plugin. Its a great and easy to use plugin for setting up factions. You can use it to tell your Ai who is friend or foe.
To get the attributes of the other pawn in your sceen, you just have to get the sensed pawn, use the 'cast to' node to cast to your ai pawn. From the return value of your cast, you can get the health of your sensed pawn
I hope it was helpfull, if you need further help, or images of the setup, just let me know
answered Oct 06 '18 at 08:33 AM
Well, in this case with casting you are checking, if the pawn you see is the bot_1 if it is, its going to fire from the top pin, and return the health value. If its not the bot_1, its going to fire from the cast failed
answered Oct 06 '18 at 11:50 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here