Jump to content

Grimes

ED Beta Testers
  • Posts

    9629
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Grimes

  1. On 5/26/2024 at 5:51 PM, Pizzicato said:

    I'm wondering if something changed in the last patch? The mission engine that I'm writing still works fine, but I've started seeing a bunch of MIST warnings in my DCS.log along the lines of:

    I will have to check it out. That error is from the database update scripts. Simply put the mist.DBs.X won't be updated with that object. 

    You can get me the table that you passed to coalition.addStaticObject that generated the error would be most helpful. Assuming you have lfs and io commented out in missionScripting.lua, this line will write a table to a file in your dcs/logs folder. 

    mist.debug.writeData (mist.utils.serialize,{'static', whateverTablePassedToAddStaticObject}, 'dbUpdateERror.lua')

    Or if you have other means of getting a serialized version of the table passed to the function. 

  2. Mist runs in the mission scripting env, not the export env. There are individual functions or functionality that you could probably cut and paste, or at least lightly modify, to work in the export env. But natively it would not run because it relies heavily upon functions from the mission env. 

  3. Nope. Gist of it is to use https://wiki.hoggitworld.com/view/DCS_event_shooting_start event to start calling https://wiki.hoggitworld.com/view/DCS_func_searchObjects on a point around the aircraft and every few milliseconds searching for weapons. You add any missing shells to a table. Use https://wiki.hoggitworld.com/view/DCS_event_shooting_end to stop the check for world.searchObjects. Meanwhile you have another function that runs however often you want checking, updating the position, and removing shells as they cease to exist. 

  4. Scripting is the primary way of interacting with weapons. Most often via the shot event to get the weapon object, then its up to you to decide what you want to do with that object. A few training scripts check the distance of the missile to its target and then remove the missile by calling an Object.destroy on it. On the Grayflag servers I use land.getIP on information from weapons to determine where a bomb or missile precisely impacted a runway section. 

    Unfortunately you can't create a weapon in air. The AI or a player has to launch the weapon from something. Then its up to whatever the guidance of that weapon to hit whatever it is targeting. 

  5. The problem with explosions is it isn't confined to the object you want to destroy. There are more options for units than you do scenery objects. You can use Unit.getbyName():destroy() to remove specific units. If you want you can spawn in dead statics at the same time. You can also go about it backwards where the group is set to probability 0% and then use a script to spawn in the group as needed. You check the saveState, see which units are alive, populate the group with those units while ignoring the ones that are dead, and spawn in the group via scripting. 

  6. 6 hours ago, Pizzicato said:

    That's an awesome tip. Thanks for that, Grimes.

    My Use Cases are typically around map objects and - ironically - it is the Kola map that I'm working with at the moment. In terms of the IDs changing as the map gets updated, do you happen to know if the fields in the associated Assign As trigger volumes get automatically updated when the map changes? I'd hope that the number in the trigger zone's OBJECT ID field is created by reference not copy, but maybe not.  

    It doesn't get updated. The association with the trigger zone and the object ends the moment the zone gets created. I've seen a few instances where the object that I created trigger zones over has been moved slightly or outright deleted. 

    • Like 1
    • Thanks 1
  7. If you know the object id and it is a valid object, then you can access it directly by mimicking the object table. For instance:

    local obj = {  ["_id"] = 13777728,}
    
    if Object.isExist(obj) then
        env.info(Object.getTypeName(obj))
    end

    If I recall it isn't treated 100% the same as if you got the object from an event. It hasn't actually inherited any of the functions, so obj:getTypeName() would error while Object.getTypeName(obj) is fine. If its a unit you could use getName and then pass that value to Unit.getByName() to make it a full on object. 

     

    A word of warning about map object ids. The id will change if the map gets updated and will now represent some other object or nothing at all. It would be wise to rely on checking the coordinate and object type to verify it is indeed the object you want. Obviously varies a bit on whether or not a map will likely get updates. You'd probably be fine to rely on the id number on older maps like NTTR while steering clear of that method on Kola. 

    • Thanks 2
  8. 3 hours ago, mytai01 said:

    Is it possible to control formation arrivals and departures?

    Nope. Once AI get into "airbase mode" they will rely solely on built in game logic to determine their formation and flight behavior. In the case of departures if the AI are set as take-off from runway they will take-off in pairs. If they ramp start they will taxi to the runway in flight order and take off in singles. For landings they will arrive at the base in whichever formation is set then enter a landing pattern. They will land in pairs as long as the runway is wide enough, though there are circumstances where then 2nd unit in formation might fail at getting into formation, at which point they will break off and land on their own. 

    • Like 2
  9. 2 hours ago, Pizzicato said:

    Hey all,

    Does anyone know which file holds DCS various enum definitions? I know that the Hoggit wiki has a bunch of info, but some of it is out of date, (e.g. the page for Reaction to Threat includes reference to the nonexistent Bypass and Escape enum, but not the Evasive Vertical Maneuver or Horizontal AAA Fire Evade enums.

    I can obviously access them by using the associated integer, but I'd like to be able to double-check this stuff for myself (assuming the files haven't been encrypted).

    Most of the entries can exist within assorted lua name spaces. For example coalition.side and coalition.service are just two tables within coalition that contain the enums that identify red and blue, and enums for ATC, tankers, etc. In this specific instance the enum values can literally be found in the AI.Option.Air.val.REACTION_ON_THREAT table. 

    image.png

    As you made note that the names aren't the same and AAA fire evade is missing. The former is mostly a localization thing. The name doesn't matter because the number value is what is used by the AI. ED have decided to reword/rephrase assorted parts of the mission editor, but the functionality remains the same. Also note it is "reaction on threat" in the enum but is named "reaction to threat" in the editor, the same thing is happening there.  As for why AAA fire evade is missing from the table, the sad fact is that not everything gets added to the AI or other tables when it exists in the game. Thus someone has to realize that the options exist and document it. 

    • Like 1
  10. It is limitation programmed into the mission editor that doesn't reflect how the game actually handles things. There is no great way around it. You can use the scripting engine to spawn an infinite number of aircraft throughout the mission runtime, but that is a little complex for some. However it gives you control of specifying to re-use a specific parking spot or to rely on the automatic assignment. If it is a multiplayer mission you can use "takeoff from runway" which, when the mission is run in MP, will place the units at the nearest parking spot to the runway. 

  11. Patterns are not something I find to be all that fun. I assume you are wanting to use it as a command of sorts where a player enters it via chat or F10 mark and it uses the inputs to call a function? I use this to get each word added to a table, then I use the table itself to manipulate or check the data. commands[1] is the command being issued and commands[2] could be an optional value, if it doesn't exist then use some default value. 

    	local commands = {}
    	for w in string.gmatch(event.text, "%w+") do
    		table.insert(commands, w)	
    	end



    I suppose you could make a pattern for each of the 3 cases and use if string.match(obj, pattern1) or string.match(obj, pattern2) or string.match(obj, pattern3) then print("good") end 

     

  12. The server API has finer detail on it via the onPlayerChangeSlot callback. The net functions are accessible in the server API and mission scripting, which you can use net.get_player_list and net.get_slot to get the slot, and therefore seat the players are in. You'd have to constantly be calling it unfortunately to get up to date information. The slot id is the unit id for a given unit with a _x to define the seat a player is in. For example in a F-15E, F-14, and AH-64 it would be unitId_2 for the WSO/CPG. unitId_3 and unitId_4 would be left gunner and right gunner in the Huey. There is no information currently on who initiated a given action. For stats in slmod I attribute it to everyone in the aircraft. 

    • Thanks 1
  13. Its related to how events are used. This specific event will not be addressed, I hope they create a new one, but alas scripting priorities seem to exist in peaks and valleys and we seem to be in Kansas. It is not a new issue.


    I believe I've explained it in some of the other threads, so I will be brief. All of the events are used by the game to tell other parts of the game something happened. You can think of most events as a "global" event that occurs for every single player in the mission. shot, dead, crash, birth, etc. There are some events that are "local" to your game and only occur when you do something. Other clients, and the server, don't get told about it via the events. Your friend should have the player_enter_unit event in their debrief.log while you won't see it. The fact that some are local was not clearly indicated. 

    • Thanks 1
×
×
  • Create New...