How do you fire multiple weapons simultaneously?
by Highlander · in Torque Game Engine · 06/08/2007 (12:21 pm) · 3 replies
I'd like to fire multiple weapons simultaneously. The weapons do not have to have models showing on the character... in fact I would prefer to fire projectiles simultaneously from dummy objects on mount points.
About the author
#2
06/08/2007 (2:04 pm)
Wow, wonderful help Guimo, thank you!
#3
06/08/2007 (7:57 pm)
I've done this in script for dual wielding pistols. I just mount one pistol image to mount0 and a separate pistol image to mount1 (the left and right hands) then use trigger0 (primary fire) to fire with the left mouse button and trigger1 (alt fire) to fire with the right mouse button.
Torque 3D Owner Guimo
Just check the file crossbow.cs and locate:
function CrossbowImage::onFire(%this, %obj, %slot)
If you read the function you can see that firing a weapon is just the action of creating projectiles with a direction. In case of a crossbow you fire only an arrow... but consider a multifire crossbow. You can create an arrow inmediatly and schedule() events to fire new arrows each 500msecs for say... 3 seconds. Or maybe a shotgun style where you fire 5 arrows in an arc.
In fact you dont even require to have a weapon in order to fire proyectiles. Maybe you can do something like:
When key a is pressed, client sends a cmdToServerFireWeapons message
Server receives the message and fire all the weapons.
Hope that helps... Luck!
Guimo