Page 1 of 1

Posted: Fri Nov 29, 2013 8:14 pm
by mvanbrus
Looking for "how to" info on adding a gun/missile to own ship? Need a simple attack tutorial mission with AI action behaviors.

Martin

Posted: Sat Nov 30, 2013 7:16 am
by minime
Well. There is no simple way, because they forgot to write the documentation for some of it and forgot to add samples.



First of you need to create a weapon enabled aircraft, because Prepar3d Professional Plus does not come with one.



For example, take the F-16, because it has a working weapons loadout. To make the F-16 flyable, copy over a Panel folder from another aircraft.

If you open the Attachments.xml you can add AMRAAM to the other pylons (although the weapons are in the wrong place because Lockheed Martin screwed up the offsets for the pylons).



Then go into the sim and load the F-16, and you will have weapons. You can then shoot the weapons after binding keys, but they will not hit anything. For that you will have to add the WeaponsGauge to the F-16 Panel.cfg file so that you can see and edit the settings for weapons and add targets. In the SDK documentation is explained how to do that.



After you have done this, you should be able to use these weapons in SimDirector (but I dont have any clue about SimDirector cause I am only doing FreeFlight missions).



Good luck on your journey through the rabbit hole.

Posted: Sat Nov 30, 2013 12:24 pm
by Evans
Ya minime, I really do hope they come out with the docs soon. Sucks without them.

Posted: Sat Nov 30, 2013 7:28 pm
by minime
Ok, here something for you:





GunSystems.xml:





<SimBase.Document Type="AceXML" version="1,0">



<GunSystem.GunDefinitions>

<GunDefinition ObjectTitle="M-61_Vulcan" Type="Gatling" Ammunition="20 x 102 mm HEI (ballistic table)" Stationary="FALSE">

<GunFeatures Caliber="0.787402" RateOfFire="6000" MuzzleVelocity="3450" />

<GunMovement PitchMax="15.0" PitchAccelerationTime="2.0" PitchTurnRate="6.0" HeadingMax="15.0" HeadingAccelerationTime="2.0" HeadingTurnRate="6.0" />

<GunEffect EffectName="fx_MuzzleFlash_M60" GunEffectType="FIRE" />

</GunDefinition>

</GunSystem.GunDefinitions>



<GunSystem.RoundDefinitions>

<RoundDefinition ObjectTitle="20 x 102 mm HEI (ballistic table)" Weight="0.220462" Caliber="0.787402" DragCf="0.1" TracerRatio="4" DamagePoints="1" Lifetime="3">

<RoundEffect EffectName="fx_tracer_m" RoundEffectType="TRACER" />

<RoundEffect EffectName="fx_dirtspray_s" RoundEffectType="IMPACT_LAND" />

<RoundEffect EffectName="fx_wtrspray_s" RoundEffectType="IMPACT_WATER" />

<RoundEffect EffectName="fx_dirtspray_s" RoundEffectType="IMPACT_BUILDING" />

<RoundEffect EffectName="fx_dirtspray_s" RoundEffectType="IMPACT_VEHICLE" />

<RoundEffect EffectName="fx_dirtspray_s" RoundEffectType="IMPACT_VEGETATION" />

<BallisticTable>

<Row Range="0" Velocity="3450" Trajectory=" 0.0" />

<Row Range="500" Velocity="3000" Trajectory=" -10.0" />

<Row Range="1000" Velocity="2500" Trajectory=" -25.0" />

<Row Range="1500" Velocity="2000" Trajectory=" -50.0" />

<Row Range="2500" Velocity="1000" Trajectory="-120.0" />

</BallisticTable>

</RoundDefinition>

</GunSystem.RoundDefinitions>



</SimBase.Document>





Attachments.xml:



<?xml version="1.0" encoding="UTF-8"?>



<SimBase.Document Type="AceXML" version="1,0">



<Attachments.Stations>

<Station PositionOffset="-4.125, -14.4, 0" OrientationOffset="0.0, 0.0, 0.0" /> <!--00-->

<Station PositionOffset="-4.125, 14.4, 0" OrientationOffset="0.0, 0.0, 0.0" /> <!--01-->

<Station PositionOffset="-4.125, -17.4, 0.4" OrientationOffset="0.0, 0.0, 0.0" /> <!--02-->

<Station PositionOffset="-4.125, 17.4, 0.4" OrientationOffset="0.0, 0.0, 0.0" /> <!--03-->

<Station PositionOffset="-0.5, -7.032, 0" OrientationOffset="0.0, 0.0, 0.0" /> <!--04-->

<Station PositionOffset="-0.5, 7.032, 0" OrientationOffset="0.0, 0.0, 0.0" /> <!--05-->

<Station PositionOffset="+12.5, -2, 1" OrientationOffset="0.0, 0.0, 0.0" /> <!--06-->

<Station PositionOffset="-0.288, 0.0, -1.5" OrientationOffset="0.0, 0.0, 0.0" /> <!--07-->

</Attachments.Stations>



<Attachments.Loadouts>

<Attachments.Loadout LoadoutTitle="602+A2A" LoadoutType="WEAPON">

<Attachment StationIndex="2" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="3" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="4" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="5" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="7" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

</Attachments.Loadout>



<Attachments.Loadout LoadoutTitle="402+JDAM" LoadoutType="WEAPON">

<Attachment StationIndex="2" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="3" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="4" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="5" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="7" ObjectTitle="GBU-32_JDAM" Quantity="3" PylonTitle="pylon_sidebyside" />

</Attachments.Loadout>



<Attachments.Loadout LoadoutTitle="402+HARM" LoadoutType="WEAPON">

<Attachment StationIndex="2" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="3" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="4" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="5" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="7" ObjectTitle="AGM-88_HARM" Quantity="2" PylonTitle="pylon_sidebyside" />

</Attachments.Loadout>



<Attachments.Loadout LoadoutTitle="402+BLU109" LoadoutType="WEAPON">

<Attachment StationIndex="2" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="3" ObjectTitle="AIM-9M_Sidewinder" Quantity="1" />

<Attachment StationIndex="4" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="5" ObjectTitle="AIM-120_AMRAAM" Quantity="2" PylonTitle="pylon_sidebyside" />

<Attachment StationIndex="7" ObjectTitle="BLU-109" Quantity="3" PylonTitle="pylon_sidebyside" />

</Attachments.Loadout>



<Attachments.Loadout LoadoutTitle="Standard" LoadoutType="COUNTERMEASURE">

<Attachment StationIndex="0" ObjectTitle="Chaff" Quantity="100" />

<Attachment StationIndex="1" ObjectTitle="Flare" Quantity="100" />

</Attachments.Loadout>



<Attachments.Loadout LoadoutTitle="Standard" LoadoutType="GUN">

<Attachment StationIndex="6" ObjectTitle="M-61_Vulcan" Quantity="1000" />

</Attachments.Loadout>



</Attachments.Loadouts>



<Attachments.Pylons>

<Attachments.Pylon PylonTitle="pylon_sidebyside">

<PylonPoint PositionOffset="0.0, -1.0, -2.10" OrientationOffset="0.0, 0.0, 0.0"></PylonPoint>

<PylonPoint PositionOffset="0.0, 1.0, -2.10" OrientationOffset="0.0, 0.0, 0.0"></PylonPoint>

<PylonPoint PositionOffset="0.0, 0, -2.40" OrientationOffset="0.0, 0.0, 0.0"></PylonPoint>

</Attachments.Pylon>

</Attachments.Pylons>



</SimBase.Document>





aircraft.cfg:





[fltsim.0]

title=F-16 A/A

sim=F16

model=

panel=

sound=

texture=

kb_checklists=

kb_reference=

atc_id=AP3D

atc_airline=AIRFORCE

atc_flight_number=001

ui_manufacturer="Lockheed Martin"

ui_type="F-16"

ui_variation="grey"

ui_typerole="Single Engine Supersonic Mult-Role Jet Aircraft"

ui_createdby="Prepar3D"

description="F-16"

weapon_loadout=602+A2A

gun_loadout=Standard

countermeasure_loadout=Standard

health_points=100



[fltsim.1]

title=F-16 HARM

sim=F16

model=

panel=

sound=

texture=

kb_checklists=

kb_reference=

atc_id=AP3D

atc_airline=AIRFORCE

atc_flight_number=001

ui_manufacturer="Lockheed Martin"

ui_type="F-16"

ui_variation="grey"

ui_typerole="Single Engine Supersonic Mult-Role Jet Aircraft"

ui_createdby="Prepar3D"

description="F-16"

weapon_loadout=402+HARM

gun_loadout=Standard

countermeasure_loadout=Standard

health_points=100



[fltsim.2]

title=F-16 JDAM

sim=F16

model=

panel=

sound=

texture=

kb_checklists=

kb_reference=

atc_id=AP3D

atc_airline=AIRFORCE

atc_flight_number=001

ui_manufacturer="Lockheed Martin"

ui_type="F-16"

ui_variation="grey"

ui_typerole="Single Engine Supersonic Mult-Role Jet Aircraft"

ui_createdby="Prepar3D"

description="F-16"

weapon_loadout=402+JDAM

gun_loadout=Standard

countermeasure_loadout=Standard

health_points=100



...

... ( rest of the aircraft.cfg)

...





Have fun with it....


Posted: Sun Dec 01, 2013 11:21 am
by mvanbrus
I will....

Thanks A lot.


Posted: Fri Dec 20, 2013 11:32 am
by Adam Breed
Hi All,



The weapon system is designed to meet the varying needs of our customers, so it might come across as complex and complicated at first glance. The documentation is fairly robust and can be found in the Prepar3DLearningCenter.chm or through the Help in the application menus. You can find the weapon pieces under Prepar3D SDK > SimObject SDK > Weapon Systems. It covers not only attaching weapons, but also how to create your own.



Be aware that a large portion is combined with our new ISimObject capabilities, with some support for SimConnect.



At its simplest, to attach weapons to an object, you mainly just need to create an Attachments.xml file and update the sim.cfg/aircraft.cfg to point to the weapon_loadouts, gun_loadouts, and countermeasure_loadouts defined in the xml file.



If you feel there is documentation missing or something is not clear, let us know what that is and we will do our best to include it in future releases.


Posted: Fri Dec 20, 2013 4:15 pm
by minime


Quote:
Quote from Adam Breed on December 20, 2013, 11:32

If you feel there is documentation missing or something is not clear, let us know what that is and we will do our best to include it in future releases.



The samples are simply missing.



Just put the files I pasted above into the F-16 folder for v2.1 and maybe add a Panel for that F-16 with the radar and weapons gauge, then at least people have one working aircraft.

I also have good attachment coordinates for the F-22 and F-35 if you want them, so you can also add a working attachment.cfg to the F-22 and F-35.



Also the documentation has lots of errors in it, that includes the weapons part. I put some of those into this forum, so you can fix them for v2.1.



For example the FCS_ADD_TARGET that has no events and only work in XML. Doesn't seem to be true.



The enums that arent enums: http://www.prepar3d.com/forum-5/?mingle ... pic&t=4267



Other oddities and weird design (or documentation missing): http://www.prepar3d.com/forum-5/?mingle ... pic&t=4248



Settable and not settable and documentation bugs: http://www.prepar3d.com/forum-5/?mingle ... pic&t=4245



And then missing calls to find out what is hanging on a station: http://www.prepar3d.com/forum-5/?mingle ... pic&t=4268




Posted: Fri Dec 20, 2013 4:51 pm
by WBard
Thanks for linking us to those topics. I've moved them in to this forum. If you had more that we haven't responded to yet, please link the rest and I will move them in here and we'll get someone to look at them.