-
Posts
9668 -
Joined
-
Last visited
-
Days Won
11
Content Type
Profiles
Forums
Events
Everything posted by Grimes
-
That will error once the actual object is destroyed because it would basically be nil:getLife(). Anyway, I added a test message that will display the life value as a message. Bomb the target to get an idea of how much damage whichever weapon you are using does to the target. Also Object.destroy() just removes it from the world. If you wanted to explode it you'd need something like: trigger.action.explosion(unit:getPoint(), 3000) local unit = StaticObject.getByName('Static') trigger.action.outText(unit:getLife(), 20, true) --- just added this so you can see what the value is. Just delete whenever. if unit and unit:getLife() < 100 then unit:destroy() end
-
By virtue of it occurring in MP but not SP, it might be a good idea to just delay the execution of the script by half a second. There have been issues in the past when running scripts executed via events where not everything was accessible at that exact moment the event occurred or caused crashes. It really could just be something as benign as a client's heading isn't fully synced at the birth event, so it returns a heading of 000 if you check it the exact moment it spawns in. So just schedule a function with the passed event data to it to occur very shortly in the future. Honestly don't know if there is a specific delay needed or just any delay. I've seen crashes/bugs occur when executed with the event, but were fine if scheduled 0.01 seconds after the event.
-
Can you output blocks of text without it being on a single line.
Grimes replied to AKA_Clutter's topic in Mission Editor
Oh something like notepad++. Most of them do have word wrap but it is a factor of the size of text and monitor resolution. You could have over 200 characters on a line easily unless you make the window take up less horizontal space. Just combining it like you did there works best. -
Can you output blocks of text without it being on a single line.
Grimes replied to AKA_Clutter's topic in Mission Editor
Some of the special characters for formatting in lua work in DCS. Specifically \n inserts a new line. If you have a known string you can just add \n anywhere you want in there. Concatenating a string together also works well, either with \n being its own value or part of a string. If it is going to be more than half a dozen values I don't like doing a .. b .. c as it is just easier add everything to a table and then use table.concat(m) to build the string. Supposedly it is also faster or more efficient. So for example this is copied from a mission that displays target coordinates for an objective. Iterates the list of coordinates and adds a new line if there is another coordinate to display. if nMsg.tgtCoords then m[#m+1] = findFile(s, 'Standby for coordinates') m[#m+1] = ', ' m[#m+1] = findFile(s, 'Over') m[#m+1] = '.' m[#m+1] = '\n\n' m[#m+1] = 'Target Information and Coordinates \n' for j = 1, #nMsg.tgtCoords do m[#m+1] = nMsg.tgtCoords[j] if j < #nMsg.tgtCoords then m[#m+1] = '\n' end end m[#m+1] = '\n\n' end -
Possible, in a roundabout way, yes. Practical? To be honest not really. For starters the trigger UI has no knowledge of groups that are added via scripting. Your AI Push Task is to just for that one group. Just like if you used copy and paste in the editor you would have to add that action for each group. Since triggers are in the miz file it is possible to iterate through them so if you clone a group it checks to see if any triggers exist for that group or units and add it to equivalent logic via lua that it keeps checking. Maybe there is a use case for a function that registers and monitors data regarding specified groups. But it is niche of niche. At the same time pretty much every action can be done directly via lua and account for the cloned groups easily enough. local clonedGroups = {} local function changeROEInZone(val) for i = 1, #clonedGroups do if Group.getByName(clonedGroups[i]) and Group.getByName(clonedGroups[i]):getSize() > 0 then Group.getByName(clonedGroups[i]):getController():setOption(0, val.roe) end end end missionCommands.addCommand("ROE Weapons Free" , nil , changeROEInZone , {roe = 2}) missionCommands.addCommand("ROE Weapons HOOOOOOLD" , nil , changeROEInZone , {roe = 4}) for i = 1, 10 do local gp = mist.cloneInZone('someGroup', 'aZone') table.insert(clonedGroups, gp.name) end
-
Understanding defining your own functions and calling them in DCS.
Grimes replied to AKA_Clutter's topic in Mission Editor
Yes once a function is declared it is accessible based on the locality it was defined in. Basically it'll be global as long as you don't add local in front of it. Also in lua it matters that it is local and not Local, capitalization matters. -
If its like the mist function of getting skill it is just looking up a known value in a database for whatever was used in the mission file or spawned via a its own spawn functionality so it is aware of what the skill was set to. But yeah there isn't a Unit.getSkill function at present. Your best bet would be to spawn them with a randomized value that you know of. So it isn't the random skill but you choose between average, good, high, or excellent. Then your script knows the skill level assigned to that specific unit that you spawned which you can reference in your messaging.
-
The hoggit wiki and the DCS_controlAPI.html are about it. Its like if you modified any other file from the game. It all gets loaded once as the game loads. I suppose you could have your hooks call code that is executed from another file and then command that file to be reloaded on something like a mission change. So have some file make a global function that the hook calls. If you reload that file with the global function it will redefine what the hook calls. However my answer to your last question also applies for this. No you can't. But what you can do is run two instances of DCS on your PC at the same time. One is rendered with a UI and the other is a dedicated server. Dedicated servers tend to start up faster, will load directly into the last ran mission, and you can keep your rendered version on the MP UI to quickly re-join the server. Actually if you disconnect from the server, stop the server, don't refresh the server list, and then restart the server it should still be a valid option in your list and you can just instantly rejoin it. This is how I test slmod or in general any other server side issues. Likewise you can leverage the fact that it will re-load a mission on startup so you can make your change and just restart the server. Alternatively you can keep the server online, switch it to an alternative mission while you change something in the editor, then when ready have the server load that mission again. To run headless copy of the game on your PC you can put a batch file that runs the following code in your install folder: bin\DCS.exe --server --norender -w DCS.DS_openbeta -w is simply the write directory command, so in this case it will make a saved games folder DCS.DS_openbeta. Doesn't matter what you have there other than it is required so that you aren't using the same saved games folder for your rendered and headless server.
-
It is possible in the sense that you have to modify the miz file itself to change the values. For instance the Hoggit servers import live weather data into each mission on their servers so that the weather is roughly accurate to real world conditions.
-
Think of "or" as something that separates grouped conditions. If you are aware of how code generally works it could be visualized like this: (con1 and con2 and con3) OR (con4 and con5) OR (con6 and con7 and con8)
-
fixed Text: Enter does not drop text cursor
Grimes replied to Nealius's topic in Mission Editor Bugs
Reported and already fixed. Should be in the next patch.- 1 reply
-
- 1
-
-
Ok lets clear some things up. 1. The tracks that pcoud posted do not show any bug with the shot event. This is primarily because they used a do script with the following code: assert(loadfile("D:\\Eclipse\\workspace\\Mes missions\\Missions test\\RDR detect.lua"))(). I can't speak for Nineline, but I don't have that file in that directory on my PC, so the script doesn't load. 2. Using a script to display any event that occurs you can clearly see in the screenshot below that a shot event did in fact occur when firing off the HARM in PB mode. In the future for any event related functionality that is the preferred way to go about it. Displaying a message of the event is a whole lot better at showing an event is broken than using an event to cause an AI do to something because any link in the chain from that event to the AI could be the part that is broken. 3. getTarget doesn't appear to return anything in PB mode, but it does with other modes. I would hazard a guess that getTarget is also like that with other weapons that have autonomous modes or just go for coordinates. For example an AI dropping a JDAM or LGB a target, but dropped from a player might not. The SLAM and Harpoon might have similar behavior as the HARM. So perhaps there is a mix of needing a getTargetCoord function and getTarget not changing.
-
If it is saying "210 Request Navigation Assistance" then that is you. 210 is your tail number. Though sometimes with NATO aircraft they will use their actual callsign. Ships don't really have their own callsigns or audio for that yet. Aside for the CV DLC ships where "Mother" is the callsign.
-
Creating a WP with pure DCS script logic (without MIST)
Grimes replied to dimitriov's topic in Mission Editor
Assigning a task with waypoints is basically creating a table in a certain format and then assigning that table to a group. https://wiki.hoggitworld.com/view/DCS_task_mission Each waypoint is an entry in that table and it has different required entries based on what you are wanting the AI to do. At the basics you need x, y coordinates, altitude if it is an aircraft, speed if it actually has a path to follow, action and type. An easy way to do it is to use the same values and just insert in the differences that you need to define a route. Which is kind of how the mist function does it. It is a pretty straight forward and easy process. The only annoying parts are if you are trying to generate an intelligent route or assigning tasks. The former is annoying because it generally involves a lot of math and decision making for what is deemed intelligent. The latter is annoying because tasks themselves can give you vertigo looking at the table and making sure the entry is in the right spot. The table entries to something you've set on a waypoint can literally be task.params.tasks[1].params.actions.params. There is no shame in looking at other code to see how they did something. I've gone onto stack overflow plenty of times to get ideas on how to do something. -
http://www.lua.org/manual/5.2/manual.html#pdf-loadfile The hoggit wiki doesn't really cover any of the built in lua functionality other than linking to a few lua pages that are useful. TBH I haven't put much thought into adding anything like that to it because the information is out there and more detailed than what could be added to the wiki. Maybe a basic FAQ type page with a few general tidbits like that or something would suffice.
-
TRIGGERS AND USE ACTIONS GROUP AI OFF/ON FOR GROUP OF PLANES
Grimes replied to mosqui's topic in Mission Editor
Use push task not set task. Make sure nothing is blocking their path or if other AI have landed and are still taxiing to their final parking location. -
It can only be done via scripting https://wiki.hoggitworld.com/view/DCS_func_addSubMenu
-
While not applicable for publishing missions when you are testing lua code you can call a loadfile that looks at a specific folder location on your PC. Since it is running a local file all you gotta do is save the file where-ever you are editing it and restart the mission. Then when done you switch back to embedding it in the miz with do script file. local path ='J:\\Dropbox\\\Projects\\DCSMissions\\' assert(loadfile(path .. "myCode.lua"))()
-
LATE ACTIVATION - Does not work for client spawns in multiplayer
Grimes replied to philstyle's topic in Mission Editor Bugs
It has never worked in MP and it is unclear if it is supposed to. It is one of those things where you can artificially get the same outcome via scripting by blocking or kicking people from slots. Plus the UI doesn't help much other than saying "Your flight is delayed." -
Posting the mission file would help because we can see how the tasking is assigned to the AI. For point 1 it sounds like you are using triggered actions and possibly the "Set Task" trigger. If that is the case try using "Push Task" or assigning the tasks on the waypoint. However if you do try it with the waypoint you should make sure the orbit task happens last.
-
Switch Condition> Part of Coalition In Zone> Flag 1 Off and AI Push Task Switch Condition> All of Coalition out of Zone > Flag 1 On If you had it be "AI Push Task" with "Flag 1 off" directly below it the task would immediately end because for a split second the task is active with the stop condition being met. If you moved flag 1 off above it then the stop condition isn't met when the task starts.
-
On the fire at point task add a stop condition. I used flag 1 is true and when all of coalition is out of zone it sets flag 1 true, which ends the task. It is important that in the task you use to assign the task that you set flag 1 to false before assigning the task. Otherwise the flag is still true when the task starts, so it automatically ends. Other ways you can go about it are to use Group.getByName('groupName'):getController():popTask() to end their active task or toggle group AI on/off as needed.
-
Unfortunately no. I don't know if it will ever change.