|
Post by nightbreeze on Oct 30, 2016 14:38:03 GMT
Ive got the AI following my character pretty well but once i stop the AI character strafes around my character. I couldn't find the code to modify so the AI companion would stop and go through a set of selected Idles. I wanted to create an NPC that would follow the player relaxed and only turn aggressive when an enemy is detected.
|
|
|
Post by Invector on Oct 31, 2016 11:38:17 GMT
Just make sure that your Companion Sensor has the Tag to Detect set to Enemy and not Player
On the AI Controller Inspector, we have a list that you can add Tags to make your Target (who you will follow to attack) And in the MeleeManager we have a list of tags of Who you can hit
|
|
|
Post by nightbreeze on Oct 31, 2016 15:08:55 GMT
Thanks for your quick reply, on the AICompanion script, I noticed that there are keyboard commands for the alpha keys 1 -4 which cycles the AICompanion into different modes. Using the keys I've been able to set it to go to an object, however, I can't seem to get the companion to go through the Patrol nodes. I know the Companion State needs to be set to "none" which triggers the error: AICompanion Cant find the (blank), the default variable Player is not set. This will also throw an exception with the error AICompanion Tag: is not defined. However, these are the prerequisites for the companion to be set as "Patrolling".
So can I simply add another keycode alpha 5 and set companion to companionState = CompanionState.none so the companion goes through the Patrol mode?
Sorry just seems there was a lot of special features in the companion script that could lead to very interesting ideas like coop or a party system eventually. Just needed a bone to find the right way to do it.
|
|
|
Post by Invector on Oct 31, 2016 15:32:30 GMT
Hmmm good observation, actually we didn't code the companion to go though patrol nodes, those are used for enemies that are already patroling. I can take a look into this, it shoudn't be hard to implement this feature
|
|
|
Post by nightbreeze on Nov 1, 2016 1:10:27 GMT
Thanks so much, hope this makes it to the new version :-)
|
|
|
Post by nightbreeze on Nov 11, 2016 10:24:28 GMT
V2.0 update: Just in case someone wants to set the companion to now patrol a path, simply create a path and assign this to your companion AI script and set the Companion state to none. Just make sure you bake a navmesh on the terrain and your companion will go her merry way and even fight any enemy encountered. Oh and make sure you're quite a distance from the companion or she will start strafing around you. I've disabled the Who's you target "Player" tag and simply renamed it to "Player2" to avoid this. Hope this helps someone else.
Thanks Invector for this very welcome update.
|
|
|
Post by hamzah on Nov 19, 2016 6:34:25 GMT
My CompanionAI is not receiving any damage from EnemyAI, but he's beating the shit out of enemy easily :P what could be possibly went wrong. i have added the tags in the meleemanager nd tags to detect to CompanionAI. The Enemy is attacking the companion but not causing any dmage to him. Enemy is causing damage to only me. Plz help anyone.
Thanks
|
|
|
Post by dreadlord on Nov 19, 2016 7:52:52 GMT
Hmmm the Companion indeed does not take any damage from the player, that's odd... I will take a look into it edit * Jorge figure out why the player were not hitting the companionAI, just setup your Physics like this: This solves your enemy vs companion problem as well
|
|
|
Post by hamzah on Nov 19, 2016 12:55:40 GMT
it's working like a charm... <3
Thanks dreadlord
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 4, 2016 12:38:36 GMT
Awesome! Thx also dreadlord, I did not know companion and enemy AI follow that grid to determine what's attacks/tags do.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 4, 2016 12:38:49 GMT
didnt mean to say that again twice.
|
|