Laxxor Posted May 30, 2024 Posted May 30, 2024 Appologies if this is an old or frequent covered subject but i could not find results. ME-generated triggers are split into trig, condition and trigrule tables. I see that i can edit these structures at runtime but edits do not seem to effect the triggers. Is there a way to cause these tables to be re-processed to dynamically effect trigger conditions? many thanks
Grimes Posted May 30, 2024 Posted May 30, 2024 No. The env.X tables are just a copy of a few files located within the miz file. You could edit the copy by adding triggers, units, or whatever and the serialize the files and re-insert into the miz so that on the next load the changes are reflected. I've done that a few times to fix or change entries outside of the editor in bulk. 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
TEMPEST.114 Posted May 30, 2024 Posted May 30, 2024 You could maybe try using the hidden & undocumented add trigger command, but it's probably not worth all the work.
Laxxor Posted May 30, 2024 Author Posted May 30, 2024 So serialisation is certainly nothing you could use in relation to the request of cargo and unhook conditions... @TEMPEST.114 i cant tell if this is a hint that i have failed to find something in plain sight, or if indeed there is a secret function. Could you elaborate?
TEMPEST.114 Posted May 30, 2024 Posted May 30, 2024 24 minutes ago, Laxxor said: So serialisation is certainly nothing you could use in relation to the request of cargo and unhook conditions... @TEMPEST.114 i cant tell if this is a hint that i have failed to find something in plain sight, or if indeed there is a secret function. Could you elaborate? There is a 'secret' function. You have to work out the params for yourself as there is no documentation, but it's not too hard. This way you can add triggers with conditions and actions at runtime.
Laxxor Posted May 30, 2024 Author Posted May 30, 2024 "Its not too hard" so there must be some stuff written about it somewhere, and clearly you've done it? I'm not looking for handouts, but any hints on where to look?
TEMPEST.114 Posted May 30, 2024 Posted May 30, 2024 (edited) 1 hour ago, Laxxor said: "Its not too hard" so there must be some stuff written about it somewhere, and clearly you've done it? I'm not looking for handouts, but any hints on where to look? Nothing written. All worked out from peeking and poking. Overview: 1. You're going to have to create an empty mission with a single trigger set up like you'd want to create by script. 2. Pull out the mission file from the .miz, look at the data structure of the trigger table for that trigger and then using the secret addTrigger() function, work out how to pass those parameters in (by trial and error) until you can get it to work from a function call in a different mission file you make to test it. 3. Then rinse and repeat for every other type of trigger. Fun right? They couldn't have made it easy for us eh? Edited May 30, 2024 by TEMPEST.114
TEMPEST.114 Posted May 30, 2024 Posted May 30, 2024 What is it you're actually trying to do - maybe there's a better way?
Pizzicato Posted June 1, 2024 Posted June 1, 2024 On 5/29/2024 at 10:01 PM, Grimes said: You could edit the copy by adding triggers, units, or whatever and the serialize the files and re-insert into the miz so that on the next load the changes are reflected. @Grimes Do you have an API for opening, updating and closing a .miz file via Lua script, or do you have to manually go through the process of renaming the .miz, opening the .zip, updating the file(s) and then closing and renaming the archive? I know there's something called LuaZip for Lua Rocks that seems like it might fit the bill, but I've never been able to wrap my head around it. I'm OK with serialisation and saving/loading external files, but messing about with zip files seems a little out of reach to me just at the moment. I'd love to be able to dynamically change TOD and weather between playthroughs of a mission, though. i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S
Grimes Posted June 4, 2024 Posted June 4, 2024 I've only ever done it outside of DCS with python. But yeah, same concept of doing it with something like luazip externally from DCS. Something like the web editor might be the easiest to use since it has a UI and you can modify time of day or weather in the miz pretty quickly. 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
Recommended Posts