Author Topic: [NPCs] NPC "Pack" Behaviors: Solved  (Read 154 times)

0 Members and 1 Guest are viewing this topic.

KryptoniteKS

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
    • Awards
  • Steam: RelinquishedFire
[NPCs] NPC "Pack" Behaviors: Solved
« on: December 29, 2017, 12:32:57 PM »
Has anyone found a way to make a group of NPCs attack the player if only one is targeted? I'm trying to make a mob of hobos attack the player when one of them is attacked. The behavior tree is very limited right now and I can't find a way to make this happen.
Thanks in advance.

Edit: After watching a video of Craig's, I have found the solution and I will post for anyone else who is wondering the same thing.
When creating the behavior, you will see a "Message" behavior. My initial thought was that this is just a notification, but that is not the case. After a conditional statement, you can choose to have a "Message" sent or received. If the message is sent as well as received, the receiver will carry through the behavior that the sender of the message also carries out.
In other words, I have setup a behavior where, when a hobo is targeted, he "Sends" a message 20 blocks out to other hobos. Since my conditional statement is "IsTargeted," the receiver of the message will act as if he has received the same conditional statement (he is now targeted by the attacker). I have my other two hobos wandering, yet receiving any incoming messages from other hobos that have the type "IsTargeted." Now when I attack any of the three hobos (they are all the same NPC with the same behavior tree), the other two will come to the rescue and all three attack the player.
When creating the behavior, make sure your "CompareTarget" is set to target. If it is set to "Self," then the NPC will attack the prey (the other hobo in this case). If it is set to "Target," the NPC will attack the predator (in this case, the player).
If I can figure out how to do it, I will screenshot and crop my behavior tree if someone tells me how to do so. Otherwise, it is a very simple behavior tree with only 8 nodes.
« Last Edit: December 29, 2017, 01:47:21 PM by KryptoniteKS »

Phantom

  • Member
  • ***
  • Posts: 143
  • Im the dark side of the forums.
    • View Profile
    • www.1worldglobes.com
    • Awards
  • Xbox: goofy grunt
Re: NPC "Pack" Behaviors: Solved
« Reply #1 on: January 01, 2018, 01:55:11 PM »
What are you making a group of hobos for?
Your talking to a artist

TheDestinedCrab

  • Legendary Member
  • *****
  • Posts: 1362
  • Did you see that? Me neither.
  • Awards 3 years on site+600 posts Donated a giveaway prize. (Must be a prize of cash value.) 2 years on site+300 posts 1 year on site+100 posts
    • View Profile
    • Awards
Re: NPC "Pack" Behaviors: Solved
« Reply #2 on: January 01, 2018, 02:11:38 PM »
I do not believe that is possible. It might be worth looking into C# modding or asking somebody else to do that for you. Alternatively you could request ut be an addition in game by posting in the Ideas section.
GL
Crab.
Thanks Gold Knight for the amazing sig!

KryptoniteKS

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
    • Awards
  • Steam: RelinquishedFire
Re: NPC "Pack" Behaviors: Solved
« Reply #3 on: January 01, 2018, 06:10:24 PM »
I do not believe that is possible.
I already edited the post and said how to do it. It is possible and I have it implemented in my map now. When I attack one hobo, the others attack with him.