Search the Community
Showing results for tags 'scripting'.
-
Don't know when this happened, but I think it's very recent, but the event is no longer firing for either player aircraft skill level set to PLAYER or set to CLIENT. Attached are two missions using the same script (one for Single Player one for CLIENT/MP) If you look at the dcs.log you'll see that the event never fires. SinglePlayerSpawn.mizClientPlayerSpawn.miz Here's the script, it's loaded in each mission file by the DO SCRIPT command: MSB = { ["Version"] = "1.0.0" } function MSB:onEvent(event) env.info("MSB:onEvent Handler ENTERED", false) if event.id == world.event.S_EVENT_SHOT then env.info("MSB/OnEvent: ******* S_EVENT_SHOT *******", false) elseif event.id == world.event.S_EVENT_HIT then env.info("MSB/OnEvent: ******* S_EVENT_HIT *******", false) elseif event.id == world.event.S_EVENT_TAKEOFF then env.info("MSB/OnEvent: *******************************", false) env.info("MSB/OnEvent: ******* S_EVENT_TAKEOFF *******", false) env.info("MSB/OnEvent: *******************************", false) elseif event.id == world.event.S_EVENT_LAND then -- TODO env.info("MSB/OnEvent: ****************************", false) env.info("MSB/OnEvent: ******* S_EVENT_LAND *******", false) env.info("MSB/OnEvent: ****************************", false) elseif event.id == world.event.S_EVENT_CRASH then env.info("MSB/OnEvent: ******* S_EVENT_CRASH *******", false) elseif event.id == world.event.S_EVENT_EJECTION then -- TODO env.info("MSB/OnEvent: ********************************", false) env.info("MSB/OnEvent: ******* S_EVENT_EJECTION *******", false) env.info("MSB/OnEvent: ********************************", false) elseif event.id == world.event.S_EVENT_REFUELING then env.info("MSB/OnEvent: ******* S_EVENT_REFUELING *******", false) elseif event.id == world.event.S_EVENT_DEAD then env.info("MSB/OnEvent: ****************************", false) env.info("MSB/OnEvent: ******* S_EVENT_DEAD *******", false) env.info("MSB/OnEvent: ****************************", false) elseif event.id == world.event.S_EVENT_PILOT_DEAD then env.info("MSB/OnEvent: **********************************", false) env.info("MSB/OnEvent: ******* S_EVENT_PILOT_DEAD *******", false) env.info("MSB/OnEvent: **********************************", false) elseif event.id == world.event.S_EVENT_BASE_CAPTURED then env.info("MSB/OnEvent: ******* S_EVENT_BASE_CAPTURED *******", false) elseif event.id == world.event.S_EVENT_MISSION_START then env.info("MSB/OnEvent: *************************************", false) env.info("MSB/OnEvent: ******* S_EVENT_MISSION_START *******", false) env.info("MSB/OnEvent: *************************************", false) elseif event.id == world.event.S_EVENT_MISSION_END then env.info("MSB/OnEvent: ******* S_EVENT_MISSION_END *******", false) elseif event.id == world.event.S_EVENT_TOOK_CONTROL then env.info("MSB/OnEvent: ******* S_EVENT_TOOK_CONTROL *******", false) elseif event.id == world.event.S_EVENT_REFUELING_STOP then env.info("MSB/OnEvent: ******* S_EVENT_REFUELING_STOP *******", false) elseif event.id == world.event.S_EVENT_BIRTH then env.info("MSB/OnEvent: *****************************", false) env.info("MSB/OnEvent: ******* S_EVENT_BIRTH *******", false) env.info("MSB/OnEvent: *****************************", false) elseif event.id == world.event.S_EVENT_HUMAN_FAILURE then env.info("MSB/OnEvent: ******* S_EVENT_HUMAN_FAILURE *******", false) elseif event.id == world.event.S_EVENT_DETAILED_FAILURE then env.info("MSB/OnEvent: ******* S_EVENT_DETAILED_FAILURE *******", false) elseif event.id == world.event.S_EVENT_ENGINE_STARTUP then env.info("MSB/OnEvent: ******* S_EVENT_ENGINE_STARTUP *******", false) elseif event.id == world.event.S_EVENT_ENGINE_SHUTDOWN then env.info("MSB/OnEvent: ******* S_EVENT_ENGINE_SHUTDOWN *******", false) elseif event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then -- DOESN'T WORK FOR MP AND 'NEVER WILL' /FFS env.info("MSB/OnEvent: *****************************************", false) env.info("MSB/OnEvent: ******* S_EVENT_PLAYER_ENTER_UNIT *******", false) env.info("MSB/OnEvent: *****************************************", false) elseif event.id == world.event.S_EVENT_PLAYER_LEAVE_UNIT then env.info("MSB/OnEvent: ******* S_EVENT_PLAYER_LEAVE_UNIT *******", false) elseif event.id == world.event.S_EVENT_PLAYER_COMMENT then env.info("MSB/OnEvent: ******* S_EVENT_PLAYER_COMMENT *******", false) elseif event.id == world.event.S_EVENT_SHOOTING_START then env.info("MSB/OnEvent: **************************************", false) env.info("MSB/OnEvent: ******* S_EVENT_SHOOTING_START *******", false) env.info("MSB/OnEvent: **************************************", false) elseif event.id == world.event.S_EVENT_SHOOTING_END then env.info("MSB/OnEvent: ******* S_EVENT_SHOOTING_END *******", false) elseif event.id == world.event.S_EVENT_MARK_ADDED then env.info("MSB/OnEvent: ******* S_EVENT_MARK_ADDED *******", false) elseif event.id == world.event.S_EVENT_MARK_CHANGE then env.info("MSB/OnEvent: ******* S_EVENT_MARK_CHANGE *******", false) elseif event.id == world.event.S_EVENT_MARK_REMOVED then env.info("MSB/OnEvent: ******* S_EVENT_MARK_REMOVED *******", false) elseif event.id == world.event.S_EVENT_KILL then env.info("MSB/OnEvent: ******* S_EVENT_KILL *******", false) elseif event.id == world.event.S_EVENT_SCORE then env.info("MSB/OnEvent: ******* S_EVENT_SCORE *******", false) elseif event.id == world.event.S_EVENT_UNIT_LOST then env.info("MSB/OnEvent: ******* S_EVENT_UNIT_LOST *******", false) elseif event.id == world.event.S_EVENT_LANDING_AFTER_EJECTION then env.info("MSB/OnEvent: ******* S_EVENT_LANDING_AFTER_EJECTION *******", false) elseif event.id == world.event.S_EVENT_PARATROOPER_LENDING then env.info("MSB/OnEvent: ******* S_EVENT_PARATROOPER_LENDING *******", false) elseif event.id == world.event.S_EVENT_DISCARD_CHAIR_AFTER_EJECTION then env.info("MSB/OnEvent: ******* S_EVENT_DISCARD_CHAIR_AFTER_EJECTION *******", false) elseif event.id == world.event.S_EVENT_WEAPON_ADD then env.info("MSB/OnEvent: ******* S_EVENT_WEAPON_ADD *******", false) elseif event.id == world.event.S_EVENT_TRIGGER_ZONE then env.info("MSB/OnEvent: *****************************************", false) env.info("MSB/OnEvent: ******** S_EVENT_TRIGGER_ZONE *******", false) env.info("MSB/OnEvent: *** S_EVENT_TRIGGER_ZONE ***", false) env.info("MSB/OnEvent: ******** S_EVENT_TRIGGER_ZONE *******", false) env.info("MSB/OnEvent: *****************************************", false) elseif event.id == world.event.S_EVENT_LANDING_QUALITY_MARK then env.info("MSB/OnEvent: ******* S_EVENT_LANDING_QUALITY_MARK *******", false) elseif event.id == world.event.S_EVENT_BDA then env.info("MSB/OnEvent: ******* S_EVENT_BDA *******", false) elseif event.id == world.event.S_EVENT_AI_ABORT_MISSION then env.info("MSB/OnEvent: ******* S_EVENT_AI_ABORT_MISSION *******", false) elseif event.id == world.event.S_EVENT_DAYNIGHT then env.info("MSB/OnEvent: ******* S_EVENT_DAYNIGHT *******", false) elseif event.id == world.event.S_EVENT_FLIGHT_TIME then env.info("MSB/OnEvent: ******* S_EVENT_FLIGHT_TIME *******", false) elseif event.id == world.event.S_EVENT_PLAYER_SELF_KILL_PILOT then env.info("MSB/OnEvent: ******* S_EVENT_PLAYER_SELF_KILL_PILOT *******", false) elseif event.id == world.event.S_EVENT_PLAYER_CAPTURE_AIRFIELD then env.info("MSB/OnEvent: ******* S_EVENT_PLAYER_CAPTURE_AIRFIELD *******", false) elseif event.id == world.event.S_EVENT_EMERGENCY_LANDING then env.info("MSB/OnEvent: ******* S_EVENT_EMERGENCY_LANDING *******", false) elseif event.id == world.event.S_EVENT_UNIT_CREATE_TASK then env.info("MSB/OnEvent: ******* S_EVENT_UNIT_CREATE_TASK *******", false) elseif event.id == world.event.S_EVENT_UNIT_DELETE_TASK then env.info("MSB/OnEvent: ******* S_EVENT_UNIT_DELETE_TASK *******", false) elseif event.id == world.event.S_EVENT_SIMULATION_START then env.info("MSB/OnEvent: ****************************************", false) env.info("MSB/OnEvent: ******* S_EVENT_SIMULATION_START *******", false) env.info("MSB/OnEvent: ****************************************", false) elseif event.id == world.event.S_EVENT_WEAPON_REARM then env.info("MSB/OnEvent: ******* S_EVENT_WEAPON_REARM *******", false) elseif event.id == world.event.S_EVENT_WEAPON_DROP then env.info("MSB/OnEvent: ******* S_EVENT_WEAPON_DROP *******", false) elseif event.id == world.event.S_EVENT_UNIT_TASK_TIMEOUT then env.info("MSB/OnEvent: ******* S_EVENT_UNIT_TASK_TIMEOUT *******", false) elseif event.id == world.event.S_EVENT_UNIT_TASK_STAGE then env.info("MSB/OnEvent: ******* S_EVENT_UNIT_TASK_STAGE *******", false) elseif event.id == world.event.S_EVENT_MAC_SUBTASK_SCORE then env.info("MSB/OnEvent: ******* S_EVENT_MAC_SUBTASK_SCORE *******", false) elseif event.id == world.event.S_EVENT_MISSION_RESTART then env.info("MSB/OnEvent: ******* S_EVENT_MISSION_RESTART *******", false) elseif event.id == world.event.S_EVENT_MISSION_WINNER then env.info("MSB/OnEvent: ******* S_EVENT_MISSION_WINNER *******", false) elseif event.id == world.event.S_EVENT_POSTPONED_TAKEOFF then env.info("MSB/OnEvent: ******* S_EVENT_POSTPONED_TAKEOFF *******", false) elseif event.id == world.event.S_EVENT_POSTPONED_LAND then env.info("MSB/OnEvent: ******* S_EVENT_POSTPONED_LAND *******", false) elseif event.id == world.event.S_EVENT_MAX then env.info("MSB/OnEvent: ******* S_EVENT_MAX *******", false) end end function MSB.Initialise() world.addEventHandler(MSB) env.info("MSB LOADED", false) end MSB.Initialise()
-
env.mission has the following: -- date : table : The date the mission takes place at with Year, Month, and Day entries -- descriptionText : string : Mission briefing defined under the "Situation" page on the briefing panel -- descriptionBlueTask : string : Blue coalition task defined on the briefing panel -- descriptionNeutralsTask: string : Neutral coalition task defined on the briefing panel -- descriptionRedTask : string : Red coalition task defined on the briefing panel -- drawings : table : Table containing information on any drawing placed in the editor. -- pictureFileNameN : table : Neutral coalition briefing images -- pictureFileNameB : table : Blue coalition briefing images -- pictureFileNameR : table : Red coalition briefing images -- result : table : Conditions and actions defined by mission goals in the editor to decide if a mission is "won" -- start_time : number : Time in seconds since midnight for the date set when the mission starts -- sortie : string : Name of the mission as defined in the briefing panel. -- theatre : string : Name of the map the mission takes place on Almost everything in this list is able to be accessed through lua/scripting Engine, but for these three: pictureFileNameN pictureFileNameB pictureFileNameR Instead of getting the actual picture image (found in l10n/DEFAULT/<imageName>.<extension>), what is returned is an obfuscated 'ResKey' for it. Because there is no way to use the 'ResKey' in it's place, it means that for these three items only, they are hidden from the scripting environment (and I can't see a good reason why). There is no equivalent 'getValueByKey' for objects in the mapResource file. Could these be 'un-obfuscated' or could an additional command be added to retrieve the actual file url from the 'ResKey' Thanks
-
- mission editor
- scripting engine
-
(and 3 more)
Tagged with:
-
Assuming that nothing in the Mission Editor has been setup i.e. naming the Pilot something with 'RIO' in their playerName etc. Is it even possible from when they just into the back seat to know that they aren't the pilot from an onBirth or onEnterUnit event - obviously this is in MP or even dedicated server environment.
-
Both in the net singleton and elsewhere we are able to the the string of the 'playerName' but nowhere can we get the playerID with the exception of iterating around net.get_player_list( ) for a playerName match. That seems inefficient. If we supply a playerName string to net, we should be able to get either the playerID back, or even use net.get_player_info(string playerName as a polymorphic alternative. Alternatively the net.get_my_player_id( ) shouldn 't always return 1 on a server, but should take a parameter of 'playerName' and return the playerID that matches that playername.
-
At the moment, we need to create a load of custom waypoints for a unit or group to force it onto a specific heading (mag or true), we're reproducing what the engine already does probably much more efficiently that we can. So why can't we just pass a heading(either true or mag if the bool is true) to a Unit or Group (air/sea/land) and just let the engine plot it out for us? Thanks
-
- 1
-
- mission editor
- scripting
-
(and 1 more)
Tagged with:
-
I'm using the following in my ATIS script local weather = env.mission.weather local cloudCover = api.TUC.GetCloudCoverAsString(false) local cloudBase = api.TUC.MetresToFeet(weather.clouds.base) local thickness = api.TUC.MetresToFeet(weather.clouds.thickness) local visibility = weather.visibility.distance local fogThickness = api.TUC.MetresToFeet(weather.fog.thickness) local fogVisibility = weather.fog.visibility local dustDensity = api.TUC.MetresToFeet(weather.dust_density) Everything looks okay except that the THICKNESS which I'm led to believe from the documentation on hoggitworld is for the lowest cloudbase, ALWAYS reports the same amount of 656ft, regardless of the weather preset used and how thick the cloudbase is to fly through. Am I using this correctly or is this a bug? Cross posted in the Weather System bug list just in case it's not a scripting error.
-
I am working on a mission and I need an enemy warehouse (made from static units) to be respawnable. Only some of the units that I try to respawn actually do, here is the code I wrote: function rmBaseDamage(baseID) local statics = {} for i = 1,21 do --there is 21 total statics per base local static = StaticObject.getByName(bases[baseID].name.."-"..i) --finds the statics by name statics[#statics+1] = i if static ~= nil then local pos = static:getPosition() heading = math.atan2( pos.x.z, pos.x.x ) local desc = static:getDesc() local groupData = { x = pos.p.x, y = pos.p.z, heading = heading, name = static:getName(), type = desc.typeName, } static:destroy() mist.scheduleFunction(coalition.addStaticObject, {country.id.USA, groupData}, timer.getTime() + 2) else tss.utils.message(""..i) end end tss.utils.message(statics) bases[baseID].damaged = nil end The issue happens on line 4 where I find the units by using StaticObject.getByName. I have checked their name a thousand times, and they are correct, yet still only some of the units respawn. I don't know if its intended that dead units are accessible via StaticObject.getByName, but if it is intended then it doesn't seem to work consistently. For what I can tell, it seems this issue only happens with certain unit types. Almost every truck doesn't work, but most of the structures do respawn fine. null Regardless of it being a bug or not, is there any other way to access and delete dead static objects? Thanks, Dirt
- 6 replies
-
- script issue
- scripting
-
(and 1 more)
Tagged with:
-
2024-03-15 15:03:25.614 INFO TLC (Main): onEvent ENTERED 2024-03-15 15:03:25.614 INFO TLC (Main): ******* S_EVENT_PLAYER_LEAVE_UNIT ******* 2024-03-15 15:03:25.615 INFO TLC (Main): onEvent ENTERED 2024-03-15 15:03:25.615 INFO TLC (Main): ******* S_EVENT_PLAYER_LEAVE_UNIT ******* Can anyone else confirm this bug?
-
I'm using the following in my ATIS script local weather = env.mission.weather local cloudCover = api.TUC.GetCloudCoverAsString(false) local cloudBase = api.TUC.MetresToFeet(weather.clouds.base) local thickness = api.TUC.MetresToFeet(weather.clouds.thickness) local visibility = weather.visibility.distance local fogThickness = api.TUC.MetresToFeet(weather.fog.thickness) local fogVisibility = weather.fog.visibility local dustDensity = api.TUC.MetresToFeet(weather.dust_density) Everything looks okay except that the THICKNESS which I'm led to believe from the documentation on hoggitworld is for the lowest cloudbase, ALWAYS reports the same amount of 656ft, regardless of the weather preset used and how thick the cloudbase is to fly through. Am I using this correctly or is this a bug?
-
In open beta 2.8.6.41363, the behavior of S_EVENT_REFUELING and S_EVENT_REFUELING_STOP have changed. Single player still behaves the same as prior builds, but multiplayer has changed significantly. In single player mode, when USER connects to TANKER, event S_EVENT_REFUELING fires. The event.initiator is the USER's unit. When the USER disconnects, event S_EVENT_REFUELING_STOP fires. That event.initiator is also the USER's unit. The behavior is the same for both single threaded and multi threaded clients. This is consistent behavior as observed in prior builds. Multi player used to work the same way. But in 2.8.6.41363 the online behavior has changed. Now, when a USER connects to TANKER, event S_EVENT_REFUELING fires but the event.initiator is the TANKER instead of the USER. Furthermore, when the USER disconnects two S_EVENT_REFUELING_STOP events fire. The first lists the TANKER as the event.initiator. The second lists the USER as the event.initiator. Prior to 2.8.6.41363, start and stop events with the USER as the initiator fired in both online and offline play. Now, without an event indicating when the USER initiated refueling, it's impossible to monitor (and grade) the duration of players' refueling attempts. Please re-institute an S_EVENT_REFUELING event with the USER as the initiator in the multiplayer environment, to be consistent with both offline play and prior builds. ----Attachments--- Here are the relevant lines from the log file. Note the first line shows refueling started with the S-3 as the initiator. Then there are two refueling stop events, one for the tanker and one for the hornet. Server track file is also attached. 2023-07-05 03:14:22.571 INFO Scripting (Main): event:initiator_unit_type=S-3B Tanker,type=refuel,initiator_object_id=16894209,initiator_ws_type1=1,t=178.416,initiator_coalition=2,initiatorMissionID=1768, 2023-07-05 03:14:22.571 INFO APP (Main): wcTanker::onEvent:6 2023-07-05 03:14:22.571 INFO EDCORE (Main): (wcTanker::Channel)enterToState_:4 2023-07-05 03:14:25.591 INFO APP (Main): wcTanker::onEvent:9 2023-07-05 03:14:25.591 INFO EDCORE (Main): (wcTanker::Channel)enterToState_:5 2023-07-05 03:14:34.763 INFO APP (Main): wcTanker::onEvent:10 2023-07-05 03:14:34.763 INFO EDCORE (Main): (wcTanker::Channel)enterToState_:4 2023-07-05 03:14:34.763 INFO Scripting (Main): event:initiator_unit_type=S-3B Tanker,type=refuel stop,initiator_object_id=16894209,initiator_ws_type1=1,t=190.609,initiator_coalition=2,initiatorMissionID=1768, 2023-07-05 03:14:34.763 INFO APP (Main): wcTanker::onEvent:7 2023-07-05 03:14:34.763 INFO Scripting (Main): event:initiator_unit_type=FA-18C_hornet,type=refuel stop,initiatorPilotName=Thunk,initiator_coalition=2,initiator_ws_type1=1,t=190.609,initiator_object_id=16779010,initiatorMissionID=1767, server-20230704-211052.trk
-
Hey guys I recently made a mission that uses radio commands to spawn air units infinitely and it works great. The only thing i want to learn is how to add radio commands using scripts as opposed to triggers in the mission editor. I tried messing around with some of the scripts on the mist website like... local requestM = missionCommands.addSubMenu('Request Asset') local rSead = missionCommands.addCommand('SEAD', requestM, doRequestFunction, {type = 'SEAD"}) local rCAS = missionCommands.addCommand('CAS', requestM, doRequestFunction, {type = 'CAS"}) local rCAP= missionCommands.addCommand('CAP', requestM, doRequestFunction, {type = 'CAP"}) ...but for the life of me i cant figure it out. can someone help this make sense to me? I can add the sub menu however the commands always return an error. I attached my miz file to show you what im working with. Its a great mission i just want to get to that next level and do some more complex scripting. Thank you Syria dynamic AA.miz
-
I am building a motor driven cyclic to provide variable centering torque and trim position, and one of the key goals is to have the stick follow the co-pilot stick when the co-pilot is flying (either when 'autopilot' or in multiplayer) - in the real Huey the two sticks are mechanically linked so the always follow each other, and linking them in the game means that way when you take back control the stick is already in the right place. However I have not been able to find any exportable data for the stick position. (This may be specific to the Huey, I'm not sure, but I imagine the it should probably be common to all aircraft) The list_cockpit_params() lua function returns BASE_SENSOR_STICK_PITCH_POS and BASE_SENSOR_STICK_ROLL_POS, but it is just a reflection of the pilot stick input - when in 'autopilot' it continues emitting the pilot stick input position (ie. my joystick position), not the copilot stick position that is actually controlling the aircraft. When you show the control positions overlay, it is the position of the white copilot diamond I want, not the one that moves with my own stick. This data is obviously there somewhere as it is used to display on the controls overlay and also used to animate the cyclic position when in 'autopilot' mode - the question is, is it accessible from a lua script? Any ideas, anyone?
-
For immersion reasons, I'd like to make it so that when I start playing a mission, some buildings are already pre-destroyed if you will, or otherwise set on fire. The alternative appears to mean using AI or something to blow up the buildings I wanna blow up before I start flying (or driving since I have Combined Arms). Any advice on what sort of trigger zone to use, what lines of code I must enter, and where?
- 4 replies
-
- mission editor
- destructible
-
(and 4 more)
Tagged with:
-
Strange one. In this test miz I drew a blue and a green circle through the ME draw tool. In between those I drew a red circle with script: local ref = trigger.misc.getZone("targetArea") trigger.action.circleToAll(-1 , 1, ref.point , ref.radius , {0, 0, 0, 0} , {1, 0, 0, .7} , 0 , true) Then Escape and go to the "Message History" dialog. Notice when the dialog comes up, since it is semi-transparent, you can see the two circle from the draw tool are there but the circle drawn with CircleToAll is vanished. If you hit "close" button on the message history dialog, the missing circle stays vanished. If you hit escape to bring up the mission paused dialog and then escape again, it cleans it up and shows the missing circle again. If you hit screen capture it also brings back the vanished circle which is why I didn't include any example images. (See attached test miz.) Thanks in advance. TestDrawings.miz
-
I swear to Zeus this is killing me.. I have tried setting up an event handler to take certain actions when a unit dies, but is constantly running in to bugs. I have tried DEAD, KILL, UNIT_LOST and BDA with similar issues of initiator and target randomly not having any values (returning nil even though it should be there). In testing it seems BDA is the least likely one to throw errors. My suspicion is that since it is evaluated faster than DEAD and UNIT_LOST, it may get in and grab the values before they are removed from the table in memory.. Below is an example of what I am trying to do at the moment: local unitReport = {} local _mrkID = 1000 function unitReport:onEvent(event) if (world.event.S_EVENT_BDA == event.id) then local _objectSide = event.target:getCoalition() local _deadUnitName = event.target:getName() local enmyPt = event.initiator:getPoint() --buggy line local _enmyType = event.initiator:getTypeName() local _enmyWPN = event.weapon:getTypeName() if _objectSide == 2 then trigger.action.outText(_deadUnitName..' is hit!', 2) _spottingChance = math.random(1,10) if _spottingChance > 6 then trigger.action.markToCoalition(_mrkID,'enemy contact: '.._enmyType,enmyPt,2,false) _mrkID = _mrkID + 1 end end end end and attached is the error I'm getting. I have also experienced similar nil value issues when trying to access the killed unit, as if the program already forgot it was there.. Any help would be hot!
-
When you make script, you have one function to make an explosion : trigger.action.explosion(table vec3 , number power ) But it could be interessing to have different type of explosion by trigger. For example : trigger.action.clusterExplosion(table vec3 , number radius ) to make a cluster bomb effect on a zone. Cluster bombs have a specific fx we can't reproduce without munition. Same for Napalm explosion, when Napalm will be release ! We want to have more FX to use !
-
Hello everyone, I am trying to create a script that changes the destination of an AI plane group once a specific flag is on but I cannot find the proper action/function for it. The main idea behind it is that once an F10 menu command is selected the previously spawned cargo plane would fly, land and eventually despawn at the selected airbase so that its cargo can be added in the warehouse of the airport. Due to the big amount of different cargoes and destinations it's too time-consuming to add 80 different groups that fly and have different destinations and cargo, so I was thinking that something like that would be easier to manage. Does anyone know how this can be accomplished? I am also accepting suggestions on how to do it differently.
-
Currently objects in the LUA scripting environment have a getDesc() method that returns various information about the object in question. In the case of Units I would like to propose an additional attributes, specifically the units maximum engagement and sensor ranges (the numbers that inform the red/yellow circles on the F10 map/in the editor basically), enagement range information is somewhat available for missiles through getAmmo() but the same info is not present for ballistic weapons, and in the case of detection range getSensors() works for specific sensors but returns nil for any units that dont have any sensors beyond the mk1 eyeball. This would allow much more dynamic and interesting behaviour from scripts without having to independently maintain this information or load it as part of the scripts in question
-
Hey ED, Whilst this is somewhat Apache specific for the moment, I decided general as it's an API issue With the introduction of the Apache and mixed Launcher loadouts the getAmmo does not return the correct ammo quantity. Reproduction: Loaded: M261 - 19 x Hydra 70, Pod Zones: C - M274; D/E - M151 Unit:getAmmo() reports 19 x M151 - This should return 12 M274 and 7 M151 After firing 1 x M151 and 2 x M274, the EVENT_SHOT shows the correct missile launched, and as you can see in my WPN page we now have 10 M274 and 6 M151, while getAmmo() reports 16 M151 Hopefully this image has all the information required without a track as the track wouldn't show anything other than the loadout Thanks, Martin
-
Specifically with regards to Unit.getByName("Huey3") Huey3 is the unit (and group) name, of the helicopter that is crashed by a player. The error messages continue until the player respawns. The script works as intended, until the destruction of a unit referenced in it. The script: local flagValue = trigger.misc.getUserFlag("52") local LockFlag = trigger.misc.getUserFlag("53") -- to stop infinite loops and 9999+ F10 options local TransGroup = Group.getByName("Lancer-6") local TransUnit = Unit.getByName("Lancer-6") local TransUnitPos = TransUnit:getPosition() local InitUnit = Unit.getByName("Huey3") local InitUnitPos = InitUnit:getPosition() local InitUnitAGL = InitUnitPos.p.y - land.getHeight({x=InitUnitPos.p.x, y = InitUnitPos.p.z}) local InitGroup = Group.getByName("Huey3") local InitID = Group.getID(InitGroup) local InitTransDis = mist.vec.sub(InitUnitPos.p, TransUnitPos.p) if ((InitTransDis.x <= 50 and InitTransDis.x > 0) or (InitTransDis.x < 0 and InitTransDis.x >= -50)) and ((InitTransDis.z <= 50 and InitTransDis.z > 0) or (InitTransDis.z < 0 and InitTransDis.z >= -50)) -- If distance between transporter (helo) and transportable (ground unit) is within a 100m flat radius and LockFlag == 0 and InitUnitAGL <= 15 and InitUnit:getVelocity().x <= 5.55555 and InitUnit:getVelocity().y <=10 and InitUnit:getVelocity().y >= -10 then trigger.action.addOtherCommandForGroup(InitID,"Pick up LANCER-6 (HMMWV-TOW)","52","1") trigger.action.setUserFlag("53",1) -- lock flag for antispam elseif not (((InitTransDis.x <= 50 and InitTransDis.x > 0) or (InitTransDis.x < 0 and InitTransDis.x >= -50)) or ((InitTransDis.z <= 50 and InitTransDis.z > 0) or (InitTransDis.z < 0 and InitTransDis.z >= -50))) then trigger.action.removeOtherCommandForGroup(InitID,"Pick up LANCER-6 (HMMWV-TOW)") -- trigger.action.outText("FALSE",20) -- debug line trigger.action.setUserFlag("53",0) end -- lock disable if flagValue == 1 then -- This is the pickup process of Lancer-6 by Huey3 TransGroup:destroy() trigger.action.setUserFlag("52",2) trigger.action.removeOtherCommandForGroup(InitID,"Pick up LANCER-6 (HMMWV-TOW)") trigger.action.setUnitInternalCargo("Huey3",900) trigger.action.outTextForGroup(InitID,"LANCER-6 (HMMWV-TOW) LOADED",10) end if flagValue == 2 and LockFlag == 0 and InitUnitAGL <= 15 and InitUnit:getVelocity().x <= 5.55555 and InitUnit:getVelocity().y <=10 and InitUnit:getVelocity().y >= -10 then -- This gives the dropoff option if parameters are met, or disables it if not trigger.action.addOtherCommandForGroup(InitID,"Drop off LANCER-6 (HMMWV-TOW)","52","3") trigger.action.setUserFlag("53",1) -- lock flag for antispam elseif flagValue == 2 and (InitUnitAGL >= 15 or InitUnit:getVelocity().x >= 5.55555 or (InitUnit:getVelocity().y >=10 and InitUnit:getVelocity().y <= -10)) then -- This removes the dropoff option if parameters are not met trigger.action.removeOtherCommandForGroup(InitID,"Drop off LANCER-6 (HMMWV-TOW)") trigger.action.setUserFlag("53",0) end -- lock disable if flagValue == 3 then -- Drop off execution mist.respawnGroup("Lancer-6", true) local InitUnitLoc = InitUnit:getPosition().p local InitUnitDir = InitUnit:getPosition().z local InitSPWN = mist.vec.add(InitUnitLoc, mist.vec.scalar_mult(InitUnitDir, 7)) mist.teleportToPoint({gpName="Lancer-6", point=InitSPWN, action="teleport"}) trigger.action.removeOtherCommandForGroup(InitID,"Drop off LANCER-6 (HMMWV-TOW)") trigger.action.outTextForGroup(InitID,"LANCER-6 (HMMWV-TOW) UNLOADED",10) trigger.action.setUnitInternalCargo("Huey3",0) trigger.action.setUserFlag("52",0) end -- resets loop In the editor, this script in run in a (continous trigger) > (2 seconds) and (Group Exists "Huey3") > (The script) After some testing, trying other ways of stopping script execution on death, I have discovered that even though the (Group Exists) condition is no longer met, the script continues executing, and I can't figure out why. This leads to pop-up error messages, repeatedly. As seen in picture below. My DCS log file is attatched. dcs.log
-
Hello everybody. I am not sure this is the right spot to post my questions, but I am quite new both to DCS and the forum. Leveraging on 30 years of Air Force experience, I have been contacted to develop BFM/AFM and BVR training scenarios. Mission Editor helps, but I am still struggling with some controls. Cutting to the chase… Is there a way to: - Make red air (AI) notch (turn approx 90 degrees off the initial heading) at a pre-determined distance? I get the trigger/moving trigger zone, the problem is the specific action - Make red air (AI) commit on condition (eg. X many seconds after the notch or at a specific distance) - Make red air (AI) resume CAP if blue air “strays” I have been dabbing with Combined Arms (it CAN control Air Assets as well as Ground) but it becomes a challenge with multiple units (it’d be easier to play the Flight of the Bumblebee on a piano!) Thanks for your help. By the way: I have zero scripting skills. P.S.: I might repost this in other pages, as I attempt to discover more suitable Topics headers, digging in the forum.
-
I would imagine ED is aware of what the next level of immersion on the deck is, crew not just stationary, but kneeling, interaction with other crew (moving arms/hands as if communicating) moving between aircraft and work areas, driving tows/tractors, AI pilots entering exiting aircraft etc. The scripting is already there in the launch crew (great job btw). This would be a big step forward. Also some scripting templates to use in ME to populate the deck based on what type of tasks the mission you want to build needs and much more simple way to spawn aircraft in the parking spots preferred.
- 5 replies
-
- 6
-
- supercarrier
- deck crew
-
(and 1 more)
Tagged with:
-
Am I correct in thinking there is no script access to the Resource Management? Even read-only? Are there ways to interact with the Resource Management through unit spawning/despawning? If not, what is the intention behind the Resource Management system, beyond the restriction of player loadouts?
-
As CL says: MP. A client's game will crash if they try to open the F10 map after a markup or shape object has been added via the scripting engine - fixed. In deeds clients does not crash anymore and shapes are created correctly using trigger.action.arrowToAll() and trigger.action.circleToAll() The only proble seems to be that arrows are bounded to the view and if you scroll the map after creating an arrow it will move from its position following the view. This does not happens with circles.