Vert-I-Go

Member
ServUO Version
Publish Unknown
Ultima Expansion
None
Ok I have a pretty interesting script here making a very defensive or avoidance type creature an Electrum Dragon it summons children and them polymophs self into a child to hide among them. just trying to figure out how to do a name mod so his name changes temp until timer is up ill upload scrip. you can see all the stuff put in script just playing around with see what all i can do.
There is alot of custom things in this script so its not from a stock RunUO 2.6 Server so dont need to get to involved in the script just looking for basic help with name mod lol
 

Attachments

  • ElectrumDragon.cs
    21.6 KB · Views: 4
First add a new field for name mod
C#:
public override bool InitialInnocent{ get{ return true; } }

// name mod
private string nameMod;
            
[Constructable]

Then add two methods in the Dragon, double check I used the proper Utility.Random for names, edit this if I picked the wrong one, free handing this from memory! 'Utility.RandomNameList();'
C#:
        public void HideName()
        {
            nameMod = Name;

            Name = Utility.RandomNameList();
        }

        public void UnHideName()
        {
            if (string.IsNullOrEmpty(nameMod)) return;

            Name = nameMod;
        }

Then add calls to the new method, first do the turn to kid part!
C#:
public void Polymorph( Mobile m )
{
    if ( !m.CanBeginAction( typeof( PolymorphSpell ) ) || !m.CanBeginAction( typeof( IncognitoSpell ) ) || m.IsBodyMod )
        return;

    if ( m.BeginAction( typeof( PolymorphSpell ) ) )
    {
        m.BodyMod = Utility.RandomList( 422, 429, 440, 441 );
        m.HueMod = 0;

        //name mod
        HideName();

        new ExpirePolymorphTimer( m ).Start();
    }
}

And then so the polymorph End part!
C#:
private class ExpirePolymorphTimer : Timer
{
    private Mobile m_Owner;

    public ExpirePolymorphTimer( Mobile owner ) : base( TimeSpan.FromMinutes( 3.0 ) )
    {
        m_Owner = owner;

        Priority = TimerPriority.OneSecond;
    }

    protected override void OnTick()
    {
        if ( !m_Owner.CanBeginAction( typeof( PolymorphSpell ) ) )
        {
            // name mod
            ElectrumDragon ed = m_Owner as ElectrumDragon;
            ed.UnHideName();

            m_Owner.BodyMod = 0;
            m_Owner.HueMod = -1;
            m_Owner.EndAction( typeof( PolymorphSpell ) );
        }
    }
}
 

Active Shards

Donations

Total amount
$0.00
Goal
$500.00
Back