Jump to content

Recommended Posts

Posted

Hey Guys,

I just joined the community, was a FSX user before.

 

Regarding the new developpement of the sim, I came back to it.

 

Now I am reworking my skyraider mod which I was developping for fsx, trying to bring it into dcs. I already made some successful tests but now I have a problem I can´t solve by myself.

 

It is the propeller animation. I know the draw argument is 407. When the plane is AI used everything works fine, but when I am piloting it by myself the animation seems to be inactive.

 

Any ideas? I am thankful for every help!!

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

Posted

You should be able to write a lua script to control the propeller animation when the player is piloting it. I don't have any of my mod stuff with me on my laptop, but I whipped up this simple example code anyway (untested so it might crash). As I say in the code comments, you will want to either get a sensor for prop RPM or write your own prop acceleration so the propeller motion looks more natural.

 

local propeller_animation = GetSelf()

local update_time_step = 0.0166 --about 60/second
make_default_activity(update_time_step)

local sensor_data = get_base_data()

local DRAW_PROP				= 	407
local COMMAND_THROTTLE		= 	2004
local throttleSetting		= 	0
local propState				=   0
local propDiskLimit			= 	0.8
local propMultiplier		=	0.0166 --controls prop speed. should go 1 revolution / second with this value

propeller_animation:listen_command(COMMAND_THROTTLE)

function SetCommand(command,value)

if command == COMMAND_THROTTLE then	
	--I think DCS throttle is from -1 to 1. If it is from 0 to 1 then make it
	--throttleSetting = value
	throttleSetting = (value+1)/2 
end

end

function update()
--this is just a simple example. You will want to include propeller RPM and accelerations
--instead of just making it go a certain speed based on throttle setting.
--maybe there is a sensor you can use for prop RPM if you are not using your own EFM.

propState = propState + propMultiplier*throttleSetting --adds to the propeller position to make it rotate
propState = propState - math.floor(propState) --keeps it between 0 and 1
if throttleSetting > propDiskLimit then --checking if it is above a certain speed. You should use prop RPM instead of throttle.
	--you will want the prop to change to a blur when it starts spinning fast enough for aliasing. (it looks like it is going backwards)
	propState = -1 	--I think negative numbers for propeller animation make the blur disk for high speed
end

set_aircraft_draw_argument_value(DRAW_PROP,propState)
end

[sIGPIC][/sIGPIC]

Posted

Thanks VincentLaw!

 

But know a stupid question, where exactly shoult I put the script. In my mod folder-architecture I have 3 lua files. comm.lua, entry.lua and the A-1.lua (this file contains all the spec of the modell). So should I write the code into the a-1.lua on the first lines, like if I wanna add gun scripts or other loads?

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

Posted (edited)
now a stupid question, where exactly shoult I put the script.
The question is fine, but my answer was incomplete. You actually need to make the script a custom lua cockpit device. It goes with your other cockpit scripts but it won't actually control any cockpit systems, just the propeller animation. You can find an example of how to make a custom cockpit lua device in the wunderluft sample here (the device named TEST): http://forums.eagle.ru/showthread.php?t=89164

 

you need to edit devices.lua and device_init.lua, and add your custom script in the path you designated in device_init.lua

 

I'll include a simple example below using the wunderluft files with the code I added in blue:

 

(devices.lua)

local count = 0
local function counter()
count = count + 1
return count
end
-------DEVICE ID-------
devices = {}
devices["TEST"]						= counter()--1
devices["WEAPON_SYSTEM"]			= counter()--2
devices["ELECTRIC_SYSTEM"]			= counter()--3
devices["CLOCK"]					= counter()--4
devices["ADI"]						= counter()--5
devices["RADAR"]					= counter()--6
[color="Blue"]devices["PROP_ANIMATION"]			= counter()--7[/color]

 

(device_init.lua)

mount_vfs_texture_archives("Bazar/Textures/AvionicsCommon")

dofile(LockOn_Options.script_path.."devices.lua")
dofile(LockOn_Options.common_script_path.."tools.lua")

--	items in <...> are optional
--
-- MainPanel = {"NAME_OF_CLASS",
--				"INIT_SCRIPT_FILE",
--				<{devices.LINKED_DEVICE1, devices.LINKED_DEVICE2, ...},>
--			   }

--MainPanel = {"ccMainPanel",
--			 LockOn_Options.script_path.."mainpanel_init.lua",
--				{{"engine_system",devices.ENGINE_SYSTEM}},
--           }


layoutGeometry = {}
		
MainPanel = {"ccMainPanel",LockOn_Options.script_path.."mainpanel_init.lua"}
		 
-- Avionics devices initialization example
--	items in <...> are optional
--
-- creators[DEVICE_ID] = {"NAME_OF_CONTROLLER_CLASS",
--						  <"CONTROLLER_SCRIPT_FILE",>
--						  <{devices.LINKED_DEVICE1, devices.LINKED_DEVICE2, ...},>
--						  <"INPUT_COMMANDS_SCRIPT_FILE",>
--						  <{{"NAME_OF_INDICATOR_CLASS", "INDICATOR_SCRIPT_FILE"}, ...}>
--						 }
creators    = {}
creators[devices.TEST]			 = {"avLuaDevice"		    ,LockOn_Options.script_path.."test_device.lua"}
creators[devices.WEAPON_SYSTEM]	 = {"avSimpleWeaponSystem"  ,LockOn_Options.script_path.."Systems/weapon_system.lua"}
creators[devices.CLOCK]			 = {"avAChS_1"			    ,LockOn_Options.script_path.."clock.lua"}
creators[devices.ADI]			 = {"avBaseIKP"			    ,LockOn_Options.script_path.."adi.lua"}
creators[devices.ELECTRIC_SYSTEM]= {"avSimpleElectricSystem",LockOn_Options.script_path.."Systems/electric_system.lua"}
creators[devices.RADAR]			 = {"avSimpleRadar"			,LockOn_Options.script_path.."RADAR/Device/init.lua"}
[color="Blue"]creators[devices.PROP_ANIMATION] = {"avLuaDevice"		    ,LockOn_Options.script_path.."prop_animation.lua"}[/color]

-- Indicators
indicators = {}
indicators[#indicators + 1] = {"ccIndicator" ,LockOn_Options.script_path.."HUD/Indicator/init.lua"  ,nil,{{"PNT-HUD-CENTER","PNT-HUD-DOWN","PNT-HUD-RIGHT"},{sx_l = 0,sy_l = 0,sz_l = 0,sh = 0,sw = 0}}} --HUD
indicators[#indicators + 1] = {"ccIndicator",LockOn_Options.script_path.."RADAR/Indicator/init.lua",--init script
 nil,--id of parent device
 {	
{}, -- initial geometry anchor , triple of connector names 
{sx_l =  0,  -- center position correction in meters (forward , backward)
 sy_l =  0,  -- center position correction in meters (up , down)
 sz_l =  0,  -- center position correction in meters (left , right)
 sh   =  0,  -- half height correction 
 sw   =  0,  -- half width correction 
 rz_l =  0,  -- rotation corrections  
 rx_l =  0,
 ry_l =  0}
 }
} --RADAR

		 

 

then name the first script I gave you prop_animation.lua and drop it in the same folder.

Edited by VincentLaw

[sIGPIC][/sIGPIC]

Posted

Great! Thank you so much. Gonna try it out when I came back from work today!

 

All the best!

S

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

Posted

I am desperate,

I tried everything but I am just not able to get the propeller animation work.

 

I really followed exactly the intructions, but no success so far...

 

I attached the mod file, so maybe you can help me out with it...

 

Again, thanks for any help!

A-1.rar

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

Posted

I'm sure Someone that knows what to do will help you out.

The only way to make sense out of change is to plunge into it, move with it, and join the dance.

"Me, the 13th Duke of Wybourne, here on the ED forums at 3 'o' clock in the morning, with my reputation. Are they mad.."

https://ko-fi.com/joey45

 

Posted
I am desperate,

I tried everything but I am just not able to get the propeller animation work.

 

I really followed exactly the intructions, but no success so far...

 

I attached the mod file, so maybe you can help me out with it...

 

Again, thanks for any help!

 

I wont have access to my desktop until next week. if no one else gets it working before then I can probably take care of it for you. for now I recommend working on other parts of the mod instead of wasting time on the propeller. Sorry my instructions are not really complete.

[sIGPIC][/sIGPIC]

Posted

Thanks,

I´ll keep trying. I´ll keep you posted about the progress...

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

Posted

Here, working prop animation for the player. I used sensor_data.getEngineLeftRPM() to calculate prop RPM so no fancy mathematics were required (much better than using thrust values). I didn't set any negative animation values for the blurred prop disk because your model didn't include one.

A-1.rar

[sIGPIC][/sIGPIC]

Posted
Here, working prop animation for the player. I used sensor_data.getEngineLeftRPM() to calculate prop RPM so no fancy mathematics were required (much better than using thrust values). I didn't set any negative animation values for the blurred prop disk because your model didn't include one.

 

can we add cockpit operations by defining them in clickabledata.lua? How can we link the device_command.Button_xx to those arg (I have all cockpit arg)?

[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 |

Posted
can we add cockpit operations by defining them in clickabledata.lua? How can we link the device_command.Button_xx to those arg (I have all cockpit arg)?
Sorry, I have not done any modding with clickable stuff before.

[sIGPIC][/sIGPIC]

Posted (edited)
Here, working prop animation for the player. I used sensor_data.getEngineLeftRPM() to calculate prop RPM so no fancy mathematics were required (much better than using thrust values). I didn't set any negative animation values for the blurred prop disk because your model didn't include one.

 

Tank you so much vincent!!!

Edited by Starway

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

Posted
Very nice Plane:thumbup::thumbup::thumbup:

can your upload the trees palms???

 

That Tree/Palms is a vietnam Terrain mod I am working on. Still in dev

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

Posted

Sandys and Hueys? I can already see massive RESCAP operations soon in DCS. Well done mate, congratulations!

I don't understand anything in russian except Davai Davai!

Posted

if this was a DCS module, I'd buy in a fraction of a heartbeat...

AWAITING ED NEW DAMAGE MODEL IMPLEMENTATION FOR WW2 BIRDS

 

Fat T is above, thin T is below. Long T is faster, Short T is slower. Open triangle is AWACS, closed triangle is your own sensors. Double dash is friendly, Single dash is enemy. Circle is friendly. Strobe is jammer. Strobe to dash is under 35 km. HDD is 7 times range key. Radar to 160 km, IRST to 10 km. Stay low, but never slow.

  • Recently Browsing   0 members

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