Is there a variable to get the current Mission Name?
by Afrim Kacaj · in Torque Game Engine · 07/02/2006 (9:21 am) · 2 replies
I am using the FPS demo and when I go to the Join Server dialog, it is not listing the Mission Name.
I created a server and ran echo($Server::MissionName); and noticed that it is blank.
This variable should probably be set in the onMissionLoaded() function inside game.cs.
Can anyone tell me if there is a variable that tells me the current mission name?
$Server::MissionName = ?
I created a server and ran echo($Server::MissionName); and noticed that it is blank.
This variable should probably be set in the onMissionLoaded() function inside game.cs.
Can anyone tell me if there is a variable that tells me the current mission name?
$Server::MissionName = ?
#2
In common/server/missionLoad.cs
Find the LoadMission function
then add
$Server::MissionName = MissionInfo.name;
right after the buildLoadInfo( %missionName ); line.
This will ensure that the variable gets updated each time a new mission is loaded through console or gui.
Tom, your answer above would probably also work but that requires that the server be started in gui mode.
07/02/2006 (11:25 am)
Actually I got the answer from Paul Dana in IRC, here it is:In common/server/missionLoad.cs
Find the LoadMission function
then add
$Server::MissionName = MissionInfo.name;
right after the buildLoadInfo( %missionName ); line.
This will ensure that the variable gets updated each time a new mission is loaded through console or gui.
Tom, your answer above would probably also work but that requires that the server be started in gui mode.
Torque Owner Tom Bushby
Once in a mission, open the console and type echo($playingMission);, and you should find it will echo the name of the mission.
However, you might want to remove the mission string from that variable when you go back to the main menu after a mission, or when you load a new one, so you will have to do that by changing the value of the variable elsewhere. ;)