Author Topic: Tattoo Colors  (Read 442 times)

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« on: July 03, 2011, 08:32:36 am »


               Is it possible to alter the tattoo colors via script?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Tattoo Colors
« Reply #1 on: July 03, 2011, 08:58:36 am »


               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 .
                     
                  


            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Tattoo Colors
« Reply #2 on: July 03, 2011, 11:00:40 am »


               This might be useful, too: Skin/Hair/Tattoo Colors
               
               

               
            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
Tattoo Colors
« Reply #3 on: July 03, 2011, 05:53:56 pm »


               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. '<img'> The Amethyst Dragon
               
               

               
            

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« Reply #4 on: July 04, 2011, 01:02:38 am »


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

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Tattoo Colors
« Reply #5 on: July 04, 2011, 03:36:39 am »


               'Image

'Image


Nice palette Amethyst Dragon
               
               

               


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


            

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« Reply #6 on: July 04, 2011, 05:38:59 am »


               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 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Tattoo Colors
« Reply #7 on: July 04, 2011, 07:02:40 am »


               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 .
                     
                  


            

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« Reply #8 on: July 04, 2011, 07:07:12 am »


               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 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Tattoo Colors
« Reply #9 on: July 04, 2011, 08:00:29 am »


               Change the

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

same thing with the other if statement.
               
               

               
            

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« Reply #10 on: July 04, 2011, 08:14:52 am »


               Bingo.

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

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Tattoo Colors
« Reply #11 on: July 04, 2011, 08:15:51 am »


               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 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Tattoo Colors
« Reply #12 on: July 04, 2011, 09:21:47 am »


               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);
    }
}
               
               

               
            

Legacy_La Rose Noire

  • Newbie
  • *
  • Posts: 49
  • Karma: +0/-0
Tattoo Colors
« Reply #13 on: July 04, 2011, 05:03:55 pm »


               The Amethyst Dragon is my hero for years.... since I spent a week searching colors and finally finding his beautiful pictures.
               
               

               
            

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« Reply #14 on: July 04, 2011, 07:24:43 pm »


               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 .