Author Topic: Auto-Firing Cannons  (Read 2666 times)

Offline Raziel

  • Jr. Member
  • **
  • Posts: 859
  • Bullet Magnet
    • View Profile
Auto-Firing Cannons
« on: 03-05-2011, 08:05:20 »
Is it possible to code auto firing cannons? I would like to get the agassiz to fire its cannons at intervals (without having the cannons or ship manned by AI) (My plan is to create an unmanned automated vehicle - similar to the flyover vehicles. This will be used to create a better war atmosphere on sea maps)

Project To do list
  • Ship moving umanned at a predefined speed - done
  • Ship moving on a circular path - done
  • Water spray and trail activated without input - done
  • Auto-firing ship cannons - ?




Offline Devilman

  • I belong to Naughty Club
  • **
  • Posts: 274
    • View Profile
Re: Auto-Firing Cannons
« Reply #1 on: 03-05-2011, 11:05:23 »
Is it possible to code auto firing cannons?

Yes it is possible,via the combination of a timed mesh and particle effect emitter

Just out of curiosity,is your "Ship moving on a circular path' done with a RB ?

Offline Raziel

  • Jr. Member
  • **
  • Posts: 859
  • Bullet Magnet
    • View Profile
Re: Auto-Firing Cannons
« Reply #2 on: 03-05-2011, 12:05:45 »
...combination of a timed mesh and particle effect emitter

Hmmm....Can you direct me towards a tutorial on the topic?

Re Circular motion
I've managed to get the ship (agassiz) to move in a circular path by using two force objects. One forcing the ship to move forward (simulating engine power) of a constant force of 5/6. Then I added another force object pushing the ship at the bow section on the X axis (constant force of 15/16). It looks nice because the ship tilts a bit. Had to play around with the values to get the smooth circular motion.

Never thought of using a RB....Must try this! EDIT: Idea scrapped  :) Cheers Devilman
« Last Edit: 03-05-2011, 13:05:15 by Raziel »

Offline Devilman

  • I belong to Naughty Club
  • **
  • Posts: 274
    • View Profile
Re: Auto-Firing Cannons
« Reply #3 on: 03-05-2011, 13:05:04 »
Never thought of using a RB....Must try this! Cheers Devilman

I mentioned using an RB,as you dont want to use them for something that moves in a large radius from its parent
Because when you attach your ship/object via the RB to the parent,the game takes into account, the total distance from the axis to the bounding box of the ship/object,and can block (turn red) any spawn points within the total area that the radiuses/radii arm sweeps
« Last Edit: 03-05-2011, 13:05:39 by Devilman »

Offline djinn

  • Masterspammer
  • ****
  • Posts: 5.723
    • View Profile
Re: Auto-Firing Cannons
« Reply #4 on: 03-05-2011, 19:05:31 »
Wow. I would so love to see this ship and firing cannon. But can it not use the Bf2 vanilla commander firing mechanism? Or do you want it to fire automatically.

Offline Comrade Roe

  • Jr. Member
  • **
  • Posts: 328
  • Achtung panzer!
    • View Profile
Re: Auto-Firing Cannons
« Reply #5 on: 04-05-2011, 03:05:38 »
Like on Red Orchestra maps where arty shells exploding around you and kill you if you stay still too long or more like an AI that actually specifically targets enemies of it? (Assuming it only targets one team...) And comes from a destroyable source?

Offline Raziel

  • Jr. Member
  • **
  • Posts: 859
  • Bullet Magnet
    • View Profile
Re: Auto-Firing Cannons
« Reply #6 on: 04-05-2011, 12:05:30 »
@Djinn - I want the ship to fire automatically without AI......[imagines]placing the ship on Mount Olympus and having it move along the beach and fire shells. [/imagines]...I haven't been successful yet...am learning the bf2editor in the process and reading lots of tutorials etc.

I will gladly share the edited ship once its ready.

Offline Devilman

  • I belong to Naughty Club
  • **
  • Posts: 274
    • View Profile
Re: Auto-Firing Cannons
« Reply #7 on: 04-05-2011, 12:05:06 »
@ Raziel
Looking at the Mount Olympus map
If you have the ship moving in a repetitive circular motion,it wont be close to shore/easily visible from land, for a long period of its rotation
Why not remove your turning force and have it moving in a straight line parallel to the shore (in sufficient depth water) ,and set you spawn delay to the desired time

Also when you say "auto firing cannons"
Do you only want visible muzzle flashes and audible firing sounds ?
and do you want the guns facing land,if so, it that their default position for the side that will be closest to land

Offline Raziel

  • Jr. Member
  • **
  • Posts: 859
  • Bullet Magnet
    • View Profile
Re: Auto-Firing Cannons
« Reply #8 on: 04-05-2011, 13:05:00 »
@ Raziel
Looking at the Mount Olympus map
If you have the ship moving in a repetitive circular motion,it wont be close to shore/easily visible from land, for a long period of its rotation
Why not remove your turning force and have it moving in a straight line parallel to the shore (in sufficient depth water) ,and set you spawn delay to the desired time

Yep that's how I will be doing it - spawns at axis base and moves along the beach down to the allied airfield.

Quote
Also when you say "auto firing cannons"
Do you only want visible muzzle flashes and audible firing sounds ?
and do you want the guns facing land,if so, it that their default position for the side that will be closest to land

I've already set the guns to face the starboard side. Unfortunately I can't seem to figure how to get the barrel to fire (and getting the muzzle flash + sound) a projectile without PIFire input. Would appreciate your help or any guidelines Devilman.
Thanks

Offline Devilman

  • I belong to Naughty Club
  • **
  • Posts: 274
    • View Profile
Re: Auto-Firing Cannons
« Reply #9 on: 05-05-2011, 06:05:46 »
I can't seem to figure how to get the barrel to fire (and getting the muzzle flash + sound) a projectile without PIFire input.

Normally emitting effects,dont emit the object/projectile
They emit the geometry of the object/projectile
Giving the illusion,that an actual object is being emitted/seen
This generally works with 2 stages of coding paragraphs

1st is em_vexp_Humvee_wheel

Which then calls for p_wreck_humvee_wheel
Which then emits the geometry of the wheel,which is what you see

Quote
ObjectTemplate.activeSafe Particle p_wreck_humvee_wheel
ObjectTemplate.creator DSU-1:dsu
ObjectTemplate.modifiedByUser dsu
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.geometry p_wreck_humvee_wheel
ObjectTemplate.usedOnTransparentSurface 0
ObjectTemplate.collisionMesh p_wreck_humvee_wheel
ObjectTemplate.mapMaterial 0 wreck 60
ObjectTemplate.collisionGroups 60
ObjectTemplate.mass 55
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.physicsType Mesh
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.timeToLive CRD_UNIFORM/3/4/0
ObjectTemplate.sizeModifier 1/1/1
ObjectTemplate.transparencyGraph 0/0/0/1
ObjectTemplate.transparency CRD_NONE/0/0/0


 ;)

http://youtu.be/EacLZYXIo-Y

Offline Raziel

  • Jr. Member
  • **
  • Posts: 859
  • Bullet Magnet
    • View Profile
Re: Auto-Firing Cannons
« Reply #10 on: 05-05-2011, 08:05:01 »
Will look into it.  :) Cheers Devilman.

PS Impressive! you managed to get one of the missiles to fire off after the plane exploded!  :o
http://www.youtube.com/watch?v=EacLZYXIo-Y#t=0m44s
« Last Edit: 05-05-2011, 08:05:18 by Raziel »

Offline Devilman

  • I belong to Naughty Club
  • **
  • Posts: 274
    • View Profile
Re: Auto-Firing Cannons
« Reply #11 on: 05-05-2011, 10:05:09 »
PS Impressive! you managed to get one of the missiles to fire off after the plane exploded!  :o

That is done by making the missile (looking effect) a wreck part of the plane (like the wheel is to the humvee)
adding an armor comp to the missile (looking effect)
making the max hit points,hit points and critical damage the same value
setting the hpLostWhileCriticalDamage, to a value that equates to the number of seconds the missile is emitted after the time the jet is destroyed,(set to the missile effect in the armor comp of the jet),divided from the max hit points of the missile
then adding an engine to the missile (looking effect),and adding the missiles engine effect into the missiles armor comp,which automatically lowers itself,starting the missiles engine


so to speak  ;)

Offline Raziel

  • Jr. Member
  • **
  • Posts: 859
  • Bullet Magnet
    • View Profile
Re: Auto-Firing Cannons
« Reply #12 on: 09-05-2011, 10:05:36 »
Just saw your auto fire tow launcher....nice, but is it firing a projectile?

PS Sent you a pm
« Last Edit: 09-05-2011, 11:05:16 by Raziel »

Offline Devilman

  • I belong to Naughty Club
  • **
  • Posts: 274
    • View Profile
Re: Auto-Firing Cannons
« Reply #13 on: 09-05-2011, 14:05:43 »
Just saw your auto fire tow launcher....nice, but is it firing a projectile?

The Tow Launcher in the video isnt firing a projectile
I have another one which does fire a visible projectile,but it still needs some work

Do you know that the Agassiz AA gun fires a 40 mm diameter projectile (40mmL60-HE-AA-Projectile)
Which does not have a geometry associated with it,so there is no visible projectile
However,if the projectile did have a bundlemesh/geometry
It would be 40 mm in diameter,by probably 80/100 mm long
Its muzzle velocity is 700
Somehow I think it may be difficult to see a 40mm x100mm object,traveling at 2 520 kilometers per hour  ;)
« Last Edit: 09-05-2011, 14:05:18 by Devilman »

Offline Raziel

  • Jr. Member
  • **
  • Posts: 859
  • Bullet Magnet
    • View Profile
Re: Auto-Firing Cannons
« Reply #14 on: 09-05-2011, 16:05:17 »
Lol! Then we would need a time-warp button to see the projectile Matrix style!  ;D

« Last Edit: 09-05-2011, 16:05:18 by Raziel »