Aller au contenu

Photo

GetColor function


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
Snarkblat

Snarkblat
  • Members
  • 52 messages
I've been experimenting a lot lately with the SetColor() and SetCreatureBodyPart() functions. I'd like to know if there's a way to define the PC's colors and apply them to an NPC, making family members for instance. Unfortunately, when I try to define variables, I get a ERROR: MISMATCHED TYPES error message.

Is there a better way? Or is the GetColor function patently useless to builders?

Here's what I have so far.

//Mom! Dad!
void main()
{

object oPC = GetFirstPC();

object oSkin = GetColor(oPC, COLOR_CHANNEL_SKIN);
object oHair = GetColor(oPC, COLOR_CHANNEL_HAIR);
object oTat1 = GetColor(oPC, COLOR_CHANNEL_TATTOO_1);
object oTat2 = GetColor(oPC, COLOR_CHANNEL_TATTOO_2);

SetColor(OBJECT_SELF, COLOR_CHANNEL_SKIN, oSkin);
SetColor(OBJECT_SELF, COLOR_CHANNEL_HAIR, oHair);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_1, oTat1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_2, oTat2);

}

Modifié par Snarkblat, 24 juin 2011 - 01:31 .


#2
Calvinthesneak

Calvinthesneak
  • Members
  • 656 messages
Probably need to use ints? I don't think colours count as objects.

Lexicon is your friend.  http://palmergames.c...n.GetColor.html

Modifié par Calvinthesneak, 24 juin 2011 - 01:43 .


#3
Snarkblat

Snarkblat
  • Members
  • 52 messages
Then how do I save the PC's color as a variable?

#4
ShadowM

ShadowM
  • Members
  • 768 messages
Because it a int it be something like this I think
int iSkin = GetColor(oPC, COLOR_CHANNEL_SKIN);
int iHair = GetColor(oPC, COLOR_CHANNEL_HAIR);
int iTat1 = GetColor(oPC, COLOR_CHANNEL_TATTOO_1);
int iTat2 = GetColor(oPC, COLOR_CHANNEL_TATTOO_2);

SetColor(OBJECT_SELF, COLOR_CHANNEL_SKIN, iSkin);
SetColor(OBJECT_SELF, COLOR_CHANNEL_HAIR, iHair);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_1, iTat1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_2, iTat2);

#5
Snarkblat

Snarkblat
  • Members
  • 52 messages
Thank you, ShadowM! I plugged the script in and it worked like a charm. I didn't know about saving variables as ints until now.

Well this has certainly been illuminating. Think of the possibilities! I'm off to make a module where every time the PC "sows his seed" an illegitimate child that looks just like him shows up on his doorstep. >:D

#6
Xardex

Xardex
  • Members
  • 217 messages
FYI, variables can be int, float, string, object, effect, itemproperty, location, vector and the illusive struct. If you get a mismatch error you propably have a wrong variable in the wrong place, or you compare two different types of variables in an if statement.

Modifié par Xardex, 24 juin 2011 - 03:32 .