0
Answered

Action for Characters to respond to all characters with a certain tag?

brolol.404 3 months ago in Behavior updated by Marti (Lead Developer) 2 months ago 3

I am considering buying the behavior, melee, shooter and stats modules but I am looking for a specific capability before making the purchases. I am looking to have multiple NPCs face off against each other in team combat, so I need a way for each character to get alerted, move to and attack any character that enters their “can see” radius with a certain tag. Is this possible? Are there “can see tag”, “attack tag”, “shoot at tag” etc actions specific to GameObject tags instead of just having Character actions only target the player or other specific Game Objects? For example, the tags would be “TeamA” and “TeamB”. If not, how would I accomplish multiple NPCs to team up and fight each other with these modules?

Unity version:
2019.4.1f1
Game Creator version:
1.1.9
Answered

This should be feasible. But instead of using Tags, I'd recommend using Layers. The Behavior module provides a mechanism to detect when characters enter inside the visual range of another. Putting one team in layer TeamA and the other team in TeamB will allow you to make only teamA members detect teamB members. This can be achieved using the Layer Mask option inside the Can See node condition.

To make a character face another one, simply use the Change Direction action and set the target character as the direction target. The character will now strafe move around that target. See our Shooter demo for a somewhat similar example: https://demos.gamecreator.io/demo/shooter

thanks. does the behavior module have a basic melee attack and basic ranged attack action or do I need the melee and shooter modules for those? If not, would it be easy to add my own attack script into the behavior trees of the behavior module?

Melee attacks come with the Melee module, and shooting mechanics come with the Shooter module. You can still create some simple combat using Gestures, but you'll need to figure out how to create combos and script them.

Adding your own code should be fairly easy. Check out the documentation on creating custom Actions: https://docs.gamecreator.io/game-creator/systems/game-creator-api/custom-actions