LFCChameleon_Silk Posted February 27, 2013 Posted February 27, 2013 (edited) ok so i been trying to get into scripting in DCS world... i find the wiki a good help but at same time the extreme lack of working examples is infuriating! Everything i tried wont work, is there anyone out there that can show me a working example of assigning a "mission" to a ground unit so that later i can use a switchwaypoint command to have them RTB from a condition. I have tried dissecting the mission file and pulling the task from the mission file and putting it into a script file to run but the syntax does not match the examples i.e -- [points] = { versus what the examples show points = { so right away i am scratching my head! and even then i don't know where to stop the copy pasta because it has a lot of information in the mission file like a bunch of span data. if anyone can help me out please let me know what i am doing wrong or point me in the right direction or provide me an example mission with a simple unit moving between two waypoints.. that would be stellar and i'm pretty sure i could take it from there. example of a failed attempt: http://codepad.org/mqnCIgSb edit to say: this is plain nutty that you cant just assign them more waypoints and trigger them to move off a waypoint after a certain condition (i.e while enroute to waypoint 2, something happens, they move back to waypoint 1 [back to home base])... absolutely nutty. Edited February 27, 2013 by =LFC=Chameleon_Silk
Speed Posted February 27, 2013 Posted February 27, 2013 (edited) ok so i been trying to get into scripting in DCS world... i find the wiki a good help but at same time the extreme lack of working examples is infuriating! Everything i tried wont work, is there anyone out there that can show me a working example of assigning a "mission" to a ground unit so that later i can use a switchwaypoint command to have them RTB from a condition. I have tried dissecting the mission file and pulling the task from the mission file and putting it into a script file to run but the syntax does not match the examples i.e -- [points] = { versus what the examples show points = { so right away i am scratching my head! and even then i don't know where to stop the copy pasta because it has a lot of information in the mission file like a bunch of span data. if anyone can help me out please let me know what i am doing wrong or point me in the right direction or provide me an example mission with a simple unit moving between two waypoints.. that would be stellar and i'm pretty sure i could take it from there. example of a failed attempt: http://codepad.org/mqnCIgSb edit to say: this is plain nutty that you cant just assign them more waypoints and trigger them to move off a waypoint after a certain condition (i.e while enroute to waypoint 2, something happens, they move back to waypoint 1 [back to home base])... absolutely nutty. I can't provide an example mission right now because I am not at my DCS machine. However, in your example, I see no place where you got the ground unit group's Controller and assigned the task. You have to use Controller.setTask or Controller.pushTask. For example, do local missionTask = <some mission task> local group = Group.getByName('M1_PLT1') if group then local groupContrlr = group:getController() if groupContrlr then groupContrlr:setTask(missionTask) end end end Ground unit group waypoints don't work like air because ground units have to do path finding. Assigning waypoints to them is almost a non-deterministic process. We're working on Mist 2.0 right now. Grimes is working on a function set for ground unit pathing. Once it is released, it will make this easier because you won't have to remember how Mission tasks are supposed to be formatted. When in doubt about how to format a Mission task,, I've never experienced an instance of when a Mission task extracted from an unzipped mission does NOT work. Edited February 27, 2013 by Speed Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
Grimes Posted February 27, 2013 Posted February 27, 2013 Ignore the span data. Those entries are simply there to render the path in the mission editor. Like Speed said the next version of Mist will have several new functions that gives orders to ground units. However here is a simple mission and script I initially created to test the feature. In the example mission, the path of the ground units is defined by the location of the trigger zones.mission_task_ground_units.mizground_mission_test_2.lua 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
LFCChameleon_Silk Posted February 28, 2013 Author Posted February 28, 2013 thanks a million guys, i'm really new at LUA scripting but did some scripting for arma 2 in the past so hoping to really get into the DCS scripts and make some really nice missions. will have to check out mist 2.0 when you release it for sure, hopefully things will get really documented out on the wiki over time. I will take a look at the sample mission sometime later on today, if it does what i think it does my missions will suddenly seem like the AI knows what its supposed to be defending :)
Recommended Posts