Jump to content

Cargo in Zone


last1976

Recommended Posts

Cargo ---> Unit in Triggerzone.

 

The Condition is available but dont work as other Static Objects work I think something has just been forgotten.

i7-6700K / Msi Z170 Board / Kingston 32GB DDR4 / Msi GeForce GTX 980 4G / BQ STRAIGHT POWER 10 CM 700W / Fractal Define R5 Black / Alpenföhn "Brocken 2" / Samsung m2 980 Pro 1TB/ WD Blue 2TB / Windows 10 Pro

Link to comment
Share on other sites

  • 1 month later...

I did some further testing on this in the DCS Witchcraft Lua console.

I hope that by looking at which methods work and which don't, someone at ED who knows the implementation can narrow this down.

DCS Version: 1.2.14.36041

 

The reason for the trigger not working seems to be that getPosition() on a cargo object fails with an "Object doesn't exist" error (see below).

 

First, let's spawn a cargo object (code adapted from this mission):

local cargo_gid = 	10000
local cargo_uid = 11000
local cargo_name = "MyCargo"
local cargo_x = -317783.8125
local cargo_y = 19.547994613647
local cargo_z = 635431.625
local newCargo = {
	["groupId"] = cargo_gid,
	["category"] = "Cargos",
	["type"] = "Cargo1",
	["unitId"] = cargo_uid,
	["x"] = cargo_x,
	["y"] = cargo_z,
	["canCargo"] = true,
	["mass"] = 400,
	["heading"] = 0,
	["name"] = cargo_name,
	["dead"] = false,
	["country"] = "USA",
	["shape_name"] = "ab-212_cargo",
	}
coalition.addStaticObject(country.id.USA, newCargo)

 

This places a cargo object named "MyCargo" near the Kutaisi airport tower.

 

The following Lua snippets all raise an "Object doesn't exist" error:

  • return StaticObject.getByName("MyCargo"):getPosition()
  • return StaticObject.getByName("MyCargo"):getVelocity()
  • return StaticObject.getByName("MyCargo"):getCategory()
  • return StaticObject.getByName("MyCargo"):getPoint()
  • StaticObject.getByName("MyCargo"):destroy()

The following are snippets of Lua code (bold) and their return values (italic):

 

return StaticObject.getByName("MyCargo"):getName()

"MyCargo"

 

return StaticObject.getByName("MyCargo"):isExist()

false

 

return StaticObject.getByName("MyCargo"):getDesc()

{
   "attributes": {
       "Buildings": true
   },
   "category": 4,
   "displayName": "",
   "life": 0,
   "typeName": ""
}

 

return StaticObject.getByName("MyCargo"):getLife()

0

 

return StaticObject.getByName("MyCargo"):getID()

0

 

return StaticObject.getByName("MyCargo"):getCargoDisplayName()

" 400 kg"

 

return StaticObject.getByName("MyCargo"):getCountry()

99

 

return StaticObject.getByName("MyCargo"):getCoalition()

2

 

return StaticObject.getByName("MyCargo"):choosingCargo()

1

 

-- trying to enumerate the cargo object
-- (does not work, code is correct because
-- a radius of 3 found the Huey I had landed
-- next to it)
local cargo_x = -317783.8125
local cargo_y = 19.547994613647
local cargo_z = 635431.625

local objects = {}

local volume = {
   id = world.VolumeType.SPHERE,
   params = {
       point = {x = cargo_x, y = cargo_y, z = cargo_z},
       radius = 2
   }
}
local function handler(object, data)
   objects[#objects+1] = object
end

world.searchObjects({0,1,2,3,4,5}, volume, handler, nil)

return mist.utils.tableShow(objects)

{}

 



Edited by [FSF]Ian
Link to comment
Share on other sites

OK... Ian :-)

 

I'm familiar with Witchcraft to be able to place objects on the map and save the results -- to get exactly what I want for placement -- kudos for Witchcraft.

 

 

I have scripts in missions, and see the LUA button in Witchcraft but need an explanation of how to see my scripts execute? Can my scripts exe from within the mission, or do I have to paste the code into Witchcraft?

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Link to comment
Share on other sites

I have scripts in missions, and see the LUA button in Witchcraft but need an explanation of how to see my scripts execute? Can my scripts exe from within the mission, or do I have to paste the code into Witchcraft?

 

Executing a piece of Lua code from the DCS Witchcraft Lua Console has the same effect as executing it from a DO SCRIPT trigger action. In addition, if the code returns a value, it will be displayed in the Lua console.

 

This thread has a good example of witchcraft-assisted problem solving.

 

For further questions, please open a separate thread in the Mission Builder's Corner. Let's keep this one focused on squashing this particular bug.

Link to comment
Share on other sites

Somebody to test in the beta version if these issues are fixed in 1.2.15 beta. Because i don't think so they will be fixed already...

 

I could test myself, but just don't have the time right now.

 

Sven

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

With my subnormal intelligence, I see slingLoad behaves as if some object properties of the item cargo is not updated properly to a more general table nescessary for other functions? If it's just .lua call some file names and who knows..

 

We are motivated to make stuff for this brilliant game. Push us in the direction of the cause of this malfunction and maybe we can create our own temporary quickfix.

 

If it's cause is embedded in an untweakable .dll. So be it and I patently wait another 3 months.

 

Whatever it is, it is always nice to hear some reaction of a knowledgeable dev.

 

 

 

 

 

 

.


Edited by piXel496
Promise! I just say thanks and not flood with more questions.
Link to comment
Share on other sites

+1 I have several missions that have been on the bench because this particular trigger is broken.

Intel i9-9900KF @5.2GHz

MSI Z390 Gaming Pro Carbon

32GB G.Skill Trident Z DDR3200 RAM

MSI RTX 2080 Ti Gaming X Trio

40" Panasonic TH-40DX600U @ 4K

Pimax Vision 8K Plus / Oculus Rift CV1 / HTC Vive

Gametrix JetSeat with SimShaker

Windows 10 64 Bit Home Edition

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Ian;2332231']Still broken in 1.2.15.37241

 

Can we please get at least some acknowledgement that this is being worked on? This bug breaks existing missions.

 

It was fixed on an internal build, but it was to late to get it into 1.2.15. Hopefully there will be another patch for 1.2.15 with it.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

The open beta patch fixes the scripting functions for static objects, but the triggers are still broken.

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • 5 months later...

Now as half a year has gone. Its seems still to be broken. ED is aware of this ?

i7-6700K / Msi Z170 Board / Kingston 32GB DDR4 / Msi GeForce GTX 980 4G / BQ STRAIGHT POWER 10 CM 700W / Fractal Define R5 Black / Alpenföhn "Brocken 2" / Samsung m2 980 Pro 1TB/ WD Blue 2TB / Windows 10 Pro

Link to comment
Share on other sites

  • Recently Browsing   0 members

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