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"

Is there any way to have pawn sensing exclude specific classes of pawns?

I have an RTS camera character class that the player controls. I also have AI controlled character classes. I am working on the AI behavior, and I set it so that these AI controlled characters will follow each other when they sense each other via pawn sensing. However, they were only sometimes following each other and I realized that this was because most of the time they were focused in on the camera character that the player controls. Is there a way to set pawn sensing to ignore certain classes of characters?

I've tried unchecking only see players, but this doesn't entirely ignore the RTS camera, i.e. when the camera is still in the pawn sensing range it will take precedence over other pawns. I have also tried comparing the pawn sensed with the object equal method, and preventing action if the pawn is the RTS camera but to no avail.

Product Version: UE 4.19
Tags:
more ▼

asked Jun 25 '18 at 08:02 PM in Blueprint Scripting

avatar image

cherking
11 2 3 9

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

2 answers: sort voted first

I think I found a method that works for now (although its viability may change depending on if my functionality changes in the future) but here it is (it's actually quite simple and I feel pretty stupid for not thinking about it):

Basically I just grabbed the pawn return node that the pawn sensing event returns, and get the class. I then compare it to the class that I want it to sense (in this case it is its own class so i just set it to self) and then return the bool and have a branch from there. https://i.imgur.com/O41arEK.png

I think for now this works fine as I can also alter the bool expressions so that it can be exclusive too and not just inclusive.

more ▼

answered Jun 27 '18 at 06:31 PM

avatar image

cherking
11 2 3 9

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

I'm sure there are several different ways to do this but, when I was testing around with trying to make factions and stuff I was just checking targets in range for if they had a tag or not.

You may also just be able to disable collision for your camera with 'visible' so it no longer triggers as something to be sensed. You may need to be careful about how your sound in your game is produced like that though.

Personally I'd just use the tags as you can also use them for other things but it's probably not the most efficient way.

Hopefully someone else can provide a better solution.

more ▼

answered Jun 25 '18 at 09:04 PM

avatar image

Myscelus
26 2 3 7

avatar image cherking Jun 26 '18 at 02:08 AM

Can you elaborate more on 'tagging'? What property do I look for and would this be a property within the sensing pawn or sensed pawns?

edit: I did some searching. Are you referring to gameplay tags? https://docs.unrealengine.com/en-us/Gameplay/Tags

avatar image Myscelus Jun 28 '18 at 11:54 AM

Sorry, yeah gameplay tags. You can set them up in the settings then add them to your actors. Once your actors have them, when 'beginoverlap' happens you can check to see if they're a valid 'actor' with 'hastag' and not have to worry about having the overlap event triggering on things you didn't want them to in the first place. I'll post some spaghetti so you can get a rough idea. It's pretty bad and Can probably be done easier but it was mostly just a test.alt textalt textalt textalt text Heh just noticed there's a duplicate hastag node in spag 3 but oh well. Hopefully this will more or less answer your question satisfactorily.

tags.png (80.2 kB)
spag1.png (230.3 kB)
spag2.png (220.4 kB)
spag3.png (152.8 kB)
(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