Author Topic: Why isnt this hiding nodes?  (Read 3292 times)

I cant figure out why the 1st(green) part of this code is hiding all nodes but the frame, But when i try and command the 2nd (Red) part it returns this in console
Code: [Select]
==>PlayerPowerArmorFrame::T60();

Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (64): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (65): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (0): Unable to find object: '' attempting to call function 'unHideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60

Quote
datablock TSShapeConstructor(PlayerPowerArmorFrameDTS)
{
   baseShape = "./PowerArmorFrame.dts";
   sequence0 = "./player_root.dsq root";
   sequence1 = "./player_run.dsq run";
   sequence2 = "./player_run.dsq walk";
   sequence3 = "./player_back.dsq back";
   sequence4 = "./player_side.dsq side";

   sequence5  = "./player_look.dsq look";
};

datablock PlayerData(PlayerPowerArmorFrame : PlayerStandardArmor)
{
   shapeFile = "./PowerArmorFrame.dts";
   boundingBox = "5 5 10.5";
   crouchboundingBox = "5 5 10.5";
   canJet = 0;
   uiName = "Power Armor Frame";
   maxDamage = 1500;
   
   maxTools = 3; 
   maxWeapons = 6;
};

function PlayerPowerArmorFrame::onAdd(%this, %obj)
{
   //T60
   %obj.hideNode("T60_Head");
   %obj.hideNode("T60_LArm");
   %obj.hideNode("T60_LFoot");
   %obj.hideNode("T60_LHand");
   %obj.hideNode("T60_Pants");
   %obj.hideNode("T60_RArm");
   %obj.hideNode("T60_RFoot");
   %obj.hideNode("T60_RHand");
   %obj.hideNode("T60_Torso");

   //T51
   %obj.hideNode("T51_Head");
   %obj.hideNode("T51_LArm");
   %obj.hideNode("T51_LFoot");
   %obj.hideNode("T51_LHand");
   %obj.hideNode("T51_Pants");
   %obj.hideNode("T51_RArm");
   %obj.hideNode("T51_RFoot");
   %obj.hideNode("T51_RHand");
   %obj.hideNode("T51_Torso");

   //X-01
   %obj.hideNode("X-01_Head");
   %obj.hideNode("X-01_LArm");
   %obj.hideNode("X-01_LFoot");
   %obj.hideNode("X-01_LHand");
   %obj.hideNode("X-01_Pants");
   %obj.hideNode("X-01_RArm");
   %obj.hideNode("X-01_RFoot");
   %obj.hideNode("X-01_RHand");
   %obj.hideNode("X-01_Torso");
}

   
   function PlayerPowerArmorFrame::T60(%this, %obj)
{
   %obj.hideNode("T51_Head");
   %obj.hideNode("Frame_Head");
   %obj.unHideNode("T60_Head");
}

don't know much about addon coding but i think that indent isn't supposed to be there before the function

er, thats not how you call those kinds of functions

given an object whose datablock is the powerarmor, call %obj.T60();. That or PlayerPowerArmorFrame.T60(%player); where %player is a player with the datablock PlayerPowerArmor

I cant figure out why the 1st(green) part of this code is hiding all nodes but the frame, But when i try and command the 2nd (Red) part it returns this in console

When you define methods on objects, ie Object::method(%this), you should call it using object.method();, just in case you didn't know.
« Last Edit: July 08, 2016, 12:50:29 AM by Cruxeis »

cruxeis, its %obj.function(%a); for function Obj::function(%this, %a);

Still returning the same error.

Still returning the same error.
you need to show us how you're calling it

given a player object with the power armor datablock, call PlayerPowerArmorFrame.T60(%player);

cruxeis, its %obj.function(%a); for function Obj::function(%this, %a);
I knew that
Thanks no sleep lol
« Last Edit: July 08, 2016, 12:50:06 AM by Cruxeis »

Code: [Select]
==>PlayerPowerArmorFrame.T60(%player);

Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (64): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (65): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (0): Unable to find object: '' attempting to call function 'unHideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60

==>%obj.T60();

<input> (0): Unable to find object: '' attempting to call function 'T60'
BackTrace: ->ConsoleEntry::eval

Code: [Select]
==>PlayerPowerArmorFrame.T60(%player);

Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (64): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (65): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (0): Unable to find object: '' attempting to call function 'unHideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60

==>%obj.T60();

<input> (0): Unable to find object: '' attempting to call function 'T60'
BackTrace: ->ConsoleEntry::eval
You're apparently putting it in the console and expecting the variables to materialize out of nowhere. The first one is the appropriate way to do it, but you need an actual player instead of %player, which is an undefined variable. In a script, you'd need to store the player in question to %player beforehand, but if you're just testing it on yourself in the console, you can replace that with findClientByName("your name").player.

Code: [Select]
==>PlayerPowerArmorFrame.T60(%player);

Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (65): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (66): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (0): Unable to find object: '' attempting to call function 'unHideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60

Code: [Select]
==>PlayerPowerArmorFrame.T60(%player);

Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (65): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (66): Unable to find object: '' attempting to call function 'hideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60


Add-Ons/System_FalloutRPG/playerType/PowerArmorFrame/PowerArmorFrame.cs (0): Unable to find object: '' attempting to call function 'unHideNode'
BackTrace: ->ConsoleEntry::eval->PlayerPowerArmorFrame::T60
You can't just do the same thing over and over and expect different results without changing anything. You need to replace %player with findClientbyName("yourName").player.

You can't just do the same thing over and over and expect different results without changing anything. You need to replace %player with findClientbyName("yourName").player.
stuff i forgot to post the script
Code: [Select]
function PlayerPowerArmorFrame::T60(%this, %obj)
{
%player = %client.player;
%player.hideNode("T51_Head");
%player.hideNode("Frame_Head");
%player.unHideNode("T60_Head");
}
Also said the same exact error when i did
Code: [Select]
%player = findClientbyName("SuperFlamininja").player;
« Last Edit: July 09, 2016, 03:30:27 PM by SuperFlaminninja³ »

Well it finally worked oddly, With the %player = findClientbyName("SuperFlamininja").player;, Is there anyway to make this work with all the players?

Instead of this:

Code: [Select]
%player = %client.player;

Try this:

Code: [Select]
%player = %obj;

Because %obj should be referring to the player in this case anyway...
« Last Edit: July 09, 2016, 03:55:27 PM by Rally »