-
Posts
1742 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by toutenglisse
-
Getting Groups to return to their tasks
toutenglisse replied to Pizzicato's topic in Scripting Tips, Tricks & Issues
I can confirm that a scripted refueling task using pushtask does work like you describe , and after refueling the AI resumes previous task (in my case a follow task). -
There is an option with script, that is "respawning" your aircraft with updated position and vector, but can only work in single player, and is probably a bit "dirty" in action. Little test attached (2 client slots to choose from on runway, F16 and F18, and when you kill the mig29 you have a 10sec delay and respawn in air where you are - mig29 also respawns). test-restore-player-AC-on-kill.miz
-
I've just tried "sample test" using your description. I don't know why but both "if not Group.getByName('GROUP') then" and "if mist.groupIsDead('GROUP') == true then" return unexpected data. It does work with : local gp = Group.getByName('GROUP') if gp and gp:isExist() == true and #gp:getUnits() > 0 and gp:getUnit(1):isActive() then else mist.respawnGroup('GROUP', true) end
-
Need Help Figuring Out Why MIST Respawn Script Is Not Working
toutenglisse replied to VKNorthern's topic in Mission Editor
Hi, here is a working edited version of your miz. I changed line 6. With your script, when the late activated group is destroyed, and then checked again by function, groupIsDead returns false (instead of true, probably because late activated group specificities?) and then the function tries to access to unit 1 that doesn't exist anymore and that creates the error. So the 1st 2 radio command pushes work and then error happens (activate - destroy - error). VKN_Marianas_Training_Mission_Forum-EDIT.miz -
Create a table of the current active WP of a group
toutenglisse replied to dimitriov's topic in Mission Editor
@dimitriov there is a flaw in my script. It works if used once by each vehicle groups, but issue raise if function is used multiple times by a group (due to flags values being manually set and to the way env.mission updates points when setTask Mission is used). Here is the updated miz example (script is updated and instead of manually set flag values for wpts > 0, each wpt need to set flag value = flag value +1). test-GroundVeh-resume-route-after-setTask.miz -
Create a table of the current active WP of a group
toutenglisse replied to dimitriov's topic in Mission Editor
@dimitriov I wrote the script with env.mission datas and used setTask Mission to resume route and put it in this example. (so without using mist) The vehicle enters a zone ("debut tir") that activates a triggered task (fire on point) using AI SET TASK (so this task deletes the route, and without action when the task is complete the vehicle just stands on place without resuming). 45 seconds after "debut tir" task, the function ResumeRoute is used with groupname and flagname as parameters and the vehicle resumes its route toward remaining waypoints. Only requirement, apart using the function when needed to resume, is to set flag value for waypoints > 0 (value = 1 for wpt 1 etc...) by script in advanced wpt action. -
Create a table of the current active WP of a group
toutenglisse replied to dimitriov's topic in Mission Editor
You could get route from env.mission, remove points the same way with flag, and setTask Mission with updated route. I usually use Mist because of minimal workload with handy functions. -
Create a table of the current active WP of a group
toutenglisse replied to dimitriov's topic in Mission Editor
@dimitriov if you want to see a working example using it (in the example - replacement of an aircraft by same aircraft but from enemy coalition to act as defection, that continues the route of previous aircraft from the point where it is spawned - I use mist.getCurrentGroupData and mist.getGroupData instead of mist.getGroupRoute, but works the same) you can download this .miz : -
Create a table of the current active WP of a group
toutenglisse replied to dimitriov's topic in Mission Editor
Hi Nicolas, the only way I actually found to handle that is : - get route/WP using mist function - get trace of WP already reached using a flag (value +1 when a new WP is reached) - and resume route, updated by removing already reached WP using this little function : function GoUDRoute() GroupRoute = mist.getGroupRoute(GroupName, true) for i = 1, trigger.misc.getUserFlag(FlagName) do table.remove(GroupRoute, 1) end mist.goRoute(GroupName, GroupRoute) end Have a nice day Pierre -
addGroup does not work for planes ?
toutenglisse replied to dFlow's topic in Scripting Tips, Tricks & Issues
@dFlow, your local table plane does not respect the structure of an aircraft group (or any group, even ground group), for example you have have stacked in the root ("group" datas) datas that belong to "units" ("units" must be present with numerically indexed unit(s), and units datas inside). You also gave strings to entries that need number (groupId, unitId), or other kind of not valid values (you would even better get ridd of some entries like group/unit ID, callsign, onboard num, names, and let scripting engine create unique available values when spawning). To be safe at first, you should create the plane group using mission editor in a clean mission, save mission, unzip from mission.zip the file named "mission" and open it with notepad++ to get the aircraft group table as created by mission editor. From there you could copy the group table to your script and change the datas you want to be dynamically set (spawn position/orientation, route, names, payload, options, tasks, or whatever...) and be sure you use correct values type to feed it. -
Any help to get three random unique flags values :?
toutenglisse replied to Presidium's topic in Mission Editor
Hey, I just took a look and still same flags values occures. No clue what's wrong though. -
Any help to get three random unique flags values :?
toutenglisse replied to Presidium's topic in Mission Editor
@Presidium and @Rudel_chw, I've tested Rudel's random number miz and I can't say why, but same numbers still happen. Attached modified miz (modified the 3 flags trigger to fire every 4 seconds, and added a time message and made the messages continuous - updated every second) I tested because my hesitation with this method was : maybe flags would still be activated with potential same numbers and detected like this before being changed, due to "switched cond" triggers being evaluated every sec. But it seems that this is not an issue, while there is another one. (unidentified, but soon or late flags are activated with same numbers) FWIW with script the 2nd and 3rd flags can only be activated with values from 1 to 10 but without value(s) of previous flag(s). Test Random Numbers-every-4-sec.miz -
Any help to get three random unique flags values :?
toutenglisse replied to Presidium's topic in Mission Editor
In your example, nothing prevents results to be the same. -
Any help to get three random unique flags values :?
toutenglisse replied to Presidium's topic in Mission Editor
Hi, here a script to do that (and a .miz to test -> flags are defined every 5 seconds with message that gives values) : local values = {1,2,3,4,5,6,7,8,9,10} for j = 1, 3 do local i = math.random(#values) trigger.action.setUserFlag("0"..j, values[i]) table.remove(values, i) end test-3flags-unique-rand-value-1-10.miz -
I think Grimes said it's better to only test the event "string", as number can change but not "string" : Here is a script example where I check for SP player/client both "pilot dead" and "killed" events (so script works when player crashes, get killed, or eject from damaged aircraft). Both can happen at same time and so desired following schedulled functions (respawn and countdown messages) can overlap. So when 1 event occures I first remove schedulled functions of probable other event :
-
I've just checked and both following sentences work : if event.id == 20 then if event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then
-
From supercarrier manual :"It is important not to place static objects in locations they may interfere with flight operations so test your mission thoroughly to find any problems." You can find on this page pictures of all carrier types with all slots and taxiways used by AI : DCS editor carrier spawns - DCS World Wiki - Hoggitworld.com
-
Scripting Functions with sceneryObject type
toutenglisse replied to sunski34's topic in Mission Editor
Here is another thread on same topic : -
Which S_EVENT can recognize/trigger an AI loss ?
toutenglisse replied to ADHS's topic in Mission Editor
hi @Flappie I don't think so as this other thread is only about ground vehicles. -
Which S_EVENT can recognize/trigger an AI loss ?
toutenglisse replied to ADHS's topic in Mission Editor
For everything that happens during the mission, the available events obviously can detect it (crash, kill, pilot dead, landing back at base, etc...). If you destroy() / deactivateGroup() by script there is no event but as your script uses these functions, you can also add anything you want for taking in account this destruction. (ex : get AI coalition before destruction, adjust counter for that coalition, and destruct) You also have the possibility to add a loop when AI spawns to periodically check if alive (MIST groupIsDead - DCS World Wiki - Hoggitworld.com or any similar function) but it's probably not what you want. Maybe if you want to share your script I can better understand your issue, but actually I can't get it. -
Which S_EVENT can recognize/trigger an AI loss ?
toutenglisse replied to ADHS's topic in Mission Editor
I don't know. I fail to understand.