Tattoo Colors
#1
Posté 03 juillet 2011 - 07:32
#2
Posté 03 juillet 2011 - 07:58
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
Posté 03 juillet 2011 - 10:00
#4
Posté 03 juillet 2011 - 04:53
#5
Posté 04 juillet 2011 - 12:02
#6
Posté 04 juillet 2011 - 02:36
#7
Posté 04 juillet 2011 - 04:38
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
Posté 04 juillet 2011 - 06:02
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
Posté 04 juillet 2011 - 06:07
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
Posté 04 juillet 2011 - 07:00
If(color=0)
to if(color==0)
same thing with the other if statement.
#11
Posté 04 juillet 2011 - 07:14
Well on my way. Thanks for your help on this.
#12
Posté 04 juillet 2011 - 07:15
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
Posté 04 juillet 2011 - 08:21
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
Posté 04 juillet 2011 - 04:03
#15
Posté 04 juillet 2011 - 06:24
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
Posté 04 juillet 2011 - 06:52
#17
Posté 04 juillet 2011 - 07:20
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
Posté 05 juillet 2011 - 02:28
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
Posté 05 juillet 2011 - 03:47
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 .





Retour en haut









