- Home /
This question was
closed Dec 10, 2013 at 10:15 PM by
Graham-Dunnett for the following reason:
Other - should never have survived the moderation process
BCE0023: No appropriate version of 'UnityEngine.Random.Range' for the argument list '(System.Object)' was found.
Hello, i am trying to make playerAttack.js file but it is saying everytime i use "Random.Rang" it comes up with this error:
Assets/Scipts/playerAttack.js(35,45): BCE0023: No appropriate version of 'UnityEngine.Random.Range' for the argument list '(System.Object)' was found.
Can someone please help me!
var enemyHealth : int = 100;
var displayDamage : GUIText;
var enemyHealthText : GUIText;
function Update () {
enemyHealthText.text = "Enemy Hp " + enemyHealth;
if(this.enemyHealth <= 0) {
PlayerHealth.curXp += 0;
Destroy(this.gameObject);
}
}
function OnTriggerStay (col : Collider) {
if(col.gameObject.tag == "attackArea") {
if(Input.GetKeyDown("1")) {
var randomDamage = (UnityEngine.Random.Range(PlayerHealth.minAttack.PlayerHealth.maxAttack)) * PlayerHealth.attackPower;
this.enemyHealth -= randomDamage;
displayDamage.text = "Damage " + randomDamage;
}
}
}
Comment
Follow this Question
Related Questions
Random value for if statement 2 Answers
Keeps returning True 2 Answers
if (var == true) do something... not being detected 2 Answers
variable doesn't change 1 Answer