Conversation with Enemy - ARPG Kit
Posted: Sun Feb 05, 2017 5:03 am
Hello,
So basically I am making Interactive RPG, so user a choice in every decisions. So I am making conversation with enemy boss. In fight if enemy health is less than 20, then it triggers a conversation where boss surrenders and player have to choose to kill or not kill him.
I added 2 scripts - "Conversation Trigger" and "Usable" to enemy boss and another script to enable conversation trigger component as I set Trigger to "On Enable".
So conversation starts but player still can attack it due to that enemy dies. So player fails to enter in conversation. I don't know if this is correct approach, please give some suggestions.
Heres the code which enables Conversation Trigger:
So basically I am making Interactive RPG, so user a choice in every decisions. So I am making conversation with enemy boss. In fight if enemy health is less than 20, then it triggers a conversation where boss surrenders and player have to choose to kill or not kill him.
I added 2 scripts - "Conversation Trigger" and "Usable" to enemy boss and another script to enable conversation trigger component as I set Trigger to "On Enable".
So conversation starts but player still can attack it due to that enemy dies. So player fails to enter in conversation. I don't know if this is correct approach, please give some suggestions.
Heres the code which enables Conversation Trigger:
Code: Select all
private int getHealth;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
getHealth = gameObject.GetComponent<StatusC>().maxHealth - gameObject.GetComponent<StatusC>().health;
if (getHealth >= 80) {
gameObject.GetComponent<ConversationTrigger> ().enabled = true;
var anim = GetComponent<Animator>();
if (anim == null) return;
anim.SetBool("run", false);
gameObject.GetComponent<AIsetC> ().enabled = false;
}
}