Babok Posted May 12, 2020 Posted May 12, 2020 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.
Habu_69 Posted May 12, 2020 Posted May 12, 2020 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 )
davidp57 Posted May 14, 2020 Posted May 14, 2020 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 !
Babok Posted May 14, 2020 Author Posted May 14, 2020 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)
gmangnall Posted February 23, 2022 Posted February 23, 2022 How the hell do you make the object hidden in the planner. I know the code is "hidden=true"....but what else is needed and where
sarumax Posted August 16, 2024 Posted August 16, 2024 Hi, how can I obtain those x and y coordinates from the map editor? or from a trigger? and how to set the altitude?
Kanelbolle Posted August 16, 2024 Posted August 16, 2024 (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 August 16, 2024 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
sarumax Posted August 17, 2024 Posted August 17, 2024 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
cfrag Posted August 17, 2024 Posted August 17, 2024 (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 August 17, 2024 by cfrag 1
sarumax Posted August 17, 2024 Posted August 17, 2024 and what would be the altitude for the static object?
cfrag Posted August 17, 2024 Posted August 17, 2024 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... 1
Recommended Posts