Full Version : Incognito Spell Need little help
xmlspawner >>Scripting Support >>Incognito Spell Need little help
<< Prev | Next >>
Erica- 01-14-2007
Hi just noticed that as a female when you cast Incognito besides that it changes your name and hair look and color hair that it also changes the female into a male now i know this is wrong cause i got a account in osi 7 years account would like to fix it have any clue on what i need changed here

CODE
using System; using System.Collections; using Server; using Server.Mobiles; using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.Spells;
using Server.Spells.Seventh;
namespace Server.Spells.Fifth
{
public class IncognitoSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Incognito", "Kal In Ex",
SpellCircle.Fifth,
206,
9002,
Reagent.Bloodmoss,
Reagent.Garlic,
Reagent.Nightshade
);
public IncognitoSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override bool CheckCast()
{
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1010445 ); // You cannot incognito if you have a sigil
return false;
}
else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
}
else if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
{
Caster.SendLocalizedMessage( 1042402 ); // You cannot use incognito while wearing body paint
return false;
}
return true;
}
public override void OnCast()
{
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1010445 ); // You cannot incognito if you have a sigil
}
else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
else if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
{
Caster.SendLocalizedMessage( 1042402 ); // You cannot use incognito while wearing body paint
}
else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) || Caster.IsBodyMod )
{
DoFizzle();
}
else if ( CheckSequence() )
{
if ( Caster.BeginAction( typeof( IncognitoSpell ) ) )
{
DisguiseGump.StopTimer( Caster );
Caster.BodyMod = Utility.RandomList( 400, 401 );
Caster.HueMod = Utility.RandomSkinHue();
Caster.NameMod = Caster.Body.IsFemale ? NameList.RandomName( "female" ) : NameList.RandomName( "male" );
PlayerMobile pm = Caster as PlayerMobile;
if ( pm != null )
{
if ( pm.Body.IsFemale )
pm.SetHairMods( Utility.RandomList( m_HairIDs ), 0 );
else
pm.SetHairMods( Utility.RandomList( m_HairIDs ), Utility.RandomList( m_BeardIDs ) );
pm.HairHue = Utility.RandomHairHue();
pm.FacialHairHue = Utility.RandomHairHue();
}
Caster.FixedParticles( 0x373A, 10, 15, 5036, EffectLayer.Head );
Caster.PlaySound( 0x3BD );
BaseArmor.ValidateMobile( Caster );
BaseClothing.ValidateMobile( Caster );
StopTimer( Caster );
int timeVal = ((6 * Caster.Skills.Magery.Fixed) / 50) + 1;
if( timeVal > 144 )
timeVal = 144;
TimeSpan length = TimeSpan.FromSeconds( timeVal );
Timer t = new InternalTimer( Caster, length );
m_Timers[Caster] = t;
t.Start();
BuffInfo.AddBuff( Caster, new BuffInfo( BuffIcon.Incognito, 1075819, length, Caster ) );
}
else
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
}
FinishSequence();
}
private static Hashtable m_Timers = new Hashtable();
public static bool StopTimer( Mobile m )
{
Timer t = (Timer)m_Timers[m];
if ( t != null )
{
t.Stop();
m_Timers.Remove( m );
BuffInfo.RemoveBuff( m, BuffIcon.Incognito );
}
return ( t != null );
}
private static int[] m_HairIDs = new int[]
{
0x2044, 0x2045, 0x2046,
0x203C, 0x203B, 0x203D,
0x2047, 0x2048, 0x2049,
0x204A, 0x0000
};
private static int[] m_BeardIDs = new int[]
{
0x203E, 0x203F, 0x2040,
0x2041, 0x204B, 0x204C,
0x204D, 0x0000
};
private class InternalTimer : Timer
{
private Mobile m_Owner;
public InternalTimer( Mobile owner, TimeSpan length ) : base( length )
{
m_Owner = owner;
/*
int val = ((6 * owner.Skills.Magery.Fixed) / 50) + 1;
if ( val > 144 )
val = 144;
Delay = TimeSpan.FromSeconds( val );
* */
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
if ( !m_Owner.CanBeginAction( typeof( IncognitoSpell ) ) )
{
if ( m_Owner is PlayerMobile )
((PlayerMobile)m_Owner).SetHairMods( -1, -1 );
m_Owner.BodyMod = 0;
m_Owner.HueMod = -1;
m_Owner.NameMod = null;
m_Owner.EndAction( typeof( IncognitoSpell ) );
BaseArmor.ValidateMobile( m_Owner );
BaseClothing.ValidateMobile( m_Owner );
}
}
}
}
}

Thanks.
ArteGordon- 01-14-2007
just comment out this line

CODE
Caster.BodyMod = Utility.RandomList( 400, 401 );

Erica- 01-14-2007
Hehe ty i figure it out also do you think i should comment this part out as well

CODE
m_Owner.BodyMod = 0;

Thanks.
ArteGordon- 01-14-2007
that wont really matter if you arent assigning the mod in the first place. It just makes sure that there is no mod when you are done.
Erica- 01-14-2007
Oh ok just notice in osi the spell if female would sometimes change you into a female elf with the female elf hair the same thing for a male would turn you into a elf male with the elf hair any idea what would i add for this to happen randomly .
Erica- 01-14-2007
Hmm not sure if this code would work

CODE
if ( Caster.Body.IsFemale ) Caster.BodyMod = Utility.RandomBool() ? Race.Human.FemaleBody : Race.Elf.FemaleBody; else Caster.BodyMod = Utility.RandomBool() ? Race.Human.MaleBody : Race.Elf.MaleBody;

and not sure where would i put it but now i see that this is not showing as well how to make them change elf and only have elf hair.
ArteGordon- 01-15-2007
you would add this

CODE
if ( Caster.Body.IsFemale ) Caster.BodyMod = Utility.RandomBool() ? Race.Human.FemaleBody : Race.Elf.FemaleBody; else Caster.BodyMod = Utility.RandomBool() ? Race.Human.MaleBody : Race.Elf.MaleBody;

instead of this

CODE
Caster.BodyMod = Utility.RandomList( 400, 401 );

and then in the section that assigns hair

CODE
if ( pm != null ) { if ( pm.Body.IsFemale ) pm.SetHairMods( Utility.RandomList( m_HairIDs ), 0 ); else
pm.SetHairMods( Utility.RandomList( m_HairIDs ), Utility.RandomList( m_BeardIDs ) );
pm.HairHue = Utility.RandomHairHue();
pm.FacialHairHue = Utility.RandomHairHue();
}

you would check the bodymod to see if it was elven and assign the hair accordingly.
Erica- 01-15-2007
Ok im a little confused but the code for elf did work just that i was balded and the elf was getting on other changes human hair so got the elf bodymod working now how would i get the hair of elf working hehe i looked funny tho balded elf and then human hair on elf lol.
ArteGordon- 01-15-2007
change this

CODE
if ( pm != null ) { if ( pm.Body.IsFemale ) pm.SetHairMods( Utility.RandomList( m_HairIDs ), 0 ); else
pm.SetHairMods( Utility.RandomList( m_HairIDs ), Utility.RandomList( m_BeardIDs ) );
pm.HairHue = Utility.RandomHairHue();
pm.FacialHairHue = Utility.RandomHairHue();
}

to look something like

CODE
if (pm != null) { if (pm.Body.IsFemale) { if (pm.BodyMod == Race.Elf.FemaleBody)
pm.SetHairMods(Utility.RandomList(m_ElfHairIDs), 0);
else
pm.SetHairMods(Utility.RandomList(m_HairIDs), 0);
}
else
{
if (pm.BodyMod == Race.Elf.MaleBody)
pm.SetHairMods(Utility.RandomList(m_ElfHairIDs), Utility.RandomList(m_BeardIDs));
else
pm.SetHairMods(Utility.RandomList(m_HairIDs), Utility.RandomList(m_BeardIDs));
}
pm.HairHue = Utility.RandomHairHue();
pm.FacialHairHue = Utility.RandomHairHue();
}

and then you would have to add another array

CODE
private static int[] m_ElfHairIDs = new int[] { 0x2044, 0x2045, 0x2046, 0x203C, 0x203B, 0x203D, 0x2047, 0x2048, 0x2049,
0x204A, 0x0000
};

where you would list the elven hair ids instead of the default human hair ids.
Erica- 01-15-2007
Ah thanks that worked the IDS on hair for elfs at first i put the id elf code you provided then i tested and it was still making elf with human hair but then i looked at code again and realized that those ids were human then i changed the numbers on the ids for elfs and tested it now when you do turn to a elf has elf hair this were the numbers i changed

CODE
private static int[] m_ElfHairIDs = new int[] { 0x2FC0, 0x2FC1, 0x2FC2, 0x2FCC, 0x2FCD, 0x2FCE, 0x2FCF, 0x2FD0, 0x2FD1,
0x2FD2, 0x0000
};

those are the ids elf hair thanks again who knows RunUO SVN probably will add this tho.