Machine gun attacks?

Chris Monvel

Active member
Hi! I wanted to know if there is a way to make a proper machine gun attack animation, I mean, the character attacking an enemy with a chained attack like firing at it with the weapon. I'm not talking about making weapon items, I mean something more like the character equips his own machine gun as part of his moveset.  I've seen it only in the G I Joe Cobra Island game where Snake Eyes uses the Special animation as a weapon to continuously fire it.

I know how to make pistol attacks using the knife type for bullets and I tried the same making a machine gun attack until I found out that the throwframe for bullets only works once per animation. Is there a way to fire more bullets or something like that?
 
You need to use script instead of throwframe to use shoot bullets. That's how Snake Eyes shoots

Here's an example how to shoot knife with script:
Code:
        @cmd	projectile 1 "knife" 55 1 85 1 0
	frame	data/chars/hero/shoot.png 
       @cmd	projectile 1 "knife" 55 1 85 1 0
	frame	data/chars/hero/shoot.png 
        @cmd	projectile 1 "knife" 55 1 85 1 0
	frame	data/chars/hero/shoot.png

In this example, hero throws knife 3 times in single animation
You can copy that line into your shooting animation.
 
Bloodbane said:
You need to use script instead of throwframe to use shoot bullets. That's how Snake Eyes shoots

Here's an example how to shoot knife with script:
Code:
        @cmd	projectile 1 "knife" 55 1 85 1 0
	frame	data/chars/hero/shoot.png 
       @cmd	projectile 1 "knife" 55 1 85 1 0
	frame	data/chars/hero/shoot.png 
        @cmd	projectile 1 "knife" 55 1 85 1 0
	frame	data/chars/hero/shoot.png

In this example, hero throws knife 3 times in single animation
You can copy that line into your shooting animation.

It's not working. If i add the throwframe it only fires one bullet as previously and if i remove it it won't fire anything.  ??? Am i missing something? The knife has been obviously declared in the header. It seems like the Openbor simply ignores the script because it didn't make any difference.
 
Bloodbane said:
Don't declare knife in header but instead set load knife in header

It worked!  :D Everything seems to be perfect now, thank you so much for the help!

Just one last question to make sure

Is this script @cmd projectile 1 "knife" 55 1 85 1 0 some kind of replacement to throwframe? Like an enhanced version of it? Because when i added it to the animations it ignored the throwframe in the pistol attack making the hero able to fire his machine gun but not his pistol so i just had to replace it with the @cmd in the latter. I was afraid that if could affect the pistol animation but i just repeated the process and it worked well too.
 
As I've posted above, projectile is a script function. @cmd is how to call the function. It doesn't affect throwframe nor replace it so you can declare them both. There's certain usage for this though
Unlike throwframe, you can declare this function multiple times to create machine gun shots or shotgun shot

Now that you got this function working, allow me to post the function's parameters:
Code:
projectile(char *name, float x, float z, float a, int direction, int type, int ptype, int map); 
~name is projectile's name. Make sure it's loaded before.
~x, z and a are starting coordinate for the projectile, relative to thrower's offset
~direction is facing direction of the projectile.
~type is only used if no name is provided and NULL is used instead. 0 for knife or 1 for shot.
~ptype specifies what kind of projectile is fired. 0 for knife or 1 for bomb.
~map specifies if fired projectile copies thrower's remap or not. 0 means it use it's own map while 1 means it use thrower's remap.
~The function itself returns the projectile entity which can be used for many things such as altering speed.

If that's too much, just focus on the first 4 parameters :)
 
Back
Top Bottom