Aller au contenu

Photo

Tattoo Colors


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

#1
Sydious

Sydious
  • Members
  • 59 messages
Is it possible to alter the tattoo colors via script?

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
void SetColor(object oObject, int nColorChannel, int nColorValue)

oObject is the target to change. The colour channel can be any of the four following:

COLOR_CHANNEL_TATTOO_1
COLOR_CHANNEL_TATTOO_2
COLOR_CHANNEL_HAIR
COLOR_CHANNEL_SKIN

nColorValue is a number from 0 to 175

Modifié par Failed.Bard, 03 juillet 2011 - 07:59 .


#3
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 880 messages
This might be useful, too: Skin/Hair/Tattoo Colors

#4
ShadowM

ShadowM
  • Members
  • 768 messages
Oh I just like to say I borrowed those and I am going to integrate them into the GUI of HR thanks for making them. :) The Amethyst Dragon

#5
Sydious

Sydious
  • Members
  • 59 messages
Thank you very much. I am once again returning back to NWN and am rusty. Thanks for helping me move my idea forward.

#6
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Image IPB

Image IPB


Nice palette Amethyst Dragon

Modifié par Lightfoot8, 04 juillet 2011 - 04:52 .


#7
Sydious

Sydious
  • Members
  • 59 messages
I added this script to the heartbeat of an area. It is suppose to make the tattoos blink red and white.

they start white...then turn red....then never change again.
any idea what I did wrong?

void main()
{

object oPC = GetFirstPC();

int color;
if (color = 0)
{
SetColor(oPC, COLOR_CHANNEL_TATTOO_1, 62);
SetColor(oPC, COLOR_CHANNEL_TATTOO_2, 62);
color = 1;
}
if (color = 1)
{
SetColor(oPC, COLOR_CHANNEL_TATTOO_1, 52);
SetColor(oPC, COLOR_CHANNEL_TATTOO_2, 52);
color = 0;
}

}

Modifié par Sydious, 04 juillet 2011 - 05:05 .


#8
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
well every time the script runs int color is going to be 0  therefore if(color== 0) will be the only case that ever runs.  and that needs to be a == not a =
in order to pass the color var to the next HB of the script you will need to use a local var.

Also Keep in mind that the Area HB is ran reguardless of PC presence.  So this script will change the colors of the tattoo even when the PC is in a differant area.    To fix that a check to see if the PC is in that area should do.  I am assuming that this is for a single player.

void main()
{
object oPC = GetFirstPC();
if (GetArea(oPC) != OBJECT_SELF) return;
int color = GetLocalInt(OBJECT_SELF,"color");
if (color == 0)
{
SetColor(oPC, COLOR_CHANNEL_TATTOO_1, 62);
SetColor(oPC, COLOR_CHANNEL_TATTOO_2, 62);
}
if (color ==1)
{
SetColor(oPC, COLOR_CHANNEL_TATTOO_1, 52);
SetColor(oPC, COLOR_CHANNEL_TATTOO_2, 52);
}
SetLocalInt(OBJECT_SELF,"color",!color);

}

Modifié par Lightfoot8, 04 juillet 2011 - 07:02 .


#9
Sydious

Sydious
  • Members
  • 59 messages
Yes this is for single player. It has been a long time I used NWN but had to come back. I'm relearning all this again. Much better programer this time but need to test out the waters.
Trying to make the PC's tattoos pulsate when a npc is near. My first script is just me trying to get the things to blink.

I ran your script with same results.

Modifié par Sydious, 04 juillet 2011 - 06:09 .


#10
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Change the

If(color=0)
to if(color==0)

same thing with the other if statement.

#11
Sydious

Sydious
  • Members
  • 59 messages
Bingo.

Well on my way. Thanks for your help on this.

#12
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 880 messages
Let's try a slightly different approach. And I picked a different "red" color that should stand out better.

Goal: Pulsing red/white tattoo when a certain NPC is nearby.

Assumptions for this exercise:
Target NPC's tag: "myskinhurts"
Desired distance for warning: 20 meters (2 tiles)
Normally checked every 18 seconds (3 rounds)
Checked every 6 seconds (1 round) if NPC already detected

Let's use the current module's on enter script to get things started.

---------------------------------------------------------

Above the void main(), let's define a nice little custom function:

// Runs a cycling check to see if an NPC with the sNPCTag is within fMeters distance.
// If yes, oPC's tattoos pulse from red to white or white to red (switching every every fCheckDelay2 seconds)
// fCheckDelay1 is the delay in seconds between checks when the targeted NPC is NOT detected
// fCheckDelay2 is the delay in seconds between checks when the targeted NPC IS detected
//     nTatSaved is a local int that just checks to see if oPC's tattoo has been checked yet, no
//     need to fill it in with anything yourself
void TattooCheck(object oPC, string sNPCTag, float fMeters, float fCheckDelay1, float fCheckDelay2, int nTatSaved=999);
void TattooCheck(object oPC, string sNPCTag, float fMeters, float fCheckDelay1, float fCheckDelay2, int nTatSaved=999)
{
int nTatColor = 999;
float fDelay;
location lPC = GetLocation(oPC);
int nEnemy = 0;
object oEnemyNPC = GetFirstObjectInShape(SHAPE_SPHERE, fMeters, lPC);
while (oEnemyNPC != OBJECT_INVALID)
   {
   if (GetTag(oEnemyNPC) == sNPCTag)
      {
      nEnemy = nEnemy + 1;
      }
   oEnemyNPC = GetNextObjectInShape(SHAPE_SPHERE, fMeters, lPC);
   }
if (nEnemy > 0)
   {
   fDelay = fCheckDelay2;
   if (nTatSaved == 999)
      {
      nTatColor = 62;
      }
   else if (nTatSaved == 62)
      {
      nTatColor = 88;
      }
   else if (nTatSaved == 88)
     {
      nTatColor = 62;
      }
   SetColor(oPC, COLOR_CHANNEL_TATTOO_1, nTatColor);
   SetColor(oPC, COLOR_CHANNEL_TATTOO_2, nTatColor);
   }
else
   {
   fDelay = fCheckDelay1;
   }
DelayCommand(fDelay, TattooCheck(oPC, sNPCTag, fMeters, fCheckDelay1, fCheckDelay2, nTatColor));
}


---------------------------------------------------------

Within the main part of the script, add this (after defining oPC as the entering object):

// Starts the "magic tattoo" cycling 30 seconds after the PC enters the module.
DelayCommand(30.0, AssignCommand(oPC, TattooCheck(oPC, "myskinhurts", 20.0, 18.0, 6.0)));

Modifié par The Amethyst Dragon, 04 juillet 2011 - 06:54 .


#13
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
I would do it similar to Lightfoot8's code, but without the variable.  It's simpler to just check the existing tattoo colour.

void main()
{
object oPC = GetFirstPC();
if (GetArea(oPC) != OBJECT_SELF) return;

int color = GetColor (oPC, COLOR_CHANNEL_TATTOO_1);
if (color == 52)
    {
     SetColor(oPC, COLOR_CHANNEL_TATTOO_1, 62);
     SetColor(oPC, COLOR_CHANNEL_TATTOO_2, 62);
    }
else
    {
     SetColor(oPC, COLOR_CHANNEL_TATTOO_1, 52);
     SetColor(oPC, COLOR_CHANNEL_TATTOO_2, 52);
    }
}

#14
La Rose Noire

La Rose Noire
  • Members
  • 25 messages
The Amethyst Dragon is my hero for years.... since I spent a week searching colors and finally finding his beautiful pictures.

#15
Sydious

Sydious
  • Members
  • 59 messages
Wow! Thanks for all the help all. I didn't expect such a response yet. Good to see the community still alive after all these years. Now if they could only give us the CD keys back I could put in my plat version. I am using the original release disk and key to get back started again. So until they get the CD keys back to us OR i buy a new copy (prob from good ol games) Im stuck without expansions.

So I thought a bit about what I am trying to do and here is my goal.

When the PC gets within x dist from a creature with a hostile faction(s) a visual effect will fire and the tattoos will start blinking. Been thinking of making them blink faster then round by round (6sec) maybe some delays that will change them every sec of hald sec. Or maybe cycle through a bunch of colors.

You guys sure helped me get started. Thanks for all your help!

edit - Or maybe use perception instead of distance.

Modifié par Sydious, 04 juillet 2011 - 06:30 .


#16
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
You may want to look at using an Area of Effect.

Function - EffectAreaOfEffect

#17
Sydious

Sydious
  • Members
  • 59 messages

Lightfoot8 wrote...

You may want to look at using an Area of Effect.

Function - EffectAreaOfEffect


"In some cases, mobile AOE's (Applied to a creature, such as Invisibility Purge or Silence) seem to deactivate if the creature moves too quickly, as it triggers its own On Exit event somehow!"

Is that something I would need to worry about since it would be something on a moving PC?

#18
Sydious

Sydious
  • Members
  • 59 messages

Lightfoot8 wrote...

You may want to look at using an Area of Effect.

Function - EffectAreaOfEffect


Ok. Trying to get my head around EffectAreaOfEffect.

I would use this on the OnEnter of the module?

Then set up 3 scripts that are fired by this function?

Or am I way off base?

#19
Sydious

Sydious
  • Members
  • 59 messages

The Amethyst Dragon wrote...

Let's try a slightly different approach. And I picked a different "red" color that should stand out better.

Goal: Pulsing red/white tattoo when a certain NPC is nearby.

Assumptions for this exercise:
Target NPC's tag: "myskinhurts"
Desired distance for warning: 20 meters (2 tiles)
Normally checked every 18 seconds (3 rounds)
Checked every 6 seconds (1 round) if NPC already detected

Let's use the current module's on enter script to get things started.

---------------------------------------------------------

Above the void main(), let's define a nice little custom function:

// Runs a cycling check to see if an NPC with the sNPCTag is within fMeters distance.
// If yes, oPC's tattoos pulse from red to white or white to red (switching every every fCheckDelay2 seconds)
// fCheckDelay1 is the delay in seconds between checks when the targeted NPC is NOT detected
// fCheckDelay2 is the delay in seconds between checks when the targeted NPC IS detected
//     nTatSaved is a local int that just checks to see if oPC's tattoo has been checked yet, no
//     need to fill it in with anything yourself
void TattooCheck(object oPC, string sNPCTag, float fMeters, float fCheckDelay1, float fCheckDelay2, int nTatSaved=999);
void TattooCheck(object oPC, string sNPCTag, float fMeters, float fCheckDelay1, float fCheckDelay2, int nTatSaved=999)
{
int nTatColor = 999;
float fDelay;
location lPC = GetLocation(oPC);
int nEnemy = 0;
object oEnemyNPC = GetFirstObjectInShape(SHAPE_SPHERE, fMeters, lPC);
while (oEnemyNPC != OBJECT_INVALID)
   {
   if (GetTag(oEnemyNPC) == sNPCTag)
      {
      nEnemy = nEnemy + 1;
      }
   oEnemyNPC = GetNextObjectInShape(SHAPE_SPHERE, fMeters, lPC);
   }
if (nEnemy > 0)
   {
   fDelay = fCheckDelay2;
   if (nTatSaved == 999)
      {
      nTatColor = 62;
      }
   else if (nTatSaved == 62)
      {
      nTatColor = 88;
      }
   else if (nTatSaved == 88)
     {
      nTatColor = 62;
      }
   SetColor(oPC, COLOR_CHANNEL_TATTOO_1, nTatColor);
   SetColor(oPC, COLOR_CHANNEL_TATTOO_2, nTatColor);
   }
else
   {
   fDelay = fCheckDelay1;
   }
DelayCommand(fDelay, TattooCheck(oPC, sNPCTag, fMeters, fCheckDelay1, fCheckDelay2, nTatColor));
}


---------------------------------------------------------

Within the main part of the script, add this (after defining oPC as the entering object):

// Starts the "magic tattoo" cycling 30 seconds after the PC enters the module.
DelayCommand(30.0, AssignCommand(oPC, TattooCheck(oPC, "myskinhurts", 20.0, 18.0, 6.0)));





I figured out how to implement this. This is a lot of what I was thinking of.

I do notice that with this and the other scripts I have made, there will be a flash when the colors change. Almost like a very fast transpartent model slips into place. Any idea what the cause of that is? Am I doing something here that is to taxing for NWN?

Also what would I need to to to use faction instead of a tag?

Modifié par Sydious, 05 juillet 2011 - 04:02 .