Author Topic: Strange glitch with Playertype  (Read 1164 times)

I've finally figured it out... a fully customizable LEGO Man! Buttttt, when used in-game,

His legs disappear.
I can fix the hat's color with very simple TorqueScript, but I can't fix the legs. I also need a face for him.
Code: [Select]
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------


datablock TSShapeConstructor(MiniFigDts)
{
   baseShape = "./minifig.dts";
   sequence0 = "./m_root.dsq root";
   sequence1 = "./m_run.dsq run";
   sequence2 = "./m_back.dsq back";
   sequence3 = "./m_side.dsq side";
   sequence4 = "./m_look.dsq look";
   sequence5 = "./m_crouch.dsq crouch";
   sequence6 = "./m_fall.dsq fall";
   sequence7 = "./m_root.dsq land";
   sequence8 = "./m_standjump.dsq jump";
   sequence9  = "./m_crouchRun.dsq crouchRun";
   sequence10 = "./m_crouchBack.dsq crouchBack";
   sequence11 = "./m_crouchSide.dsq crouchSide";
   sequence12 = "./m_root.dsq walk";
   sequence13 = "./m_root.dsq death5";
   sequence14 = "./m_root.dsq death6";
   sequence15 = "./m_root.dsq death7";
   sequence16 = "./m_root.dsq death8";
   sequence17 = "./m_root.dsq death9";
   sequence18 = "./m_spearready.dsq spearready"; 
   sequence19 = "./m_spearThrow.dsq spearThrow";
   sequence20 = "./m_talk.dsq talk";
   sequence21 = "./m_headup.dsq headUp";

   sequence22 = "./m_talk.dsq talk";
   sequence23 = "./m_headside.dsq headside";
   sequence24 = "./m_standjump.dsq standjump";
   sequence25 = "./m_headup.dsq headUp";
   sequence26 = "./m_armAttack.dsq armAttack";
   sequence27 = "./m_armReadyLeft.dsq armReadyLeft";
   sequence28 = "./m_armReadyRight.dsq armReadyRight";
   sequence29 = "./m_armReadyBoth.dsq armReadyBoth";

   sequence30 = "./m_sit.dsq sit";
};


datablock DebrisData( MinifigCustomDebris )
{
   explodeOnMaxBounce = false;

   elasticity = 0.15;
   friction = 0.5;

   lifetime = 4.0;
   lifetimeVariance = 0.0;

   minSpinSpeed = 40;
   maxSpinSpeed = 600;

   numBounces = 5;
   bounceVariance = 0;

   staticOnMaxBounce = true;
   gravModifier = 1.0;

   useRadiusMass = true;
   baseRadius = 1;

   velocity = 20.0;
   velocityVariance = 12.0;
};     

datablock PlayerData(MiniFigCustomArmor : PlayerStandardArmor)
{
   shapeFile = "./minifig.dts";
   cameraMaxDist = 6;


   
   // Damage location details
   boxNormalHeadPercentage       = 0.83;
   boxNormalTorsoPercentage      = 0.49;
   boxHeadLeftPercentage         = 0;
   boxHeadRightPercentage        = 1;
   boxHeadBackPercentage         = 0;
   boxHeadFrontPercentage        = 1;
 
   uiname = "MiniFig Customizable";


};


function MinifigCustomArmor::onAdd(%this,%obj)
{
   // Vehicle timeout
   %obj.mountVehicle = false;

   // Default dynamic armor stats
   %obj.setRepairRate(0);

}



//called when the driver of a player-vehicle is unmounted
function MinifigCustomArmor::onDriverLeave(%obj, %player)
{
//do nothing
}



package MinifigCustom
{
function gameConnection::applyBodyParts(%client)
{
if(isObject(%client.player))
{
if(%client.player.getDatablock().getID() == MinifigCustomArmor.getID())
{
%client.player.hideNode("ALL");
if(getWord($accentsAllowed[$hat[%client.hat]], %client.accent) !$= "" && getWord($accentsAllowed[$hat[%client.hat]], %client.accent) !$= "none")
%client.player.unHideNode(getWord($accentsAllowed[$hat[%client.hat]], %client.accent));
if($hat[%client.hat] !$= "none")
%client.player.unHideNode($hat[%client.hat]);
%client.player.unHideNode("headSkin");
%client.player.unHideNode($chest[0]);
if($pack[%client.pack] !$= "none")
%client.player.unHideNode($pack[%client.pack]);
%client.player.unHideNode($Larm[0]);
%client.player.unHideNode($Rarm[0]);
%client.player.unHideNode($Lhand[0]);
%client.player.unHideNode($Rhand[0]);
%client.player.setDecalName(%client.decalName);
%client.player.setFaceName(%client.faceName);
return;
}
}
Parent::applyBodyParts(%client);
}
function GameConnection::applyBodyColors(%client)
{
Parent::applyBodyColors(%client);
if(%client.player.dataBlock $= "MiniFigCustomArmor")
{
%client.player.setNodeColor("Rarm",%client.rArmColor);
%client.player.setNodeColor("Larm",%client.lArmColor);
%client.player.setNodeColor("HeadSkin",%client.headcolor);
%client.player.setNodeColor("Lshoe",%client.lLegColor);
%client.player.setNodeColor("Rshoe",%client.rLegColor);
%client.player.setNodeColor("chest",%client.chestColor);
%client.player.setNodeColor("Rhand",%client.rHandColor);
%client.player.setNodeColor("Lhand",%client.lHandColor);
%client.player.setNodeColor("pants",%client.hipColor);
%client.player.setNodeColor("armor",%client.armorColor);
%client.player.setNodeColor("bucket",%client.bucketColor);
%client.player.setNodeColor("cape",%client.capeColor);
%client.player.setNodeColor("pack",%client.packColor);
%client.player.setNodeColor("quiver",%client.quiverColor);
%client.player.setNodeColor("tank",%client.tankColor);
%client.player.setNodeColor("helmet",%client.helmetColor);
%client.player.setNodeColor("pointyHelmet",%client.pointyColor);
%client.player.setNodeColor("flareHelmet",%client.flareHelmetColor);
%client.player.setNodeColor("scoutHat",%client.scoutHatColor);
%client.player.setNodeColor("bicorn",%client.bicornColor);
%client.player.setNodeColor("copHat",%client.copHatColor);
%client.player.setNodeColor("knitHat",%client.knitHatColor);
%client.player.setNodeColor("plume",%client.plumeColor);
%client.player.setNodeColor("triplume",%client.triplumeColor);
%client.player.setNodeColor("septplume",%client.septplumeColor);
%client.player.setNodeColor("helmet",%client.helmetColor);
%client.player.setNodeColor("visor",%client.visorColor);
}
}


};
activatePackage(MinifigCustom);
« Last Edit: November 29, 2016, 07:11:06 PM by Sp0nge80b »

For the legs, try adding
Code: [Select]
%client.player.unHideNode($hip[0]);
%client.player.unHideNode($LLeg[0]);
%client.player.unHideNode($RLeg[0]);
below
Code: [Select]
%client.player.unHideNode($Larm[0]);
%client.player.unHideNode($Rarm[0]);
%client.player.unHideNode($Lhand[0]);
%client.player.unHideNode($Rhand[0]);

You don't need to do any of that packaged stuff.

Just rename your DTS file to "m.dts". This will allow it to work with the default avatar system, the Slayer uniform system, and a couple other things.

You don't need to do any of that packaged stuff.

Just rename your DTS file to "m.dts". This will allow it to work with the default avatar system, the Slayer uniform system, and a couple other things.
How does one do this? I'm also working on a player model, i renamed the file to 'm' and i have the text files, DSQs and face and decal folders copied to my player model's folder with this as the CS file, but my player doesn't have a head

I can unhide the head via console though, but it shouldn't be necessary to have a line of code to unhide the head, so i assume i'm just doing something wrong
« Last Edit: November 29, 2016, 09:45:42 PM by Masterlegodude »

Not sure why the head is missing. Make sure that your naming is consistent with the original model.

Not sure why the head is missing. Make sure that your naming is consistent with the original model.
All nodes and object names were unchanged, i haven't even modified the head in any way


I tried even importing and exporting the default player model without touching ANYTHING and the head still disappears
« Last Edit: December 03, 2016, 07:50:21 AM by Masterlegodude »