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

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...
Yeah, Im rlly rusty on scripting and I thought of trying that at the same time you did, Didnt work and returned the exact same error

How are you calling the function PlayerPowerArmorFrame::T60?


Do PlayerPowerArmorFrame.T60(findClientbyName("SuperFlamininja").player);
And change the code to
Code: [Select]
function PlayerPowerArmorFrame::T60(%this, %player)
{
%player.hideNode("T51_Head");
%player.hideNode("Frame_Head");
%player.unHideNode("T60_Head");
}

Code: [Select]
function PlayerPowerArmorFrame::T60(%this, %obj)
{
%player.hideNode("T51_Head");
%player.hideNode("Frame_Head");
%player.unHideNode("T60_Head");
}
PlayerPowerArmorFrame.T60(findClientbyName(blah).player);
is what you need to do.

I think yall are misunderstanding what im using this for, This is going to be used with a GUI, Not only for private testing, So I need this to detect all the players who try and use this, If you think of a way to do this do tell, Thank you.
EDIT
Still returning the exact same error. Should I try going about this in a seperate ways, I can think of one way which I could do, Fire raycast detect which part of the body it hit and detect which armor peice you have in your hand then hide/unhide the nodes and skip the GUI function all together
« Last Edit: July 09, 2016, 10:24:35 PM by SuperFlaminninja³ »

I think yall are misunderstanding what im using this for, This is going to be used with a GUI, Not only for private testing, So I need this to detect all the players who try and use this, If you think of a way to do this do tell, Thank you.
EDIT
Still returning the exact same error. Should I try going about this in a seperate ways, I can think of one way which I could do, Fire raycast detect which part of the body it hit and detect which armor peice you have in your hand then hide/unhide the nodes and skip the GUI function all together
The function that jes and I just wrote for you is server sided. GUIs are client sided. You need client/server commands if you want the client GUI to be able to communicate with the server.

The function that jes and I just wrote for you is server sided. GUIs are client sided. You need client/server commands if you want the client GUI to be able to communicate with the server.
Yeah, I was going to write in the client/server comunication after I tested that this all works, I just dont want to have to come back and remake the functions, I can handle the GUI section I just cannot figure out how to get this to work without being specific to a certain player where if someone else downloads the GUI and joins the server it wont only be modifying my player.

commandToServer("equipT60Armor"); from the client

on the server side:
function serverCmdEquipT60Armor(%client) {
//stuff
//if stuff is true and %client.player is an object:
PlayerPowerArmor.T60(%client.player);
}

commandToServer("equipT60Armor"); from the client

on the server side:
function serverCmdEquipT60Armor(%client) {
//stuff
//if stuff is true and %client.player is an object:
PlayerPowerArmor.T60(%client.player);
}
Thanks, Sorry I should have defined exactly what I was doing from the start.

The function that jes and I just wrote for you is server sided. GUIs are client sided. You need client/server commands if you want the client GUI to be able to communicate with the server.
Yours will return errors. %obj is the variable used in the function declaration but %player is used below that.

So I tried Fixing this without having to bother someone again, But i'm stumped, The Server Command still returns the same error as before when im using
Code: [Select]
%obj= %player.client; except for when I use
Code: [Select]
%obj = findClientbyName("SuperFlamininja").player;Then it only works with the server command and not the GUI, anyways heres the relevant code
Code: (PowerArmorFrame.cs) [Select]
function serverCmdEquipT60Armor(%client)
{
PlayerPowerArmorFrame.T60(%player.client);
}


function PlayerPowerArmorFrame::T60(%this, %obj)
{
%obj = findClientbyName("SuperFlamininja").player;
%obj.hideNode("T51_Head");
%obj.hideNode("Frame_Head");
%obj.unHideNode("T60_Head");
}
Code: (client.cs) [Select]
function Equip()
{
commandToServer("EquipT60Armor");
}
Code: (PipPowerArmor.gui) [Select]
      new GuiBitmapButtonCtrl() {
         profile = "GuiDefaultProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "84 135";
         extent = "111 45";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         command = "Equip();";
         text = " ";
         groupNum = "-1";
         buttonType = "PushButton";
         bitmap = "./Images/Buttons/EFF/EFFIcon";
         lockAspectRatio = "0";
         alignLeft = "0";
         alignTop = "0";
         overflowImage = "0";
         mKeepCached = "0";
         mColor = "255 255 255 255";
      };

So I tried Fixing this without having to bother someone again, But i'm stumped, The Server Command still returns the same error as before when im using
Code: [Select]
%obj= %player.client; except for when I use
Code: [Select]
%obj = findClientbyName("SuperFlamininja").player;Then it only works with the server command and not the GUI, anyways heres the relevant code
Code: (PowerArmorFrame.cs) [Select]

function PlayerPowerArmorFrame::T60(%this, %obj)
{
%obj = findClientbyName("SuperFlamininja").player;
%obj.hideNode("T51_Head");
%obj.hideNode("Frame_Head");
%obj.unHideNode("T60_Head");
}
You don't want either. "T60" looks like it's supposed to be a method that takes in a player and then calls the appropriate hide and unhide functions. The %obj in the parentheses after the function name is that player, and using either of those lines of code will overwrite it. Using the first one won't work because %player doesn't exist inside that function, let alone %player.client. The second will technically work, but it'd be hardcoded to select you and nobody else, which isn't what you want. Don't overwrite %obj.


Code: (PowerArmorFrame.cs) [Select]
function serverCmdEquipT60Armor(%client)
{
PlayerPowerArmorFrame.T60(%player.client);
}
This part isn't working right either because again, %player is not defined in this function, so you won't be able to get a client from it. Not that you'd want to anyway, because T60 needs a player object to work.

Note how the argument at the top is %client - the user who sent the commandToServer. That's what you have to work with, and the idea is to get their player object from that and hand it off to "T60" so it can do the hiding and unhiding. Shouldn't be too hard to figure that one out.

You should probably also be checking to make sure the player exists and is using the right datablock before you call T60 to prevent errors, and "Equip()" is an extremely ambiguous name for your client script, but one thing at a time here.

snip
Basicly Im just using this as a test and will change the function names latter, However im trying to figure out how to define %obj to be the player in general, And not specific to any certain player, I cannot for the life of me remember how I used to to this i know its
Code: [Select]
%obj = (blank);But I cannot remember what blank is supposed to be. Thank you so much

However im trying to figure out how to define %obj to be the player in general, And not specific to any certain player, I cannot for the life of me remember how I used to to this i know its
Code: [Select]
%obj = (blank);
It's not. Get rid of the "%obj =" line entirely. When you call PlayerPowerArmorFrame.T60( -the player object- ); in your other function, that will start up PlayerPowerArmorFrame::T60(%this, %obj) and because of the function argument you specified, %obj will automatically be set to -the player object- because %obj was the name of the parameter, and the value was given to it when you called it in your other function. Do that, then figure out how to get a player object from a client to fix your other method.