[Tutorial] Exit To Windows From Multiplayer Game With No Crash
A breakthrough in SWBF1 modding has just happened!
It is now possible to properly exit to windows from a multiplayer server without your game freezing or crashing. This was discovered as I was testing some new scriptcb_ files with the help of SleepKiller who has taught me a lot in regards to advanced LUA coding.
Official ScriptCB_ Testing Notes Thread
http://www.swbfgamers.com/index.php?topic=4207.0
The first test (there are at least 17 more I have in mind) yeiled some unexpected results
http://www.xfire.com/video/550e65/
I wanted to test two values ScriptCB_CloseNetShell and ScriptCB_OpenNetShell, both in singleplayer and multiplayer. OpenNetShell does nothing in either, and CloseNetShell does nothing in single player. The script function "ScriptCB_CloseNetShell" apparently disconnects the client from a server, even if it is your own, but still leaves the game running (you can move around but your camera stays still if you are the host, game freezes if you're the client). The idea suddenly hit me that calling on CloseNetShell right before QuitToWindows might provide some sort of workaround, since alt-f4 was the only way to close the game after CloseNetShell had been activated (hitting escape would not load the pause menu). And I was surprised battlefront.exe didn't freeze like it normally does when you press alt-f4.
So it is really simple to make this mod, all it actually takes is a two line text modification to ifs_pausemenu.lua script. For working with common LUA scripts I highly recommend using notepad++ it is freeware and helps alot http://notepad-plus-plus.org/download/v5.9.8.html
Here is an updated interface tool by sleepkiller which can also munge the scripts for common lvl
http://www.mediafire.com/?wdzgnfecfq9femn
Step 1) Open ifs_pausemenu.lua in notepad++
Step 2) Go to line 97 where it says ScriptCB_QuitToWindows()
and in front of that add this ScriptCB_CloseNetShell()
so it should look like this ScriptCB_CloseNetShell() ScriptCB_QuitToWindows()
Step 3) Go to line 222 and where it says this.buttons.exit.hidden = (gPlatformStr ~= "PC" or ScriptCB_InNetGame())
comment it out with two minus symbols like this -- this.buttons.exit.hidden = (gPlatformStr ~= "PC" or ScriptCB_InNetGame())
(also note on line 223 you can do the same thing to hide or show freecamera)
Step 4) Now save the ifs_pausemenu.lua and use script munger http://www.mediafire.com/?0hm1au1riwt0k5l to munge the LUA .into .script
Step 5) Replace the ifs_pausemenu.script in your common/data/munged folder and munge common.lvl
Now you can exit to windows instantly from multiplayer servers. I have also uploaded this mod here too for people who can't mod.
Mod Download Link: http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=461
Mirror Link: http://www.mediafire.com/?y3kum6pv79ffb5b
Second Mirror: http://www.speedyshare.com/file/FYmZc/Common.lvl-Exit-To-Windows-In-Multiplayer-Freecam.7z
In the future I plan to upgrade common.lvl builder so that it supports custom reqs and custom munged scripts (also maybe an integrated script builder for common) but for now you have to replace the ones in data folder.
Nice, thanks for the tutorial.
Maybe someday I will understand this! ;)
Oh cool!
Works`!! 100% Nice!