Hi, I am trying to make a quicktime event thing when I enter a trigger the E key pops up, and you must press the E key 30 times and then a animation will play. How can I accomplish this? I’ve tried, but it didn’t work. The variable Presses dosen’t want to increase.
Here’s my script:
var Ekey : GUITexture;
var Cube : GameObject;
var Presses = 00.0;
var MaxPresses = 30.0;
function OnTriggerEnter () {
Ekey.enabled = true;
if(Input.GetButtonDown("E")){
if(Presses < MaxPresses){
Ekey.animation.Play();
Presses += 1;
if(Presses > MaxPresses){
Ekey.enabled = false;
Cube.animation.Play();
}
}
}
}
function OnTriggerExit () {
if(Presses < 30){
Presses = 0;
Ekey.enabled = false;
}
else
if(Presses == 30){
Presses = 30;
Ekey.enabled = false;
}
}