Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Dr Lecter on Mon 08/08/2005 21:37:18

Title: A time old question... but bear with me
Post by: Dr Lecter on Mon 08/08/2005 21:37:18
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.
Title: Re: A time old question... but bear with me
Post by: Ishmael on Mon 08/08/2005 23:35:44
Can't you just make the reload animation blocking? Or would that interfere with something?
Title: Re: A time old question... but bear with me
Post by: Dr Lecter on Tue 09/08/2005 13:21:32
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.