Author Topic: Changing a color for a player?  (Read 1568 times)

Ok I am working on some code so that when a player first spawn's your player Avatar is set to A color set. I got them working except for the following the one's with a ~~ after don't work.

The code so far.
Code: [Select]
package coloronspawn
{
 function GameConnection::OnClientEnterGame(%obj.client.player)
  {
   %client.player.setNodeColor("chest","1 500 1 1");
      %client.player.setNodeColor("accent","1 500 1 1"); ~~
      %client.player.setNodeColor("hat","1 1 1 1"); ~~
      %client.player.setNodeColor("pants","1 500 1 1");
      %client.player.setNodeColor("lhand","205 170 125 255 ");
      %client.player.setNodeColor("rhand","205 170 125 255 ");
      %client.player.setNodeColor("larm","1 500 1 1");
      %client.player.setNodeColor("rarm","1 500 1 1");
      %client.player.setNodeColor("lshoe","163 91 71 255");
      %client.player.setNodeColor("rshoe","163 91 71 255");
      %client.player.setNodeColor("secondPack","163 91 71 255"); ~~
      %client.player.setNodeColor("pack","163 91 71 255"); ~~
   Package::OnClientEnterGame(%client, %this, %obj, %col,)
}
};
activatepackage(ColorOnSpawn);
« Last Edit: July 07, 2008, 06:18:17 PM by Kunit_Yo »

Yeah this won't work for a number of reasons:

1. You've used numbers like 500 (?) for a color system that ranges from 0 to 1.
2. What if they're using non-standard body parts?
3. Why is %obj.client.player a parameter?
4. You're using the onCollision parameters in the parent call which looks to also be giving you syntax errors?

Maybe you should head back to the basics or something.

Weird thing is it work's :O except for those couple. And the suggestion to the basics this is basics D: only thing I have done that isn't really easy was a couple function's for my Mod Code that is a pain to work on due to people bugging me every second asking if I am going to release. D:

I refuse to accept that the code you posted above works.

%client.player is not even an established value!

If I put this into my game I expect i'd just crash.

Yeah, this isn't really the basics. Master simpler console lines before you tackle something like this. It'll come with time.

I'm sure even people like Ephi started with the basics. No shame in that.

Code: [Select]
package coloronspawn
{
function GameConnection::OnClientEnterGame(%client)
{
%client.player.setNodeColor("chest","0 1 0 1");
%client.player.setNodeColor("accent","0 1 0 1");
%client.player.setNodeColor("hat","1 1 1 1");
%client.player.setNodeColor("pants","0 1 0 1");
%client.player.setNodeColor("lhand","1 0.7 0.5 1");
%client.player.setNodeColor("rhand","1 0.7 0.5 1");
%client.player.setNodeColor("larm","0 1 0 1");
%client.player.setNodeColor("rarm","0 1 0 1");
%client.player.setNodeColor("lshoe","1 .6 .5 1");
%client.player.setNodeColor("rshoe","1 .6 .5 1");
%client.player.setNodeColor("secondPack","1 .6 .5 1");
%client.player.setNodeColor("pack","1 .6 .5 1");
[b]Parent[/b]::OnClientEnterGame(%client)
}
};
activatepackage(ColorOnSpawn);


Whew, that was horrid :D. Your highest numbers in the setnodecolor should be 1. Then do reletive amounts in ratios. Example: 1 .6 .5 blue is 50% as much as red and green is 60% as much as it. Also, you put a package where the parent should be (bold). And to top it off, you used wrong arguments. if your only going to use %client.player you only need %client as an argument. Never use %blah.blah. There should never be periods in your arguments. Hope I helped ya.

Bling, I believe it works with either 255 or 1 for colors. He was doing MOST of it correctly.

Also I don't think you fixed his problems.

Ok...Thank's for polishing it bling :D but falcon is right Im not shure why but accent, hat, pack, and secondpack don't recolor at all.

Because you can change the accent node used. There's more than one.

I'd tell you how to do it but I think you should be able to find that in a past script. Think of something that uses coloring players and check it out.

Bling, I believe it works with either 255 or 1 for colors. He was doing MOST of it correctly.

Also I don't think you fixed his problems.

No, The part colors are only 0 to 1. Its the same with particle colors. You'll learn where to use the two formats with time

I'm sure even people like Ephi started with the basics. No shame in that.
As I said earlier, I just sacrificed an assortment of farmyard animals to the Dark Lord in order to gain my extensive knowledge.

Meh, Ill look at fooly's cmd or somthing I can't right now but I can 2 marrow.

No, The part colors are only 0 to 1. Its the same with particle colors. You'll learn where to use the two formats with time
Oh whoops. I haven't messed with nodes or particles enough, apparently.
As I said earlier, I just sacrificed an assortment of farmyard animals to the Dark Lord in order to gain my extensive knowledge.
This includes spaceship cows, I assume.

Ah I thought it was 1-255 as well.