Problems with Shoot an Object
I have a few problems with shooting an object. First of all, sometimes when I shoot an object at the same time I am running, the animation will freeze and the unit will be unable to do anything.
Also, how can I set how often I can shoot? I want different guns to shoot at different speeds, so is there any way to do this?
Finally, how can I make the shots more accurate? Sometimes the bullet appears from the gun of my animation, and other times the bullet appears behind him. The bullets don't always reach their target, and sometimes they aren't even close. I want to have more control over where the bullet hits in terms of the target, but I want to give the AI a little bit of randomness in their shot as well. How would I go about doing this?
*edit* I am using MMF2 Build 243
Thanks a lot.
Re: Problems with Shoot an Object
To set how often you can shoot, you'll have to put an extra condition under your firing event - say, some sort of counter or alterable value of your player ("FireTime") <= 0. Then, when firing, set this counter to a value above 0 - and also continually subtract from it while its value is above 0.
The issue with bullets appearing behind you is probably because of a misplaced Action Point in your player animations (or possibly the Hot Spot of your bullet). By default, the "Shoot an Object" action can only fire in one of 32 directions - to get around this you'll have to use Create an Object and handle the movement yourself.
Re: Problems with Shoot an Object
Ok, I understand what you are saying, but how would I go about doing that? I can create a bullet at the location relative to my player that I want the bullet to come from, but how should I define his movements? Also, how do I keep a counter to destroy the bullet after it travels a certain distance, such that it doesn't fly across the map and kill something way out of sight?
Re: Problems with Shoot an Object
If you just want the standard 32 directions, you could just go for a bouncing ball movement for the bullet.
For the bullet range, you can do this:
In the frame editor, define an alterable value for your bullet called "lifeSpan" or something like that. Set it to the number of frames you want that bullet to "live" for. If you havent changed the frame rate, then 50 frames = 1 second.
Then in your event editor, make these events:
Bullet is in play area
-Subtract 1 from lifeSpan("Bullet")
lifeSpan("Bullet") less than or equal to 0
-Destroy bullet
That should work.