Jump to content

DCS Mods structure : How to create your plugin from scratch


Recommended Posts

anyone know the command or option in pod/loadout declaration to enable spinner animation based on speed?

 

i have 3 pods, that have spinners on them, I'd like to animate them to spin above a certain speed if possible, or simply when AC is moving.

 

 

Do you want all can see spin anim or just the player who takes the control of that AC?

 

 

Sent from my iPhone using Tapatalk

[sIGPIC][/sIGPIC]

My DCS Mods, Skins, Utilities and Scripts

 

| Windows 10 | i7-4790K | GTX 980Ti Hybrid | 32GB RAM | 3TB SSD |

| TM Warthog Stick | CH Pro Throttle + Pro Pedal | TIR5 Pro | TM MFD Cougar | Gun Camera: PrtScn |

Link to comment
Share on other sites

Well, i dont really wanna jury rig, but if I have too...

 

One of the Pods I actually integrated into the base Model of my Aircraft to make use of Tanker Arguments (Hose Deploy/Retract/Slew), and set it up to appear w/ pylon attachment argument, then changed the POD Loadout info to load invisible dummy shape in place of the POD.

 

Since I'm re-doing pylon attachment arguments again w/ more LAUs, I might as well integrate the Other PODs into the base model as well.

 

So I'll prolly just integrate the other 2 models into the base model and toggle them with Pylon Visibility Arg, and then Define Invisible Dummy Shape in the Pod Declaration.

 

That way I can just use engine Spinner to make the them spin.

 

Outside of that, Maybe somehow use Ram Air Turbine properties/animation (I doubt it's a global animation though, and likely linked to a Cockpit system)

 

No other Pod has the Aux Ram Air Generators, so it's up in the air at the moment.

 

Edit: using RATs animation didnt work either, guess its link tonthe engines time.


Edited by SkateZilla

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

I believe I have a Pretty Good Work around for the spinners animation.

 

Now I just need to figure out why in the new tanker module doesnt show under radios and AI ignores it.

 

My Main Block/Issue right now, is setting up DECAL and DAMAGE Texture Layers.... there's no info on that anywhere.


Edited by SkateZilla

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

I had the same problem with a tanker I was working on. First problem is that the ai is not reacting on the connectors. So I had to define the coordinates of the refuelling receptacle in code, which really took a while. Then the ai just did not react on the tanker. I tried many options. Nothing worked. In the end I gave up and used the russian tanker as a base and made a mod which transformed it to the victor tanker.

 

Not the best solution, but I guess the tanker functionality is deep coded and won´t work for another plane.

System: Intel Core i5 3570K | GTX 980 OC | 16 GB DDR3 1600 | 500 GB SSD

Link to comment
Share on other sites

I had the same problem with a tanker I was working on. First problem is that the ai is not reacting on the connectors. So I had to define the coordinates of the refuelling receptacle in code, which really took a while. Then the ai just did not react on the tanker. I tried many options. Nothing worked. In the end I gave up and used the russian tanker as a base and made a mod which transformed it to the victor tanker.

 

Not the best solution, but I guess the tanker functionality is deep coded and won´t work for another plane.

 

The one I Scripted shows in Mission Editor and does what it's told to do (orbit and wait. etc)

 

AI Aircraft hit Refuel Waypoint, and peel off to RTB

Human Aircraft get to waypoint, however, every jet I've tried, the Tanker Does not show in the Radio List, of either FC3 of DCS Aircraft.

 

If I Swap My Aircraft w/ Any other tanker (S3, IL, or KC), AI Approach and hook up, Human AC have Tanker In Radio Menu.

 

So Something to do with Radios is missing, the AI are prolly peeling off because they cant contact the tanker.

 

Or there's a Separate LUA that you have to Define Aircraft as Tankers.

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...
The one I Scripted shows in Mission Editor and does what it's told to do (orbit and wait. etc)

 

AI Aircraft hit Refuel Waypoint, and peel off to RTB

Human Aircraft get to waypoint, however, every jet I've tried, the Tanker Does not show in the Radio List, of either FC3 of DCS Aircraft.

 

If I Swap My Aircraft w/ Any other tanker (S3, IL, or KC), AI Approach and hook up, Human AC have Tanker In Radio Menu.

 

So Something to do with Radios is missing, the AI are prolly peeling off because they cant contact the tanker.

 

Or there's a Separate LUA that you have to Define Aircraft as Tankers.

 

If you figure this out, I would love to know. We want to enable buddy refueling for our A-4 mod when the D-704 is equipped.

Link to comment
Share on other sites

Well, i dont really wanna jury rig, but if I have too...

 

One of the Pods I actually integrated into the base Model of my Aircraft to make use of Tanker Arguments (Hose Deploy/Retract/Slew), and set it up to appear w/ pylon attachment argument, then changed the POD Loadout info to load invisible dummy shape in place of the POD.

 

Since I'm re-doing pylon attachment arguments again w/ more LAUs, I might as well integrate the Other PODs into the base model as well.

 

So I'll prolly just integrate the other 2 models into the base model and toggle them with Pylon Visibility Arg, and then Define Invisible Dummy Shape in the Pod Declaration.

 

That way I can just use engine Spinner to make the them spin.

 

Outside of that, Maybe somehow use Ram Air Turbine properties/animation (I doubt it's a global animation though, and likely linked to a Cockpit system)

 

No other Pod has the Aux Ram Air Generators, so it's up in the air at the moment.

 

Edit: using RATs animation didnt work either, guess its link tonthe engines time.

 

I did the same last year...

 

d8eae63b7386.jpg

 

 

Spinner animation works:

 

40

Угол поворота винта

0

1

отображается на [0;360])

Угол поворота винта

 

    net_animation = {
40,
   },

    mapclasskey         = "P0091000064",
   sounderName = "Aircraft/Planes/A-10A",
   attribute = {wsType_Air, wsType_Airplane, wsType_Cruiser, WSTYPE_PLACEHOLDER, "Aux", "Tankers", "Refuelable"},
   Categories= {"{8A302789-A55D-4897-B647-66493FA6826F}", "Tankers",},

But I could not make IFR work.

I would be grateful for any information conducive to the solution of this problem.


Edited by Morkva_55

su-24.gif

Link to comment
Share on other sites

I did the same last year...

 

d8eae63b7386.jpg

 

 

Spinner animation works:

 

40

Угол поворота винта

0

1

отображается на [0;360])

Угол поворота винта

 

    net_animation = {
40,
   },

    mapclasskey         = "P0091000064",
   sounderName = "Aircraft/Planes/A-10A",
   attribute = {wsType_Air, wsType_Airplane, wsType_Cruiser, WSTYPE_PLACEHOLDER, "Aux", "Tankers", "Refuelable"},
   Categories= {"{8A302789-A55D-4897-B647-66493FA6826F}", "Tankers",},

But I could not make IFR work.

I would be grateful for any information conducive to the solution of this problem.

 

 

So you're sayin even w/ Engine Types set to jet engines Using Argument 40 will still have a Ram Air Propeller?

 

I havent been able to work on anything since last Thursday due to hardware problem.

 

Including Tanker Troubleshooting, 3D Art, etc.


Edited by SkateZilla

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

  • 3 weeks later...

Draw Cockpit arguments with lua

 

Hello pilots,

 

i want to modify some cockpit lights of the F-15 cockpit by using lua. With "set_aircraft_draw_argument(x,y)" i can modify already the 3d model of the aircraft, but how to modify cockpit instruments?

 

Is it possible to go via FM_Params?

local fmparams = get_param_handle("FM_Params")

 

I had no success right now. If somebody have an idea, that would be nice! Thanks...

Link to comment
Share on other sites

As far as I am aware, there is no direct LUA function to set cockpit arguments.

 

For just setting a cockpit arg that is not a clickable element, you have to use one of the following:

 

1) EFM function: ed_fm_set_fc3_cockpit_draw_args

2) exported dll function: ed_cockpit_set_draw_argument

3) mainpanel_init.lua gauge definition as parameter type: CreateGauge("parameter")

 

Option 3 is probably the best for your scenario.

 

Example:

 

TEST_PARAM_GAUGE                      = CreateGauge("parameter")
TEST_PARAM_GAUGE.parameter_name       = "TEST"
TEST_PARAM_GAUGE.arg_number           = 113
TEST_PARAM_GAUGE.input                = {0,100} 
TEST_PARAM_GAUGE.output               = {0,1}

Link to comment
Share on other sites

Thanks for your hints, but no success so far.

 

What i did:

 

I created a mainpanel_init.lua

shape_name   	   = "Cockpit_F-15C"

TEST_PARAM_GAUGE      			  = CreateGauge("parameter")
TEST_PARAM_GAUGE.parameter_name   = "TEST_PARAM"
TEST_PARAM_GAUGE.arg_number    	  = 200 --Speedbrake LED in F15
TEST_PARAM_GAUGE.input    		  = {0,100} 
TEST_PARAM_GAUGE.output    		  = {0,1} 

print_message_to_user("Mainpanel init")

need_to_be_closed = true

 

added this line to device_init.lua

MainPanel = {"ccMainPanel",LockOn_Options.script_path.."mainpanel_init.lua"}

 

added a testdevice

local dev 	    = GetSelf()
local my_param  = get_param_handle("TEST_PARAM")
local update_time_step = 1
make_default_activity(update_time_step)

function post_initialize()
print_message_to_user("Test device initalized")
end

function update()
local v = my_param:get()
print_message_to_user(v)
end

 

All the Debug "print_message..." are working, but the value of my_param is always "0" even when the speedbrake LED ist on.

 

Is there something wrong?

Link to comment
Share on other sites

All the Debug "print_message..." are working, but the value of my_param is always "0" even when the speedbrake LED ist on.

 

Is there something wrong?

 

Yes, you can't use parameters to get argument information like you are trying to do. My example was assuming you were trying to SET the argument value. If you want to set the LED:

 

local dev 	    = GetSelf()
local my_param  = get_param_handle("TEST_PARAM")
local update_time_step = 1
make_default_activity(update_time_step)

function post_initialize()
print_message_to_user("Test device initalized")
end

function update()
my_param:set(1) -- Turn the indicator on or off (0) depending on your logic
end

 

Also, you should probably use input = {0,1} for indicator lights for mainpanel, because it is doing an interpolation and if you send a value of 1 for a range 0-100, the output to the indicator would be 0.01.

 

shape_name   	   = "Cockpit_F-15C"

TEST_PARAM_GAUGE      			  = CreateGauge("parameter")
TEST_PARAM_GAUGE.parameter_name   = "TEST_PARAM"
TEST_PARAM_GAUGE.arg_number    	  = 200 --Speedbrake LED in F15
TEST_PARAM_GAUGE.input    		  = {0,1} 
TEST_PARAM_GAUGE.output    		  = {0,1} 

print_message_to_user("Mainpanel init")

need_to_be_closed = true

 

The real problem you are going to have is that ED's code in dll is already setting that indicator argument value, so you won't be able to use it for your own needs, since you will be fighting for control of the argument value with ED's code. If you are just wanting to read the argument value, I'm not sure how to do that in LUA.


Edited by SilentEagle
Link to comment
Share on other sites

load the F-15C Pit EDM attached to a separate module of your own so DLL Systems dont override your scripted ones.

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

@SilentEagle, thank you for the hint "input = {0,1}"!

 

Ok, it was already working, but like you guys told me, i can just control Arguments, where are not used. For example, i can toggle the "camera record on" switch, by lua.

 

@SkateZilla, i already use a mod with no F15.dll flight model attached (SFM) based on a existing mod (just for testing) where is using the f15 pit. What exactly do you mean with "seperate module"? I want to take control over all unused but attached Arguments to use LEDs for my own.

For example, the F15 "hook" LED is not used (never switched on), but i want to toggle the led, but cant override the value, because it is attached somewhere else.

 

Thank you for your help so far! If someone have ideas how to do this is very welcome. I'am familiar with c/c++, but never did a dll for DCS, maybe this is possibility?

 

Thank you... :book::joystick:

Link to comment
Share on other sites

Are you using Old = 6 in teh make Flyable Declaration to load the F-15 Systems though?

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

That will load the old F15 Systems, including Cockpit Argument Settings.

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

That's the Issue,

 

You either have old = x and it loads those system

 

or you dont and you have to script your own systems,

 

as long as you have old = 6 , it will load the old F-15C cockpit systems, which will set argument states.

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

You either dont have a Cockpit LODs or your Declare Line is linking to a Aircraft Name you have not set correctly,

 

Do you have a cockpit lods file in the /shapes/ folder?

Cockpit_MiG-21Bis.lods Linking to the Su33 cockpit EDM File:

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 months later...

Hi, I'm trying to mod the IVSA F/A-18 so that it uses an EFM, specifically the F-15 FM for now.

 

However, I've run into a problem. When I try and fly the plane, the AI takes it over and I can't fly, even though it has my name in the bottom left of the F2 view.

 

Here is my entry.lua code:

 

self_ID = "F/A-18 by ISVA"

declare_plugin(self_ID,

{

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

dirName = current_mod_path,

version = "ISVA",

state = "installed",

info = _("The McDonnell Douglas (now Boeing) F/A-18 Hornet is a twin-engine supersonic, all-weather carrier-capable multirole fighter jet, designed to dogfight and attack ground targets (F/A designation for Fighter/Attack). Designed by McDonnell Douglas and Northrop, the F/A-18 was derived from the latter's YF-17 in the 1970s for use by the United States Navy and Marine Corps. The Hornet is also used by the air forces of several other nations."),

 

InputProfiles =

{

["FA-18C"] = current_mod_path .. '/Input/fa-18c',

["FA-18A"] = current_mod_path .. '/Input/fa-18a',

},

Skins =

{

{

name = _("F/A-18"),

dir = "Theme"

},

},

Missions =

{

{

name = _("F/A-18"),

dir = "Missions",

},

},

LogBook =

{

{

name = _("FA-18C"),

type = "FA-18C",

},

{

name = _("FA-18A"),

type = "FA-18A",

},

},

binaries =

{

'F15'

},

 

})

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

mount_vfs_model_path (current_mod_path.."/Cockpit/Shape")

mount_vfs_model_path (current_mod_path.."/Shapes")

mount_vfs_liveries_path (current_mod_path.."/Liveries")

mount_vfs_texture_path (current_mod_path.."/Textures/Avionics")

mount_vfs_texture_path (current_mod_path.."/Textures/Skins_FA_18C")

mount_vfs_texture_path (current_mod_path.."/Textures/Skins_Swiss_Air_Force_by_CHSubZero_1.4")

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

--make_flyable('FA-18A',current_mod_path..'/Cockpit/', {nil, old = 54}, current_mod_path..'/Entry/comm.lua')--SFM

--make_flyable('FA-18C',current_mod_path..'/Cockpit/', {nil, old = 6}, current_mod_path..'/Entry/comm.lua')--SFM

 

--make_flyable('FA-18A',current_mod_path..'/Cockpit/', {self_ID, 'Su-27', old = 54}, current_mod_path..'/Entry/comm.lua')

--make_flyable('FA-18C',current_mod_path..'/Cockpit/', {self_ID, 'Su-27', old = 6}, current_mod_path..'/Entry/comm.lua')

 

make_flyable('FA-18A',current_mod_path..'/Cockpit/', {self_ID, 'F15', old = 54}, current_mod_path..'/Entry/comm.lua')

make_flyable('FA-18C',current_mod_path..'/Cockpit/', {self_ID, 'F15', old = 6}, current_mod_path..'/Entry/comm.lua')

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

dofile(current_mod_path..'/Entry/FAA')

dofile(current_mod_path..'/Entry/FAC')

dofile(current_mod_path..'/Entry/FAW')

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

plugin_done()

 

 

What am I doing wrong?

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...