Author Topic: [fixed] setNodeColor refuses to work in this package  (Read 869 times)

Quote
function WheelyVehicleColors(%obj,%color)
{
   %color0   = vectorScale(%color,"0.8 0.8 0.8 1") SPC 1;
   %obj.setNodeColor("chairRhand",%color);
   %obj.setNodeColor("chairLhand",%color);
   %obj.setNodeColor("chairLarm",%color0);
   %obj.setNodeColor("chairRarm",%color0);
   %obj.setNodeColor("chairLfoot",%color0);
   %obj.setNodeColor("chairRfoot",%color0);
   %obj.setNodeColor("chairBody",%color);
   %obj.setNodeColor("chairPants",%color);
   %color1 = "0.45 0.45 0.45 1";
   %color2 = "0.21 0.21 0.21 1";
   %color3 = "0.30 0.30 0.30 1";
   %obj.setNodeColor("chairFrame",%color1);
   %obj.setNodeColor("chairHandle",%color2);
   %obj.setNodeColor("RWheel",%color2);
   %obj.setNodeColor("LWheel",%color2);
   %obj.setNodeColor("RRStock",%color2);
   %obj.setNodeColor("LRStock",%color2);
   %obj.setNodeColor("RSWheel",%color3);
   %obj.setNodeColor("LSWheel",%color3);
   %obj.setNodeColor("RBWheel",%color3);
   %obj.setNodeColor("LBWheel",%color3);
}

deactivatepackage(WheelyPlayerPackage);
package WheelyPlayerPackage
{
   function ShapeBase::setNodeColor(%obj,%node,%color)
    {
   
   %dumbstuff = getSubstr(%node,0,1) @ getSubstr(%node,1,1) @ getSubstr(%node,2,1);//"ALL" doesnt return properly and corrects to "All" so im converting it into string in an ass backwards way (which works completely)


      if(%dumbstuff $= "ALL" && %obj.getdataBlock().getname() $= "WheelyArmor")
       {
         WheelyVehicleColors(%obj,%color); //this sets the colors accordingly (its not working in the package)
         %obj.setvelocity("0 0 10");
         echo(%dumbstuff SPC %color SPC %obj);
       }
        return parent::setNodeColor(%obj,%node,%color);
    }
};
activatepackage(WheelyPlayerPackage);

I have a bot which uses no materials whatsoever, its solely relied on nodes to recolor itself. I'm trying to package setNodeColor so whenever the %node argument is "ALL", instead of changing all of the nodes to that one color it changes them to their appropriate color. (the function is WheelyVehicleColor.) The function works if execute it in the console with an object and color, but not in the package.
« Last Edit: August 29, 2017, 06:08:50 PM by Trogtor »

parent goes BEFORE, not after. fixed it
« Last Edit: August 29, 2017, 07:34:12 PM by Trogtor »