little help please.
#1
Posté 12 décembre 2010 - 01:24
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int nGlow;
object oObject = GetFirstObjectInArea(OBJECT_SELF);
while(oObject != OBJECT_INVALID)
{
if(GetTag(oObject) == "glow_item" && GetLocalInt(oObject,"GLOW") == 0)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_BLUE),oObject);
SetLocalInt(oObject,"GLOW",1);
}
oObject = GetNextObjectInArea(OBJECT_SELF);
}
}
what i would like help with is making it more versitile, making it be able to handle multiple colors via variables on the placeables.
example: GLOW_BLUE int 1, GLOW_RED int 2, GLOW_GREEN int 3, ect...
not so good at doing variables such as this and have nothing to base an attempt off, so any help would be appreciated.
of course, if theres an even easier way to do this type of script, thats always welcome as well.
thanks
#2
Posté 12 décembre 2010 - 01:53
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int nGlow, nColor;
object oObject = GetFirstObjectInArea(OBJECT_SELF);
while(oObject != OBJECT_INVALID)
{
if(GetTag(oObject) == "glow_item" && GetLocalInt(oObject,"GLOW") == 0)
{
nColor = GetLocalInt(oObject, "COLOR_GLOW");
switch(nColor)
{
case 0://glow blue
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_BLUE),oObject);
SetLocalInt(oObject,"GLOW",1);
break;
case 1://glow green
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_GREEN),oObject);
SetLocalInt(oObject,"GLOW",1);
break;
case 2://glow orange
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_ORANGE),oObject);
SetLocalInt(oObject,"GLOW",1);
break;
case 3://glow purple
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_PURPLE),oObject);
SetLocalInt(oObject,"GLOW",1);
break;
case 4://glow red
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_RED),oObject);
SetLocalInt(oObject,"GLOW",1);
break;
case 5://glow white
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_WHITE),oObject);
SetLocalInt(oObject,"GLOW",1);
break;
case 6://glow yellow
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_GLOW_YELLOW),oObject);
SetLocalInt(oObject,"GLOW",1);
break;
default:
break;
}
}
oObject = GetNextObjectInArea(OBJECT_SELF);
}
}
Modifié par Baragg, 12 décembre 2010 - 01:56 .
#3
Posté 12 décembre 2010 - 02:29
#4
Posté 12 décembre 2010 - 02:30
int GetGlowFromTag(string sTag)
{
if (sTag=="GLOW_LIGHT_BLUE") return VFX_DUR_GLOW_LIGHT_BLUE;
if (sTag=="GLOW_PURPLE") return VFX_DUR_GLOW_PURPLE;
if (sTag=="GLOW_RED") return VFX_DUR_GLOW_RED;
if (sTag=="GLOW_LIGHT_RED") return VFX_DUR_GLOW_LIGHT_RED;
if (sTag=="GLOW_YELLOW") return VFX_DUR_GLOW_YELLOW;
if (sTag=="GLOW_LIGHT_YELLOW") return VFX_DUR_GLOW_LIGHT_YELLOW;
if (sTag=="GLOW_GREEN") return VFX_DUR_GLOW_GREEN;
if (sTag=="GLOW_LIGHT_GREEN") return VFX_DUR_GLOW_LIGHT_GREEN;
if (sTag=="GLOW_ORANGE") return VFX_DUR_GLOW_ORANGE;
if (sTag=="GLOW_LIGHT_ORANGE") return VFX_DUR_GLOW_LIGHT_ORANGE;
if (sTag=="GLOW_BROWN") return VFX_DUR_GLOW_BROWN;
if (sTag=="GLOW_LIGHT_BROWN") return VFX_DUR_GLOW_LIGHT_BROWN;
if (sTag=="GLOW_GREY") return VFX_DUR_GLOW_GREY;
if (sTag=="GLOW_WHITE") return VFX_DUR_GLOW_WHITE;
if (sTag=="GLOW_LIGHT_PURPLE") return VFX_DUR_GLOW_LIGHT_PURPLE;
return VFX_DUR_GLOW_BLUE; // Default color if a correct one is not found.
}
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
//int nGlow;// This was never used in the script.
string sTag;
object oObject = GetFirstObjectInArea(OBJECT_SELF);
while(oObject != OBJECT_INVALID)
{
sTag=GetStringUpperCase(GetTag(oObject));
if( GetStringLeft(sTag,5) == "GLOW_" && GetLocalInt(oObject,"GLOW") == 0)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(GetGlowFromTag(sTag)),oObject);
SetLocalInt(oObject,"GLOW",1);
}
oObject = GetNextObjectInArea(OBJECT_SELF);
}
}
Your tags will not need the number just use the color you want.
example: GLOW_BLUE , GLOW_RED , GLOW_GREEN , Glow_Purple ect...
#5
Posté 12 décembre 2010 - 04:50
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect((408+Random(16)),oObject);
to get a random glow color.
#6
Posté 12 décembre 2010 - 05:10
if (sTag=="GLOW_RANDOM") return random(16)+408;
To the GetGlowFromTag function to do the same thing.
Modifié par Lightfoot8, 12 décembre 2010 - 05:11 .
#7
Posté 12 décembre 2010 - 09:10
#8
Posté 12 décembre 2010 - 01:13





Retour en haut







