Jump to content

DCS Mods structure : How to create your plugin from scratch


Recommended Posts

  • 3 weeks later...

Sorry if this has been posted about before, but have anyone figured out a way to get weight on wheels? getWOW_LeftMainLandingGear(), getWOW_NoseLandingGear() and getWOW_RightMainLandingGear() always returns 0 for me.

 

Also, has anyone figured how you are supposed to send data between the dll-flightmodel and the lua-devices? I am working on a solution using windows named pipes, but it seems like a unnecessary hack.


Edited by RagnarDa

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Sorry if this has been posted about before, but have anyone figured out a way to get weight on wheels? getWOW_LeftMainLandingGear(), getWOW_NoseLandingGear() and getWOW_RightMainLandingGear() always returns 0 for me.

 

Also, has anyone figured how you are supposed to send data between the dll-flightmodel and the lua-devices? I am working on a solution using windows named pipes, but it seems like a unnecessary hack.

BUMP!

 

 

 

 

 

 

 

* runs and hides *

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

isnt this a limitation/incomplete part of 1.2.2.?

 

(the AFM interaction Code for 3rd party External FMs)

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill (F4-3200C16D-16GTZR x2),

ASRock X470 Taichi Ultimate, XFX RX6800XT Merc 310 (RX-68XTALFD9)

3x ASUS VS248HP + Oculus HMD, Thrustmaster Warthog HOTAS + MFDs

Link to comment
Share on other sites

Also, has anyone figured how you are supposed to send data between the dll-flightmodel and the lua-devices? I am working on a solution using windows named pipes, but it seems like a unnecessary hack.

 

Without access to more ED tools, the only method I know is a workaround.

 

http://forums.eagle.ru/showpost.php?p=1610388&postcount=177

 

You would essentially be using unused external arguments, but I suggest numbers above 500 so as not to interfere with other external argument purposes. Also, I have recently found that using numbers over 602 crashes the game.


Edited by SilentEagle
  • Like 1
Link to comment
Share on other sites

Thanks! Will look into your method, but in the meantime I am almost finished with my workaround.

 

Funny how that with so many module-developers, no-one seems to know how to tell (reliably) if the aircraft is on the ground. Maybe that's one of the things keeping Beczl from releasing his jet?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Anyone managed to get the F-15C, A-10C or Ka-50 cockpit working for your mod? I thought it would be a good way to learn the cockpit system as it has working gauges, switches...

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

I copied the files in Flaming Cliffs/Cockpit/Resources to the same folder in my plane and added these lines in entry.lua:

mount_vfs_texture_path  (current_mod_path ..  "/Cockpit/Resources/Model/Textures/F-15C-CPT-TEXTURES")
mount_vfs_model_path    (current_mod_path ..  "/Cockpit/Resources/Model/Shape")
mount_vfs_liveries_path (current_mod_path ..  "/Liveries")

I also changed this line:

make_flyable('MyPlane','Cockpit_F-15C',FM,nil)

But there are no cockpit displaying. What did I miss?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

no idea, I know when I delete our cockpit folder,

 

The game now defaults to the SU-27 Pit, when it used to default to the SU-25.

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill (F4-3200C16D-16GTZR x2),

ASRock X470 Taichi Ultimate, XFX RX6800XT Merc 310 (RX-68XTALFD9)

3x ASUS VS248HP + Oculus HMD, Thrustmaster Warthog HOTAS + MFDs

Link to comment
Share on other sites

Ok, I start to "code" the Pr_183.... I follow the first post in the first page:

 

I only mod a little entry and plugin files:

entry

declare_plugin("Pr_183 by Silver_Dragon",

{

installed 	 = true, -- if false that will be place holder , or advertising

dirName	  	 = current_mod_path,

version		 = "1.2.2 Beta",

state		 = "installed",

info		 = _("The Proyect 183 was a soviet Torpedo Boat used by the URRS and allieds"),



Skins	=

{

	{

		name	= "Pr_183",

		dir		= "Theme"

	},

},


Missions =

{

	{

		name		= _("Pr_183"),

		dir			= "Missions",

		CLSID		= "{CLSID5456456346CLSID}",

},

},


LogBook =

{

	{

		name		= _("Pr_183"),

		type		= "Pr_183",

	},

},


InputProfiles =

{

	["Pr_183"]     = current_mod_path .. '/Input',

},

})

---------------------------------------------------------------------------------------

dofile(current_mod_path..'/Pr_183')


---------------------------
---------------------------------------------------------------------------------------
plugin_done()-- finish declaration , clear temporal data

 

I change add_arcraft by this on the addon declaration.

 

},
}

add_surface_unit(Pr_183)

 

and work, show plugin installed into DCS:W, but the problem show when I put 'make_flyable' on entry file.....

 

make_flyable('Pr_183',current_mod_path..'/Cockpit/Scripts')

 

I have´t a cockpit modeled. The log show them:

 

UNKNOWN main: GUI Error: [string "./mods/tech/Pr_183/entry.lua"]:80: attempt to call global 'make_flyable' (a nil value)


Edited by Silver_Dragon
Link to comment
Share on other sites

i dont have combined arms so i have no way of study those scripts.

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill (F4-3200C16D-16GTZR x2),

ASRock X470 Taichi Ultimate, XFX RX6800XT Merc 310 (RX-68XTALFD9)

3x ASUS VS248HP + Oculus HMD, Thrustmaster Warthog HOTAS + MFDs

Link to comment
Share on other sites

  • 2 weeks later...
So does anyone have a good/successful example of file structure and entry.lua file for adding a ground unit? If its in this thread I am missing it :huh:

 

I have added:

attachment.php?attachmentid=72670&stc=1&d=1351769488 DHSK ground unit model with the mods folder.

 

But I deleted my DCS World folder without backing it up so will have to learn how to do it again. :mad:

 

You probably want to search This part of the forum not in this thread

 

This Thread helped me when I was stuck on adding ground units.

 

and someone posted a tank mod example but I can't find it anymore and the Wunderluft Sample is the best start for any new modeler.

 

It is a real shame there arn't any good tutorials on making new stuff for DCS.

 

Edit I found my file:

 

Now this doesn't give a working ground vehicle but it is a step in the right direction, i think it doesnt work because of "set_recursive_metatable(GT, GT_t.generic_stationary)" but I don't know what else there is possible to put in there.

 

and if i comment back in "make_flyable('DSHK')" DCS doesn't load at all.

 

Entry.lua

declare_plugin("DSHK by Jib",
{
installed 	 = true, -- if false that will be place holder , or advertising
dirName	  	 = current_mod_path,
version		 = "1",		 
state		 = "installed",
info		 = _("Test of Adding New Ground Units to DCS"),
binaries 	 = 
{
"GroundCockpitBase",
"CombinedArms.dll",
},

LogBook =
{
	{
		name		= _("DSHK"),
		type		= "DSHK",
	},
},	
InputProfiles =
{
	["DSHK"]     = current_mod_path .. '/Input',
},
})

dofile(current_mod_path..'/DSHK.lua')

--make_flyable('DSHK') --if I comment this back in DCS doesn't load at all.

plugin_done()-- finish declaration , clear temporal data
)

 

DHSK.lua

 

-- Jibs DSHK 12.7 mm Machine Gun

mount_vfs_model_path	(current_mod_path.."/Shapes")
mount_vfs_texture_path  (current_mod_path.."/Textures")

GT = {};
set_recursive_metatable(GT, GT_t.generic_stationary)
set_recursive_metatable(GT.chassis, GT_t.CH_t.STATIC);
GT.chassis.life = 1

GT.visual.shape = "DSHK.EDM"
GT.visual.shape_dstr = ""

--Burning after hit
GT.visual.fire_size = 0 --relative burning size
GT.visual.fire_pos = {0,0,0};
GT.visual.fire_time = 0 --burning time (seconds)
GT.time_agony = 180;

-- weapon systems
GT.WS = {};
GT.WS.maxTargetDetectionRange = 5000;

local ws = GT_t.inc_ws();
GT.WS[ws]					= {};
GT.WS[ws].center			= 'CENTER_TOWER';
GT.WS[ws].angles			= { {math.rad(180), math.rad(-180), math.rad(-4), math.rad(17)} };
GT.WS[ws].drawArgument1		= 0;
GT.WS[ws].drawArgument2		= 1;
GT.WS[ws].omegaY			= math.rad(17);
GT.WS[ws].omegaZ			= math.rad(10);
GT.WS[ws].pidY				= {p=10, i=0.07, d=5, inn = 1.5};
GT.WS[ws].pidZ				= {p=10, i=0.02, d=4, inn = 1.8};

--GT.WS[1].LN[1]
__LN						= add_launcher(GT.WS[ws], GT_t.LN_t.machinegun_7_62);--coaxial
__LN.PL[1].ammo_capacity	= 2000;
__LN.BR[1].connector_name	= 'POINT_MGUN_01';
__LN.fireAnimationArgument	= 45;
__LN.customViewPoint		= { "genericAAA", {-0.26, 0.1, 0.1 }, };

--GT.WS[1].LN[2]
__LN						= add_launcher(GT.WS[ws], GT_t.LN_t.tank_gun_105mm); -- temporary, to fix, must be 100mm D-10T2C cannon
__LN.PL[1].ammo_capacity	= 20;
__LN.BR[1].connector_name	= 'POINT_GUN';
__LN.customViewPoint		= { "genericTankred", {-4.0, 0.3, 0 }, };

--GT.WS[1].LN[3]
__LN						= add_launcher(GT.WS[ws], __LN); -- HE rounds
__LN.type					= 6;
__LN.distanceMin			= 300;
__LN.distanceMax			= 8000;
__LN.PL[1].ammo_capacity	= 14;
__LN.PL[1].shell_name		= {"UOF_412_100HE"};
__LN.customViewPoint		= { "genericTankred", {-4.0, 0.3, 0 }, };

ws = GT_t.inc_ws();
GT.WS[ws] = {};
GT.WS[ws].base				= 1;
GT.WS[ws].center			= 'CENTER_MGUN';
GT.WS[ws].angles			= {
							{math.rad(180), math.rad(86), math.rad(-8), math.rad(40)},
							{math.rad(86), math.rad(59), math.rad(20), math.rad(40)},
							{math.rad(59), math.rad(-180), math.rad(-8), math.rad(40)},
						  };
GT.WS[ws].drawArgument1		= 25;
GT.WS[ws].drawArgument2		= 26;
GT.WS[ws].omegaY			= math.rad(40);
GT.WS[ws].omegaZ			= math.rad(30);
GT.WS[ws].pidY				= {p=10,i=0.02,d=4, inn = 1.5};
GT.WS[ws].pidZ				= {p=10,i=0.02,d=4, inn = 1.5};
GT.WS[ws].reference_angle_Y	= math.pi;

__LN						= add_launcher(GT.WS[ws], GT_t.LN_t.machinegun_12_7_utes);
__LN.type					= 10; -- AA Machinegun
__LN.BR[1].connector_name	= 'POINT_MGUN';
__LN.fireAnimationArgument	= 44;
__LN.customViewPoint		= { "genericAAA", {-2.0, 0.2, 0 }, };
__LN						= nil;

--Name Stuff
GT.Name = "DSHK"
GT.DisplayName = _("DSHK")
GT.Rate = 1

GT.Sensors					= { OPTIC = {"TKN-3B day", "TKN-3B night", "TSH-2-22 day","TPN1 night"} };

GT.DetectionRange  = 0;
GT.ThreatRange = 0;
GT.mapclasskey = "P0091000076";
GT.attribute = { wsType_Ground,wsType_Tank,wsType_Gun,wsType_GenericTank, "Tanks", "Old Tanks" };
GT.category = "Armor";
               
add_surface_unit(GT)

 

I have attached the zip put it in /mods/tech

You will need to copy over your own Combined arms dll.s from your install.


Edited by jib
  • Like 1

Mods I use: KA-50 JTAC - Better Fire and Smoke - Unchain Rudder from trim KA50 - Sim FFB for G940 - Beczl Rocket Pods Updated!

Processor: Intel Q6600 @ 3.00GHz

GPU: GeForce MSI RTX 2060 6GB

RAM: Crucial 8GB DDR2

HDD: 1TBGB Crucial SSD

OS: Windows 10, 64-bit

Peripherals: Logitech G940 Hotas, TrackiR 5, Voice Activated commands , Sharkoon 5.1 headset. ,Touch Control for iPad, JoyToKey

Link to comment
Share on other sites

I am excited because I have managed (by some fluke) to make my DHSK "drivable" with combined arms.

 

attachment.php?attachmentid=78023&stc=1&d=1362435729

 

it is no where near finished and fires at a right angle to the barrel, but it is a great step in the right direction for me.

I have posted the .lua's the .edm and the .max in a zip Edit Uploaded Newer VersionHere.

 

Just copy it to you Mods\tech folder and it will show up as DHSK under armor in the mission editor.

 

I have no time to work on it tonight but will try and polish it up tomorrow.


Edited by jib

Mods I use: KA-50 JTAC - Better Fire and Smoke - Unchain Rudder from trim KA50 - Sim FFB for G940 - Beczl Rocket Pods Updated!

Processor: Intel Q6600 @ 3.00GHz

GPU: GeForce MSI RTX 2060 6GB

RAM: Crucial 8GB DDR2

HDD: 1TBGB Crucial SSD

OS: Windows 10, 64-bit

Peripherals: Logitech G940 Hotas, TrackiR 5, Voice Activated commands , Sharkoon 5.1 headset. ,Touch Control for iPad, JoyToKey

Link to comment
Share on other sites

  • ED Team
I am excited because I have managed (by some fluke) to make my DHSK "drivable" with combined arms.

 

attachment.php?attachmentid=78023&stc=1&d=1362435729

 

it is no where near finished and fires at a right angle to the barrel, but it is a great step in the right direction for me.

I have posted the .lua's the .edm and the .max in a zip Here

 

Just copy it to you Mods\tech folder and it will show up as DHSK under armor in the mission editor.

 

I have no time to work on it tonight but will try and polish it up tomorrow.

Very cool, will check it all out when I get a chance...

64Sig.png
Forum RulesMy YouTube • My Discord - NineLine#0440• **How to Report a Bug**

1146563203_makefg(6).png.82dab0a01be3a361522f3fff75916ba4.png  80141746_makefg(1).png.6fa028f2fe35222644e87c786da1fabb.png  28661714_makefg(2).png.b3816386a8f83b0cceab6cb43ae2477e.png  389390805_makefg(3).png.bca83a238dd2aaf235ea3ce2873b55bc.png  216757889_makefg(4).png.35cb826069cdae5c1a164a94deaff377.png  1359338181_makefg(5).png.e6135dea01fa097e5d841ee5fb3c2dc5.png

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...