*HELP* BGE Delay between shots (*BLEND FILE*)

My system is setup like this.
Middle mouse : Assigns weapon (JUST FOR DEMO PURPOSE)
Left click : weapon Aims
Right click: weapon fires (1shot) w.brass

I got it working just fine, so when you click the right mouse it fires
and it`s timed well with animation. However, if you spam on the
right mouse LOL, it will fire mor bullets.
I have tried states, for me it did not work and i also tried a prop, with
no avail either.

Need help.blend

Please take a look, help is always thanked :slight_smile:

Anybody ? hope this does not get lost in the constant stream of questions :slight_smile:

Moved to Game Engine Support.
You may get more response there

I would try states again, with a delay sensor on the fire state that waits until the shot is considered finished, then switches back to the original state. There should be no reason that won’t work…

You see, the first states have both the aim and fire. If i put the fire
state on the second state it messes up my cam. Have a go and see
what you can do with the file :slight_smile:

You have to track when you fired your weapon and how often the weapon is allowed to fire. Then your logic for if the gun should shoot is “was the mouse clicked and has it been long enough that I can fire again?”

There are lots and lots of ways to do this depending on if you are doing just logic bricks or if you can script in python. I’d do it with python and when you fire the mouse just log the time to a property on your object. Then you only allow a fire if the mouse button is clicked and “current time - last time” is larger than your max rate.

That is a good point, the only downfall is; i don`t want to dwell into making scripts and
the aim and fire are connected to the same “AND” actuators. The reason that is because
i want to hold down the left click so the weapon is drawn, then right click too shoot.
If you get me :slight_smile: so when i add a delay, it messes up the left click to aim :frowning:

If you do not want to reload you can even make the weapon delay:

after shooting (btw. the weapon shoots)
you set a timer property to e.g -1.5
the weapon shoot if the timer property is above zero only. As long as the timer is below zero any shooting request will be ignored.

As said this is a weapon thing less a player thing.
The timer runs regardless what the player does.

Where would i set the timer, how would i set it up. Maybe when you got some free time
monster you could look at the blend. Cheers


Timer = property of type timer

It constantly counts
You can set it to any value you like at any time. It will count from there.
No Python needed to use it.

Beside that do what I mentioned in my last post.

You will need a property sensor in interval mode to measure if the timer timed out or not.
You will need a property actuator to set the timer property.

I hope this are enough hints :wink: