Author Topic: Tattoo Colors  (Read 445 times)

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Tattoo Colors
« Reply #15 on: July 04, 2011, 07:52:45 pm »


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

Function - EffectAreaOfEffect
               
               

               
            

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« Reply #16 on: July 04, 2011, 08:20:09 pm »


               

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?
               
               

               
            

Legacy_Sydious

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Tattoo Colors
« Reply #17 on: July 05, 2011, 03:28:41 am »


               

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?
               
               

               
            

Legacy_Sydious

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


               

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 .