I'm trying to create a simple, 10 shot crossbow weapon. One that does not use reloads, only max 10 ammo, and mag ammo of 10, and that shows an "empty" bow, without an arrow resting on it once it is out of ammo.
I have ALMOST achieved this via FSM.
This is the script:
image Crossbow 0 7
sound CrossbowFire
sound CrossbowReload
state IDLE NONE 0
frame 1 .25 0 0 0 NONE
frame 1 .25 0 0 0 READY
state ATTACK IDLE 0
frame 2 .25 0 0 0 NONE
frame 3 .18 0 0 0 SOUNDANDATTACK 0
frame 4 .18 0 0 0 NONE
frame 5 .15 0 0 0 NONE
frame 6 .15 0 0 0 NONE
frame 7 .15 0 0 0 JUMPIFNOAMMO EMPTYBOW
state EMPTYBOW NONE 0
frame 7 .25 0 0 0 READY
Frame 1 is the crossbow at idle, with the arrow resting on the bow. Frame 7 is the empty bow.
I successfully got it to jump to the "empty" bow sprite, once it is out of ammo. However, the problem is, after it does this, it will not let me switch to another weapon. The game WILL let me switch to weapons automatically, once I pick them up, but once my crossbow reaches this frame 7 "no ammo" graphic state, it will not let me switch weapons by any means, either mouse wheel or keyboard keys work to change weapons. What am I doing wrong? This thing almost works, after a few hours of tinkering with FSM.