New aiplayer not setting rotation correctly
by Robin Rudick · in Torque Game Engine · 09/26/2006 (9:20 am) · 2 replies
Im trying to create a system that can pull all the npc from a database(mysql) and populate the game with them whenever this happens.
the issue im running into is the rotation isnt being set in the new aiplayer system
new AIPlayer(Bob) {
datablock = "PlayerBody";
position = "10 10 10";
rotation = "0 0 1 50";
};
for some reason the rotation doesnt set, it just defaults to 1 0 0 0, unless i change the vaule manually afterwords, i can see ways around this but id rather just know why this is happening!
thanks!
the issue im running into is the rotation isnt being set in the new aiplayer system
new AIPlayer(Bob) {
datablock = "PlayerBody";
position = "10 10 10";
rotation = "0 0 1 50";
};
for some reason the rotation doesnt set, it just defaults to 1 0 0 0, unless i change the vaule manually afterwords, i can see ways around this but id rather just know why this is happening!
thanks!
#2
function serverCmdRequestNPCs()
{
%npcpop = new MySQL();
// ----------------------------------------------------
// set host info
%npcpop.host = "XXXXXXXXXX"; // default: "localhost"
%npcpop.port = "XXXXXXXXXX"; // default: 3306
// user information
%npcpop.user = "XXXXXXXXXX"; // NO default!
%npcpop.pwd = "XXXXXXXXXX"; // default: ""
// connection flags
%npcpop.flag_compress = false; // default: false
%npcpop.flag_ssl = false; // default: false
// database to use
%npcpop.db = "XXXXXXXXXX"; // NO default!
// ----------------------------------------------------
%npcpop.ValidateSettings(); // optional
%npcpop.Connect();
%npcpop.Query ("SELECT * FROM NPC");
%result = %npcpop.StoreResult();
for (%i= 0; %i< %npcpop.NumRows (%result); %i++)
{
%npcpop.FetchRow (%result);
$server::npc::npcID[%i] = %npcpop.GetRowCell (%result, "npcID");
$server::npc::StringName[%i] = %npcpop.GetRowCell (%result, "NpcStringName");
$server::npc::ShownName[%i] = %npcpop.GetRowCell (%result, "NpcShownName");
$server::npc::position[%i] = %npcpop.GetRowCell (%result, "NpcPosition");
$server::npc::rotation[%i] = %npcpop.GetRowCell (%result, "NpcRotation");
$server::npc::scale[%i] = %npcpop.GetRowCell (%result, "NpcScale");
$server::npc::DialogID[%i] = %npcpop.GetRowCell (%result, "NpcDialogID");
$server::npc::datablock[%i] = %npcpop.GetRowCell (%result, "NpcDatablock");
echo("NPCPOPULATING:", $server::npc::npcID[%i], ":", $server::npc::StringName[%i]);
new AIPlayer($server::npc::StringName[%i]) {
datablock = $server::npc::datablock[%i];
rotation = $server::npc::rotation[%i];
position = $server::npc::position[%i];
scale = $server::npc::scale[%i];
nameTag = $server::npc::ShownName[%i];
npcID = $server::npc::npcID[%i];
dialogID = $server::npc::DialogID[%i];
};
}
}
everything else works fine, its just the rotation that doesnt get set. not sure why
09/26/2006 (10:18 am)
No, im pulling the rotation from a database, i just cut all that out, what it acctually looks like is thisfunction serverCmdRequestNPCs()
{
%npcpop = new MySQL();
// ----------------------------------------------------
// set host info
%npcpop.host = "XXXXXXXXXX"; // default: "localhost"
%npcpop.port = "XXXXXXXXXX"; // default: 3306
// user information
%npcpop.user = "XXXXXXXXXX"; // NO default!
%npcpop.pwd = "XXXXXXXXXX"; // default: ""
// connection flags
%npcpop.flag_compress = false; // default: false
%npcpop.flag_ssl = false; // default: false
// database to use
%npcpop.db = "XXXXXXXXXX"; // NO default!
// ----------------------------------------------------
%npcpop.ValidateSettings(); // optional
%npcpop.Connect();
%npcpop.Query ("SELECT * FROM NPC");
%result = %npcpop.StoreResult();
for (%i= 0; %i< %npcpop.NumRows (%result); %i++)
{
%npcpop.FetchRow (%result);
$server::npc::npcID[%i] = %npcpop.GetRowCell (%result, "npcID");
$server::npc::StringName[%i] = %npcpop.GetRowCell (%result, "NpcStringName");
$server::npc::ShownName[%i] = %npcpop.GetRowCell (%result, "NpcShownName");
$server::npc::position[%i] = %npcpop.GetRowCell (%result, "NpcPosition");
$server::npc::rotation[%i] = %npcpop.GetRowCell (%result, "NpcRotation");
$server::npc::scale[%i] = %npcpop.GetRowCell (%result, "NpcScale");
$server::npc::DialogID[%i] = %npcpop.GetRowCell (%result, "NpcDialogID");
$server::npc::datablock[%i] = %npcpop.GetRowCell (%result, "NpcDatablock");
echo("NPCPOPULATING:", $server::npc::npcID[%i], ":", $server::npc::StringName[%i]);
new AIPlayer($server::npc::StringName[%i]) {
datablock = $server::npc::datablock[%i];
rotation = $server::npc::rotation[%i];
position = $server::npc::position[%i];
scale = $server::npc::scale[%i];
nameTag = $server::npc::ShownName[%i];
npcID = $server::npc::npcID[%i];
dialogID = $server::npc::DialogID[%i];
};
}
}
everything else works fine, its just the rotation that doesnt get set. not sure why
Associate Scott Burns
GG Alumni