Jump to content

Recommended Posts

Posted

Hey guys, I was just wondering if anyone knows the code to add new cargos to DCS using a .lua file in the MODS folder structure.

 

For example I know I can select and add a static object in the mission editor (and it will appear in the mission) using the a lua with the following (and relevant shape and textures in the right folders)

 

-- CONE TEST STATIC OBJECT
-- This uses the system where object files are placed in the shapes folder and texture files in the textures folder

mount_vfs_model_path	(current_mod_path.."/Shapes")		--Path to model file
mount_vfs_texture_path  (current_mod_path.."/Textures")		--Path to texture file

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

GT.chassis.life = 1000			-- initial life level
GT.visual.shape = "ConeTest"		-- object file name
GT.visual.shape_dstr = "ConeTest"	-- destroyed object file name
GT.CustomAimPoint = {1,1,0}

--Burning after hit
GT.visual.fire_size = 0			-- relative burning size
GT.visual.fire_pos = {0,0,0};		-- center of burn [long, vertical, transverse]
GT.visual.fire_time = 0			-- burning time (seconds)
GT.time_agony = 180;			-- ??

GT.Name = "ConeTest"			-- MUST BE THE SAME AS OBJECT FILE NAME
GT.DisplayName = _("ConeTestC") 	-- Name in mission editor drop down and F10 Map
GT.Rate = 1				-- ????

GT.DetectionRange  = 0;
GT.ThreatRange = 0;
GT.mapclasskey = "P0091000076";
GT.attribute = {wsType_Ground,wsType_Tank,wsType_NoWeapon,wsType_GenericFort,
               "Fortifications",
               };
GT.category = "Fortification";
               
add_surface_unit(GT)

 

 

to make it a cargo instead I think i have to change the following lines but i have no idea what to change them too. I also think i need to add a line stating its weight and possibly coordinates of its attachment point.

 

GT.mapclasskey = "P0091000076";
GT.attribute = {wsType_Ground,wsType_Tank,wsType_NoWeapon,wsType_GenericFort,
               "Fortifications",
               };
GT.category = "Fortification";
               
add_surface_unit(GT)

 

any help would be greatly appreciated.

ps. i have tried the search and lots of googling as well with no luck

Posted (edited)
numero = 10000000

local static = {
["groupId"] = numero,
["category"] = "Cargos",
["type"] = "Cargo1",
["unitId"] = numero,
["x"] = pos.point.x,
["y"] = pos.point.z,
["canCargo"] = true,
["mass"] = 500,
["heading"] = 0,
["name"] = "You_name_carco ",
["dead"] = false,
["country"] = "USA",
["shape_name"] = "ab-212_cargo",
} 
coalition.addStaticObject('USA', static) 
numbercargo = numbercargo + 1

Edited by spinter

====VIAF====

Spinter 155° "Pantere Nere"

 

TsSimComms

 

My Site aiupgrade.net

 

 

 

  • 4 weeks later...
Posted

Hi tacca,

 

did you get the cargo to work with the .lua file?

 

For me it does not work.

 

 

@spinter

 

can you post an example of a complete .lua file for the cargo?

DCS Mods and Skins: HiDrive

Use the NAS only if the other Link is not working - it's slow!
My DCS MODs and Skins: NAS

  • Recently Browsing   0 members

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