Forgotten Hope Public Forum

Forgotten Hope 2 => Modding => Topic started by: Raziel on 03-05-2011, 08:05:20

Title: Auto-Firing Cannons
Post by: Raziel 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



Title: Re: Auto-Firing Cannons
Post by: Devilman 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 ?
Title: Re: Auto-Firing Cannons
Post by: Raziel 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
Title: Re: Auto-Firing Cannons
Post by: Devilman 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
Title: Re: Auto-Firing Cannons
Post by: djinn 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.
Title: Re: Auto-Firing Cannons
Post by: Comrade Roe 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?
Title: Re: Auto-Firing Cannons
Post by: Raziel 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.
Title: Re: Auto-Firing Cannons
Post by: Devilman 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
Title: Re: Auto-Firing Cannons
Post by: Raziel 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
Title: Re: Auto-Firing Cannons
Post by: Devilman 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
Title: Re: Auto-Firing Cannons
Post by: Raziel 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
Title: Re: Auto-Firing Cannons
Post by: Devilman 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  ;)
Title: Re: Auto-Firing Cannons
Post by: Raziel 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
Title: Re: Auto-Firing Cannons
Post by: Devilman 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  ;)
Title: Re: Auto-Firing Cannons
Post by: Raziel on 09-05-2011, 16:05:17
Lol! Then we would need a time-warp button to see the projectile Matrix style!  ;D

Title: Re: Auto-Firing Cannons
Post by: Devilman on 10-05-2011, 11:05:24
  • Water spray and trail activated without input - done

Sounds cool,can you post an "ingame" video of that  ;)
Title: Re: Auto-Firing Cannons
Post by: Raziel on 10-05-2011, 15:05:32
^ To my dismay if it works in the editor it doesn't necessarily mean that it works in-game...learning from mistakes  ;)
Title: Re: Auto-Firing Cannons
Post by: Devilman on 12-05-2011, 09:05:12
@ Raziel
I think your ship looks a bit small  ;)

http://youtu.be/kRscaAVBDzs
Title: Re: Auto-Firing Cannons
Post by: Raziel on 12-05-2011, 10:05:11
Haha... ;)
Had some spare time today and got the ship to work!

(http://i905.photobucket.com/albums/ac251/raziel1082/screen000.png)
(http://i905.photobucket.com/albums/ac251/raziel1082/screen001.png)
(http://i905.photobucket.com/albums/ac251/raziel1082/screen002.png)
Title: Re: Auto-Firing Cannons
Post by: Devilman on 12-05-2011, 14:05:31
Try increasing your water effects,emit time,time to live and possibly particle max size
Title: Re: Auto-Firing Cannons
Post by: Raziel on 12-05-2011, 14:05:50
Yeah will do. This was just a test to see whether I can get the effects to work ingame....will start tweaking things as soon as I have some more spare time.
Title: Re: Auto-Firing Cannons
Post by: Raziel on 14-05-2011, 15:05:42
Some more tweaks later and .....http://www.youtube.com/watch?v=cf0vlE9cy7o
Title: Re: Auto-Firing Cannons
Post by: Devilman on 16-05-2011, 09:05:07
@Raziel
you told me that your using the jet ski water effects
FH2 does already have water effects for large ships