x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Determine if player or ai possessed pawn

I have a character that can work both as an aircraft and a player character. Fully functional behaivor tree. Would there be a way for me to check if the character is possessed by an aircraft controller or a player controller? Because I want it to only run the behaivor tree if its not possessed by a player.

More technical details. I needed to make a pawn for all controllers to be able to use. But I'm making something kind of like an "rts" type game. Each player has a normal pawn for camera movement but a separate pawn spawns and is assigned to them. (I did this because I couldn't run an EQS query while a player possessed the pawn. I want to make it so if the unit is not assigned to a player's pawn then it will run that behaivor tree. Otherwise not.

Product Version: UE 4.21
Tags:
more ▼

asked Apr 03 '19 at 03:41 PM in Blueprint Scripting

avatar image

TuXsOrDs
116 9 10 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Oh, actually it turns out there's an even easier way to do this. The Character has a method for it:

IsPlayerControlled();

more ▼

answered Jun 11 '19 at 03:56 AM

avatar image

CarisGypsy
36 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Don't know if you're still looking for an answer, but came across your question when I was looking for similar. Here is how to determine if character is player or ai controlled:

 void AThirdPersonCharacter::BeginPlay()
 {
     // Call the base class  
     Super::BeginPlay();
 
     // determine if this is player or ai controlled
     if (Cast<APlayerController>(GetController())) {
         IsAIControlled = false;
     } else {
         IsAIControlled = true;
     }
 }
more ▼

answered Jun 11 '19 at 03:56 AM

avatar image

CarisGypsy
36 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question