Quick match for mod testing

Started by Viathan, July 07, 2017, 03:04:03 PM

Previous topic - Next topic
July 07, 2017, 03:04:03 PM Last Edit: July 07, 2017, 04:13:54 PM by Viathan
I made a little mod that may be useful for some modders.
It adds one or two buttons to the main menu which can launch a game instantly.
You can of course edit it to your needs, my current setup is:

  • Button 1: Launches a singleplayer game (instant action) on mos eisley with a single click
  • Button 2: Launches a LAN game with no bots and player team select etc with a single click
  • Button 3: Server Browser - "Straight to sessionlist"




File: ifs_main.lua (shell script)
buttons added on lines 3 and 4
Code (lua) Select

buttonlist = {
  { tag = "sp", string = "ifs.main.sp", },
  { tag = "isp", string = "INSTANT SINGLEPLAYER", },
  { tag = "imp", string = "INSTANT MULTIPLAYER", },
  { tag = "mpsb", string = "SERVER BROWSER", },
  { tag = "mp", string = "ifs.main.mp", },
  { tag = "split", string = "ifs.main.split", },
  { tag = "tutorials", string = "ifs.main.tutorials", },
  { tag = "opts", string = "ifs.main.options", },
  { tag = "back2", string = "ifs.main.profiles", },
  { tag = "quit", string = "common.quit2windows", },
},


instant singleplayer button functionality
search for "this.CurButton == " and you will see where to add the code below
Code (lua) Select

elseif (this.CurButton == "isp") then
  RoundIFButtonLabel_fnSetString(this.buttons.isp, "LOADING ...")
  ifelm_shellscreen_fnPlaySound(this.acceptSound)
  -- clear old SSID and netshell
  ScriptCB_ClearPrevSessionId()
  ScriptCB_CloseNetShell(1)
  -- set up singleplayer mode stuff
  ifs_sp.bForSplitScreen = nil
  ScriptCB_SetSplitscreen(nil)
  ScriptCB_SetInNetGame(nil)
  -- file reference: ifs_sp -------------------------------------
  ScriptCB_SetMetagameRulesOn(nil)
  ScriptCB_SetHistoricalRulesOn(nil)
  ScriptCB_SetCanSwitchSides(1)
  -- file reference: ifs_instant_top ----------------------------
  ScriptCB_SetDifficulty(ScriptCB_GetDifficulty())
  ifs_missionselect.bForMP = nil
  -- file reference: ifs_missionselect --------------------------
  ispMapData = {-- modified gPickedMapList from ifs_missionselect
    { Map = "tat2i", Side = 1 }
  }
  ScriptCB_SetMissionNames(ispMapData, false)
  --ifs_missionselect.SelectedMap = gPickedMapList
  ScriptCB_EnterMission()


instant multiplayer button functionality
Code (lua) Select

elseif (this.CurButton == "imp") then
  RoundIFButtonLabel_fnSetString(this.buttons.imp, "LOADING ...")
  ifelm_shellscreen_fnPlaySound(this.acceptSound)
  -- ifs_mp
  ScriptCB_SetConnectType("lan")
  gOnlineServiceStr = "LAN"
  ScriptCB_SetNoticeNoCable(1)
  -- ifs_mp_main
  ScriptCB_ClearPrevSessionId()
  ScriptCB_SetAmHost(1)
  ifs_missionselect_pcMulti.bForMP = 1
  ScriptCB_SetMetagameRulesOn(nil)
  -- ifs_missionselect_pcMulti
  -- no "gPickedMapList" needed. (not even the modified variant) -> we can't pre-select the team like in 'isp'
  impMap = "tat2i"-- the map + era to load
  ifs_missionselect.SelectedMap = impMap
  this.SelectedMap = 1
--Players, Bots, TeamDmg, AutoAim, IsPrivate, ShowNames, AutoAssignTeams, StartCnt, HeroesEnabled, Difficulty, Password
  ScriptCB_SetNetGameDefaults(2, 0, 0, 0, 0, 1, false, 0, false, 0, "")
  ScriptCB_SetMissionNames(impMap, false)
  ScriptCB_SetDedicated(false)
  ScriptCB_SetGameName("INSTANT MULTIPLAYER")
  --ifs_mp_gameopts.bAutoLaunch = 1
  ScriptCB_BeginLobby()
  this.bLan = 1
  --ScriptCB_LaunchLobby()
  ScriptCB_EnterMission()





I'm lazy af and I find it annoying to click through the entire game just to see if the little change I made to my common.lvl looks good or something.
Seriously, this is kinda lifesaver for me. While messing around with cheatengine or a debugger, the game crashes a lot.
Any feedback is appreciated. If you need help, don't hesitate to pm me (or reply here) :cheers:


thx to Phobos for sharing few helpful scripts.
thx to SleepKiller for the "LogProgress" idea. Would've driven me crazy without it.