Jump to content

Recommended Posts

Posted

hi,

 

 

i already know how to hide delete a static objet with:

StaticObject.getByName('rescuer_stretcher'):destroy()

 

 

in game this is simulating a static object "stretcher body" boarding my mi8, i would like the opposite spawning a static object so i can simulate a stretcher unloading my cargo.

 

 

unfortunately there is no activate or late activation with static object.

Posted

One solution is to place the static at a remote map location and use scripting, like MOOSE, to spawn a copy of the static when/where you want it. So many things possible/easier with scripting. Other solutions may exist. Example MOOSE code:

 

 

 

ZonePosition = ZONE:New( "Creech" )   -- Initialize zone "Creech" created in ME

SpawnPlane = SPAWNSTATIC:NewFromStatic( "C17_Disabled", country.id.USA )  -- Define object from ME group C17_Disabled

SpawnPlaneVec2 = ZonePosition:GetPointVec2()   -- Returns (Vec2) position of zone center

PlanePos =  SpawnPlaneVec2:Translate( 250, 272 )  -- This optional will offset the spawn location from zone center by 250m bearing 272D

C17 = SpawnPlane:SpawnFromPointVec2( PlanePos, 70 )

Posted

You don't need Moose or a static already in place to spawn it.

CTLD does this very well with only MiST.

I advise having a look in its code

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Posted

im not enough good in lua scripting to use moose or mist but i found another script that works for me

 

 

 

local staticObj = {

["heading"] = 0,

["groupId"] = 3,

["shape_name"] = "rescuer_stretcher",

["type"] = "rescuer_stretcher",

["unitId"] = 3,

["rate"] = 100,

["name"] = "blesse",

["category"] = "Fortifications",

["y"] = 709525,

["x"] = -308713,

["dead"] = false,

}

 

coalition.addStaticObject(country.id.USA, staticObj)

  • 1 year later...
  • 2 years later...
Posted (edited)
9 hours ago, sarumax said:

Hi, how can I obtain those x and y coordinates from the map editor? or from a trigger? and how to set the altitude?

There are lots of examples that include this already if you search this forum.

You just have to search for this command on the forum:

https://wiki.hoggitworld.com/view/DCS_func_getZone

and this:

https://wiki.hoggitworld.com/view/DCS_func_getHeight

 

Example here:

https://forum.dcs.world/topic/168212-mission-for-training-the-basics/#comment-3354088

 

https://forum.dcs.world/topic/118275-adding-timing-funtion/#comment-2442714

 

In short, you get the zone and just pull the x and y coordinates out of it.

-- from links above and hoggit
WP1 = trigger.misc.getZone('BNE_WayPoint_1')
trigger.action.outText(WP1.point.x,20)
trigger.action.outText(WP1.point.z,20)
trigger.action.outText(WP1.radius,20)
trigger.action.outText(WP1.point.y,20)

WPHight= land.getHeight({x = WP1.point.x, y = WP1.point.z}) -- since its a trigger zone and its not in the air, you get the land hight on the point.

 

Edited by Kanelbolle
Posted

I'm sorry  I dont actually understand how to set the coords for the static object, see anythign wrong?

 

I've created this funcs but the coords are not good

 

function SpawnStaticObject (objectName, triggerName)
    local zone = trigger.misc.getZone(triggerName)

    local staticObject = {
        ["heading"] = 0,
        ["groupId"] = 99,
        ["shape_name"] = "Orca",
        ["type"] = "Orca",
        ["unitId"] = 99,
        ["rate"] = 100,
        ["name"] = objectName,
        ["category"] = "Structures",
        ["y"] = zone.point.y,
        ["x"] = zone.point.x,
        ["dead"] = false
    }

    coalition.addStaticObject(country.id.USA, staticObject)
end

function DestroyStaticObject(objectName)
    StaticObject.getByName(objectName):destroy()
end

Posted (edited)
6 hours ago, sarumax said:

see anythign wrong?

 

addStaticObject uses an XY based coordinate system (a 2D map), while objects in the game have XYZ world 3D coordinates. You are spawning the object at the  Y coordinate from the world, which is it's altitude. Change

 ["y"] = zone.point.z,

and it should work. I also recommend that you drop the attributes groupId and initId, they will be assigned automatically.

Edited by cfrag
  • Thanks 1
Posted
47 minutes ago, sarumax said:

and what would be the altitude for the static object?

DCS isn't very sophisticated in this regard. Objects are placed at current ground level. Some will stack on objects that are already there, others inside each other. Since you seem to be putting an orca into the sea, it will be close to the surface. If you place it on land, well...

 

  • Thanks 1
  • Recently Browsing   0 members

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