dimitriov Posted September 29, 2021 Posted September 29, 2021 Hi guys, I'm currently for CA purpose working on a lil script to implement a tank follower (see file attached). It works very well as of now but I have to use MIST (mist.groupToRandomPoint and mist.getHeading). I know that MIST has been made to improve comfort, and it does it very well. But I'd like the mission maker in my squad to load as few files as needed (this code would be implemented in an already done larger script). So my question is very simple : How would you : 1) Get the heading of a specific vehicle without using MIST 2) Getting it to do something similar to mist.groupToRandomPoint with the heading set All of this without using MIST ? Thank you for your insights Attached is the current script. Nicolas test2.lua
toutenglisse Posted September 29, 2021 Posted September 29, 2021 (edited) 1 hour ago, dimitriov said: ...All of this without using MIST ? ... Hi dimitriov, mist.getHeading() is composed of DCS script function (getPosition that gives initial point and 3d vector) and lua math function (arc tangent for x and z components of vector to give heading). You could copy what is inside this function and use it when you need. Or you could copy this function into your script and call it the same way than before. mist.groupToRandomPoint() is more complexe and using several other mist functions (buildWP, goRoute, etc...). You could copy this one plus all needed mist functions for it to work and call it the same way, or decompose further to all DCS functions and lua functions that are inside, with no other difference than only not seeing the word "mist" anymore. (I can't understand how all this attempt could be easier than loading mist at start.) Edited September 29, 2021 by toutenglisse 1
dimitriov Posted September 29, 2021 Author Posted September 29, 2021 Well learning to code a bit on my side and trying to disturb as few as possible the mission makers in my squad ^^ I'll investigate what you explained me here, thank you
Grimes Posted September 30, 2021 Posted September 30, 2021 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. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
dimitriov Posted September 30, 2021 Author Posted September 30, 2021 Yes this is exactly what I'm doing by reading MIST code ^^
dimitriov Posted October 1, 2021 Author Posted October 1, 2021 Ok so script is done. It works this way : call the leader tank XL and the follower XLBis (working on a way to simply assign them using F10 markers ingame) Then it's done. You'll get 4 radio menus in "formation", halt, join, recon 1500 m, recon 2500 m. From this i'm gonna work on a script to improve AI and getting it able to outmaneuver players. Nicolas 106_en.lua
Recommended Posts