Also,
GameConnection::ApplyBodyParts(%obj);
GameConnection::ApplyBodyColors(%obj);
Should be
%obj.ApplyBodyParts();
%obj.ApplyBodyColors();
and I'm not sure what you're trying to do with all the code after that part, those are all set by the .applyBody_____()
I have something that uses a bot with a customized appearance, here's all the code I have for it to spawn on map load, and automatically respawn if it dies
package AdambotBody
{
function AIConnection::spawnPlayer(%this,%location)
{
if(%this $= Adambot)
{
%this.player = new AIPlayer()
{
datablock = PlayerStandardArmor;
};
%this.player.client = %this;
%this.player.setTransform(%location);
%this.applyBodyParts();
%this.applyBodyColors();
%this.player.setScale("0.7 0.7 0.7");
}
else
Parent::spawnPlayer(%this,%location);
}
function AIConnection::onDeath(%this,%obj,%name,%something,%location)
{
if(%this $= Adambot)
%this.spawnPlayer(pickSpawnLocation());
else
Parent::spawnPlayer(%this,%obj,%name,%something,%location);
}
function onMissionLoaded()
{
Parent::onMissionLoaded();
new AIConnection(Adambot){};
Adambot.chestColor = "0.078 0.078 0.078 1";
Adambot.decalName = "Mod-Suit";
Adambot.faceName = "smiley";
Adambot.headColor = "1 0.878 0.611 1";
Adambot.hidColor = "0.078 0.078 0.078 1";
Adambot.larmColor = "0.078 0.078 0.078 1";
Adambot.lhandColor = "1 0.878 0.611 1";
Adambot.llegColor = "0.078 0.078 0.078 1";
Adambot.rarmColor = "0.078 0.078 0.078 1";
Adambot.rhandColor = "1 0.878 0.611 1";
Adambot.rlegColor = "0.078 0.078 0.078 1";
Adambot.name = "Adambot";
Adambot.netName = "Adambot";
Adambot.spawnPlayer(pickSpawnPoint());
AdambotBody::Tick();
}
function onServerDestroyed()
{
Parent::onServerDestroyed();
Adambot.delete();
}
};
Activatepackage(AdambotBody);