Need help for Change Mission
by Cai Yundong · in Torque Game Engine Advanced · 11/05/2008 (7:52 pm) · 1 replies
Dear all,
I have some trouble at the server connection.
What i plan to do is:
1. I have two missions, one for present world, and one for past world
2. In the present world, I have a portaltrigger, once the player enter into it, i will teleport the player into the past world.
I install 2 dedicated servers at my PC, and launch a client to connect them.
Problems I face:
1. When I open the join server gui, only one is shown, is it because the two dedicated servers has same name?
2.
My Code:
//============================================================
function clientCmdEnterPortal(%arg)
{
error("The current mission is "@ $Server::MissionFile);
if($Server::MissionFile$="scriptsAndAssets/data/missions/present.mis")
{
echo("1");
$Server::MissionFile="scriptsAndAssets/data/missions/past.mis";
changeServer(28001);
}
else
{
echo("2");
$Server::MissionFile="scriptsAndAssets/data/missions/present.mis";
changeServer(28000);
}
}
//change the mission, %val is port number of the server
function changeServer(%val)
{
disconnect();
%conn = new GameConnection(ServerConnection);
%conn.setConnectArgs($pref::Player::Name,$pref::Player::Password);
%conn.setJoinPassword($Client::Password);
$ServerInfo::Address = "IP:155.69.101.34:" @%val;
echo ("i am going to connect to : " @$ServerInfo::Address);
%conn.connect($ServerInfo::Address);
}
//============================================================
a)
I was not able to get the $Server::MissionFile, which can be get in single player mode.
Is it because the client side can't get it? Then how can i get the server connection information?
Using ServerConnection?
b)
When I enter the trigger, the code runs to changeServer(28000), it crashes. I trace the code, it finishes the function changeServer, when it comes to last } of clientCmdEnterPortal, it crashes.
I use another way: click some icon on GUI to call changeServer, it works fine; at console to call changeServer, it also works fine.
Anyone can help a bit? or some online materails about dedicated server and extra.
Thank you so much.
I have some trouble at the server connection.
What i plan to do is:
1. I have two missions, one for present world, and one for past world
2. In the present world, I have a portaltrigger, once the player enter into it, i will teleport the player into the past world.
I install 2 dedicated servers at my PC, and launch a client to connect them.
Problems I face:
1. When I open the join server gui, only one is shown, is it because the two dedicated servers has same name?
2.
My Code:
//============================================================
function clientCmdEnterPortal(%arg)
{
error("The current mission is "@ $Server::MissionFile);
if($Server::MissionFile$="scriptsAndAssets/data/missions/present.mis")
{
echo("1");
$Server::MissionFile="scriptsAndAssets/data/missions/past.mis";
changeServer(28001);
}
else
{
echo("2");
$Server::MissionFile="scriptsAndAssets/data/missions/present.mis";
changeServer(28000);
}
}
//change the mission, %val is port number of the server
function changeServer(%val)
{
disconnect();
%conn = new GameConnection(ServerConnection);
%conn.setConnectArgs($pref::Player::Name,$pref::Player::Password);
%conn.setJoinPassword($Client::Password);
$ServerInfo::Address = "IP:155.69.101.34:" @%val;
echo ("i am going to connect to : " @$ServerInfo::Address);
%conn.connect($ServerInfo::Address);
}
//============================================================
a)
I was not able to get the $Server::MissionFile, which can be get in single player mode.
Is it because the client side can't get it? Then how can i get the server connection information?
Using ServerConnection?
b)
When I enter the trigger, the code runs to changeServer(28000), it crashes. I trace the code, it finishes the function changeServer, when it comes to last } of clientCmdEnterPortal, it crashes.
I use another way: click some icon on GUI to call changeServer, it works fine; at console to call changeServer, it also works fine.
Anyone can help a bit? or some online materails about dedicated server and extra.
Thank you so much.
About the author
Torque 3D Owner Cai Yundong
schedule(1000, 0, "changeServer", 28001);
is used, then it works.