How to enable reload.

Hello, i know how to animate a reload, but how can i make it happen after a go through say… 30 bullets? How would i do that? Using logic bricks or scripting?

Set up your logic bricks like this:

Keyboard (Space) -> AND -> (Actuators for firing) & Property: Fired +1

Property: Fired = 30 -> AND -> (Actuators for Reload animation)

If this isn’t clear I’ll make it in blender really quickly and post a screenshot.

You’d be able to use logic bricks. Add a property to your gun. Make it an integer and set it to 30 (or however many bullets). Then you make a property actuator and cause that to reduce your bullets property by 1.

Then add a property sensor checking if your bullet property=0, and cause it to reload your gun.

While your guns reloading you may want to make it switch states so that they can’t shoot during that time.

edit: So close, Tommadness :wink:

Could you please be a little more descriptive? I can’t really tell what your problem is.

He wants to know how to make the game reload a gun after the player runs out of bullets

ok i tied eterniams and it didn’t work i think i did something wrong.
tommadness, i almost figured it out using yours. could you post a screenshot?

This should help you.


ok, i did it but nohting happened after 30 bullets.
Thanks, ill keep trying.

Heres the .blend what am i doing wrong? (sorry i think i forgot to pack the textures)


UZI.blend (334 KB)