I'm having a problem making a reloading script for my game, its pretty much an exact copy of that by Ponch, apart from using non-redundant code but I don't know why the timer won't expire. Yes, yes I know this has been asked before but nothing seems to make it work ??? heres the code:
function repeatedly_execute() {
// put anything you want to happen every game cycle here
if (IsTimerExpired(1) == 1) {
mouse.Visible = true;
}
}
function hotspot2_a() {
// script for Hotspot 2 (Hotspot 2): Shoot hotspot
// Reload
if (GetGlobalInt(1)>=1) { // If the player has a clip left
SetGlobalInt(1, GetGlobalInt(1)-1);//lose one clip
SetTimer(1, 90); // Set Reload Timer
//AnimateObject - Reloading Graphic
mouse.Visible = false; // so the player can't shoot while reloading
}
else { // the player is out of ammo
Display ("I'm out of Clips!");
}
}
Once you shoot the hotspot, the mouse is disabled, but the timer won't expire and hence the mouse doesn't get re-enabled.
Can't you just make the reload animation blocking? Or would that interfere with something?
It wouldnt interfere with anything... but I have no animation... but I guess i know what I could use instead... don't worry, not only have I worked out to to do it, I've also worked out how to make timers work.