|
Post by wolfi3300 on Jan 24, 2019 22:19:06 GMT
In the simple Melee AI, there is an option for "Agressive at first sight". I did not find that option in the new AI Controller. It looks like as if Enemies always attack as soon they see the player.
How can I tell the Enemie only to attack if he is attacked by the Player first?
|
|
|
Post by komposite on Jan 24, 2019 23:04:17 GMT
Hey wolfi
That all the FSM is about, you can create your own option for the AI to attack.
Check their online tutorials on youtube in order to do so, such as this one : 😉
|
|
|
Post by wolfi3300 on Jan 25, 2019 6:45:36 GMT
I tried with the FSM but it doesn't work. I added "Check Damage" decission to chase and combat. But it doesn't seem to work that way?
|
|
|
Post by tchrisbaker on Jan 26, 2019 18:36:05 GMT
The Find Target action is the one that is setting the target on sight I think.So if you make sure the FSM is not doing that one then it won't attack on sight.
Then what I did is make a new script like this
using UnityEngine;
using Invector;
public class OnReceiveDamage : MonoBehaviour {
private Invector.vCharacterController.AI.vControlAICombat aiCombat;
// Use this for initialization
void Awake () {
aiCombat = gameObject.GetComponent<Invector.vCharacterController.AI.vControlAICombat>();
}
public void doOnReceiveDamage(vDamage damage) {
aiCombat.SetCurrentTarget(damage.sender);
}
}
Attach that to your AI as a monobehavior script. Then on your AI you can go to the Melee Controller and go to events and this method doOnReceiveDamage under the OnReceiveDamage event. Now when the AI receives damage it will set the target to whoever did the damage.
|
|