Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Easy FPS Editor v1.6

Simple way to create an old-school First Person Shooter! · By JessicoChan

Getting a crossbow to work with FSM

A topic by Scruffy86 created Sep 10, 2023 Views: 156 Replies: 2
Viewing posts 1 to 2

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.

Developer

You're not doing anything wrong.
You just can't change weapons unless you're in IDLE state, so you're out of luck for this one.

That's okay, I'm doing a workaround by having the crossbow be a low firing rate weapon with unlimited ammo, therefore no need to have the "emtpy bow" sprite/state. Thanks anyways!