|
Post by newave on Dec 2, 2016 15:24:23 GMT
Hi I am new to InVector. I want to add a score in the HUD component Called "Score Text". Where can I find the code for AI damage from the main character so that I can place an AddScore and ScoreValue reference? I am sure this is simple... lol
Thanx!!!!
|
|
|
Post by Invector on Dec 2, 2016 15:40:01 GMT
Hey newave welcome to the vForum Your characters have the method TakeDamage where he will receive damage, and the CheckHealth where you can check if the character is dead or alive, there you can call your method to add score
|
|
|
Post by Chronicman on Dec 2, 2016 17:44:44 GMT
Welcome newave, if you just wanted to just add score when a AI is killed, you can also use the vOnDeadTrigger event to fire your methods as well.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 2, 2016 20:46:29 GMT
Welcome newave, Hope you enjoy the Vforum, the addons and other stuff is amazing
|
|
|
Post by newave on Mar 21, 2017 19:28:57 GMT
Ok so I added the score stats and that works fine. But now I am stuck again! Here is my error message: Assets/Invector-3rdPersonController/Scripts/CharacterAI/v_AIMotor.cs(508,49): error CS1503: Argument `#1' cannot convert `double' expression to type `int'
|
|
|
Post by newave on Mar 21, 2017 20:23:59 GMT
In my motor file I put this:
#region stat info [Header("Stats")] public int scoreValue = 10; public int statValue = 0; public int winValue = 0; public int enemyLossValue = 0; public vHUDController vhudcontroller; public Stats statscontroller; #endregion
and I called it here:
#region AI Health
public void CheckHealth() { // If the player has lost all it's health and the death flag hasn't been set yet... if (currentHealth <= 0 && !isDead) { //if (vSpawnEnemies.instance != null) vSpawnEnemies.instance.CheckEnemyAlive(this); isDead = true; vhudcontroller.AddScore (scoreValue + 100); statscontroller.AddStats (statValue + .05); statscontroller.AddWin (winValue + 1); statscontroller.AddEnemyLoss (enemyLossValue + 1);
|
|