cfrag Posted July 24, 2022 Posted July 24, 2022 Currently scripts can't (unless they are server-side script) easily restart the mission that is running. A work-around is to create a Trigger and perform Action "LoadMission", with the current mission selected. However, that is convoluted, can't readily be accessed via script, isn't portable, and (worst of all) breaks any time that you rename your mission (if, for example, you are using versions in your mission name). Since net.load_mission is firewalled and only works on the server for obvious reasons, I'd like to propose a less dangerous sibling that simply reloads and restarts the mission that is already running, able to run inside "gui" or "mission" environments: net.restart_mission() -- re-loads and restarts the currently running mission, effectively mimicking the LoadMission Action with the mission's name. That way, we can write a generic mission restart method that works in any mission, without a trip to the rules editor every time the mission's name changes. I'm sure many (server) mission authors would welcome such an addition. I surely do Thanks, -ch [before anyone asks: I've tried -- mm contains fully qualified path to mission net.dostring_in('gui', 'return net.load_mission("' .. mm .. '")') with no result on single player, and -1 when running as server, the mission does not load itself and restart]
danielqu Posted August 1, 2022 Posted August 1, 2022 (edited) Hi, cfrag. I'm also trying to find a way to reload mission and having no idea why did net.load_mission not work in My SP mode. Until I came across your post realized there is a limit embedded by ED. have you found a solution bypass it? Since it could use L_shift+R to restart mission, I'm wondering is that possible by using `Export.LoSetCommand` to do that? Edited August 1, 2022 by danielqu
cfrag Posted August 2, 2022 Author Posted August 2, 2022 (edited) The only work-around I found is the ugly kludge with a mission trigger that (unfortunately) uses the current mission's name and is therefore not portable. Let's hope that some day ED allows us a restart same mission. Edited August 2, 2022 by cfrag
Recommended Posts