So, I'm trying to make an alternate battle script where you must hit the spacebar at the appropriate time to land a hit, hopefully the gif below gives an idea of what I mean.
And here's the code for it, (well, the relevant part of the code anyways)
Code: Select all
while (check tag(6))
do(
alter npc (8,NPCstat:move type,npcmovetype:pace)
if (key is pressed (key:Space))
then (
if (NPC x(8)==mex && check tag(4))
then(
alter npc (8,NPCstat:move type,npcmovetype:standstill)
play sound (26)
show text box (2)
wait for text box
delete item(1,1)
monsterhp:=monsterhp--3
if (monsterhp<=0)
then (
set tag (3,on)
set tag (6,off)
resume player)
)
else (
if (check tag (4))
then (
alter npc (8,NPCstat:move type,npcmovetype:standstill)
play sound (25)
show text box (3)
wait for text box
delete item(1,1)
)
else(
playsound (3)
monsterdeath)
))
wait(1))
replace backdrop sprite (light,1)
set npc position (6,0,68)
set npc position (7,1,68)
set npc position (8,2,68)
play sound (27)
end
Anyways!.. What's going sour here is this; Sometimes the sound won't play when it is supposed to! And it's kind of predictable in how it does this.
If I land a 'hit' three times in a row, the third hit does not play sound. If I land a 'miss' twice in a row, the second miss doesn't provide sound.
Soooo what's the deal? Is the fact that I'm using global variables instead of local variables at all related? Am I nesting too many 'if' statements? Any insight would be much appreciated![/code]