Game Development Community

Request : Reload and Play Game in editor

by Dean Calver · in Torque 3D Professional · 05/04/2009 (4:39 pm) · 4 replies

Often it would be nice to cause a reload and re-spawn after editing rather than just returning to the game.

Specifically when your altering spawn points or terrain heights to test for player fall through.

Could that be added to the World Editor file menu easily?

#1
05/05/2009 (11:31 am)
Doesn't the current functionality for exiting the mission, then re-entering work for this? Hit ESC and choose yes to exit mission, then start the mission again.
#2
05/05/2009 (11:47 am)
And of course you can choose "Open" and then the level file from the editor and it'll reload with the editor open.
#3
05/05/2009 (11:57 am)
Both methods will of course work but too many steps for my liking, so I edited the editor to do it :)

Hers the code...

To menuHandlers.ed.cs add
function EditorSaveAndRestart()
{
   if( EditorIsDirty() )
   {
      // "EditorSaveBeforeLoad();", "getLoadFilename(\"*.mis\", \"EditorDoLoadMission\");"
      if(MessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
         $Server::MissionFile @ "\" before opening a new mission?", SaveDontSave, Question) == $MROk)
      {
         if(! EditorSaveMission())
            return;
      }
   }
   // close the current editor, it will get cleaned up by MissionCleanup
   Editor.close();

   loadMission( $Server::MissionFile, true ) ;

}

and in menus.ed.cs buildMenus
where it has
item[9] = "Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");";
replace the rest of the menu with
item[10] = "Play Level From Start" TAB "" TAB "EditorSaveAndRestart();";
         item[11] = "Close Editor" TAB "ESC" TAB "EditorQuitMission();";
         item[12] = "Exit" TAB "" TAB "quit();"; // ------------------------------- needs popup that ask to save changes
#4
05/05/2009 (1:11 pm)
Definately a good resource. Exiting and re-entering or re-open the level is a bit tedious...