print("this will show up in your console at the point in time, this line of code is called");
print("thisValue " + thisValue); /// this line will print a var, thisValue and its value.
the code checking range attack should be also in a fct or i don’t think is going to work in that form otherwise, then as you will certainly have to check that condition often, i don’t think using invoke is going to be helpfull way to go about it or not the way you use it right now.
Well, perhaps one of your conditions is not being met. So, before you ask “if()” print the values there. The values being what goes into if(). Perhaps the function is not being called at all? Print a print there “function x ()”. Place them strategically, carrying values that let you see into how the script is running.
Hey guys I got this working using it with a trigger instead:
function OnTriggerEnter (other : Collider)
{
if (other.gameObject.tag == "Player")
{
InvokeRepeating("Attack1Dmg", .1, 1.0);
}
}
function OnTriggerExit (other : Collider)
{
CancelInvoke();
}
// Attack1 Damage
function Attack1Dmg ()
{
var playerScript = GameObject.Find("Player_Conan");
playerScript.GetComponent(Player).conanHealth -= 1;
}
I am very sure that there are better ways to deal damage however lol. This seems to be working for what I have in the mix right now because the enemy character auto-attacks. So if you play around with the time of the invoke, maybe get the exact time of the animation, it will look pretty decent.