RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Help

Help

A while ago, I released a Jhelom Pit Warrior script under a different name. I've recently updated it, but I'm still not sure how to make the mobiles hireable. Any help on this would be appreciated. And before anyone brings it up, yes I know all of the hireables were covered by someone a long while back. This is just my version. Please help.
 

Phantom

Knight
WanderingRage said:
A while ago, I released a Jhelom Pit Warrior script under a different name. I've recently updated it, but I'm still not sure how to make the mobiles hireable. Any help on this would be appreciated. And before anyone brings it up, yes I know all of the hireables were covered by someone a long while back. This is just my version. Please help.

Have you looked at the default scripts, to see how to make a hireable npc?

I have no idea, after dealing with modifications to hire npcs, if it ever made it into the release.
 
Phantom

I know there's a way to make Hireables because, like I said, all of the hireable scripts were released a while back. Phantom, while I respect the help you give some people, I also personally think you are a major ***hole. I had thought Ryan was considering banning you a bit back. Oh well. I think it would have been better without you. Please don't try to help me. No disrespect intended.
 

Phantom

Knight
WanderingRage said:
I know there's a way to make Hireables because, like I said, all of the hireable scripts were released a while back. Phantom, while I respect the help you give some people, I also personally think you are a major ***hole. I had thought Ryan was considering banning you a bit back. Oh well. I think it would have been better without you. Please don't try to help me. No disrespect intended.

Ryan did ban me, he banned me for 3 months, he unbanned me in May. I am back, so deal with it. If you don't want my help, tough, your going to get it. I have given you the upmost respect, and you talk to me like that, thats just not cool.

Anyways like I thought, the default release doesn't have hireables, all it has is an escort npc. So your going to have to write the base code to make certain npcs hirable. Unless you can show me otherwise, I didn't look for it except in the most obvious places, I am sticking with this answer.
 

TMSTKSBK

Lord
Riiight...

How about you answer his questions? They're perfectly valid.

//meh...if there are no hireables, then these questions are moot.
Have you looked at the scripts for hireables?
Have you tried to create a hireable from another hireable?

Ryan did ban Phantom. He's back. He's changed. Don't diss him just cause you feel like it.
 
TMSTKSBK said:
No disrespect my @$$!

How about you answer his questions? They're perfectly valid.

Have you looked at the scripts for hireables?
Have you tried to create a hireable from another hireable?

Ryan did ban Phantom. He's back. He's changed. Don't diss him just cause you feel like it.


Don't comment if you don't know. There is NO stock hireable system. Can't do that.
 

Phantom

Knight
WanderingRage said:
Don't comment if you don't know. There is NO stock hireable system. Can't do that.

So what do you want?

Do you have code we can help you with, do you need some information, what exactly do you want from this support forum?
 

Phantom

Knight
WanderingRage said:
Oh, I know that, but from evaluating past experiences, I just don't want his help. Again Phantom, no disrespect.

You have offended me, which is why I will be allowing the moderators to deal with you.

Till they do, I am going to help you, so deal with it.
 

Phantom

Knight
WanderingRage said:
I'm just requesting if anyone has the code from the original hireables script posted a long time ago.

Forum Rules:

Do not request scripts anywhere on the forum. Attempt to write it yourself, the friendly master scripters of the Script Support forum will be glad to help out, and you will learn something from it. This also means that you are not to request that somebody show you where another thread, post, or script is located. Find it yourself or do without.

Can we help you with something that doesn't break the rules. Are you willing to rewrite the system yourself?
 
I am if you're willing to help. See, I acknowledge your skills Phantom. I just think you can be a jerk sometimes. I also don't see how you can bring the moderators into it. I'm not hasseling you. I'm just stating my personal opinion of you.
 

Phantom

Knight
WanderingRage said:
I am if you're willing to help. See, I acknowledge your skills Phantom. I just think you can be a jerk sometimes. I also don't see how you can bring the moderators into it. I'm not hasseling you. I'm just stating my personal opinion of you.

Yes you are hasseling me, you told me you think I am an asshole, when I showed you no attitude whats so ever. You have posted rude posts towards TMSTKSBK, who knows more then most people here, so back on topic what do you need help with. This is a script support forum, within he forum rules, what can we help you with.
 

TMSTKSBK

Lord
Well then you have a problem.

You don't know where to start.

:p

Maybe Phantom'll give us some ideas.

Phantom said:
TMSTKSBK, who knows more then most people here
I'm flattered, but I wouldn't say that's necessarily true...I'm probably in the 70th percentile on this forum knowledge-wise. :)


P=800th!
 
Yes, back to topic. Phantom, I do need your help, whether I like you or not. The only thing I know is that I have to make a BaseHireable file. I'm just not even close to figuring out what I have to include in it.
 

Phantom

Knight
Write a Base class that has the given variables you will need. Write a few methods to calculate a price.

After you do that we will talk.
 

Packer898

Knight
Hopefully im not stepping on anyones toes here... But I hope this helps. This is a base class for hirables. Then just make the actual npc's to suit your needs.

Code:
using System; 
using Server; 
using System.Collections; 
using Server.Items; 
using Server.ContextMenus; 
using Server.Misc; 
using Server.Mobiles; 
using Server.Network; 

namespace Server.Mobiles 
{ 
    public class BaseHire : BaseCreature 
    { 
        private int m_Pay = 1; 
        private bool m_IsHired; 
        private int m_HoldGold = 8; 
        private Timer m_PayTimer; 
        
        public BaseHire( AIType   AI ): base( AI, FightMode.Agressor, 10, 1, 0.1, 4.0 ) 
        { 
        } 

        public BaseHire(): base( AIType.AI_Melee, FightMode.Agressor, 10, 1, 0.1, 4.0 ) 
        { 
        } 

        public BaseHire( Serial serial ) : base( serial ) 
        { 
        } 

        public override void Serialize( GenericWriter writer ) 
        { 
            base.Serialize( writer ); 

            writer.Write( (int) 0 ); // version 
          
            writer.Write( (bool)m_IsHired ); 
            writer.Write( (int)m_HoldGold ); 
        } 

        public override void Deserialize( GenericReader reader ) 
        { 
            base.Deserialize( reader ); 

            int version = reader.ReadInt(); 
          
            m_IsHired = reader.ReadBool(); 
            m_HoldGold = reader.ReadInt(); 
          
            m_PayTimer = new PayTimer( this ); 
            m_PayTimer.Start(); 

        } 

        private static Hashtable m_HireTable = new Hashtable(); 

        public static Hashtable HireTable 
        { 
            get{ return m_HireTable; } 
        } 

        public override bool KeepsItemsOnDeath{ get{ return true; } } 
        private int m_GoldOnDeath = 0; 
        public override bool OnBeforeDeath() 
        { 
            // Stop the pay timer if its running 
            if( m_PayTimer != null ) 
                m_PayTimer.Stop(); 

            m_PayTimer = null; 

            // Get all of the gold on the hireling and add up the total amount 
            if( this.Backpack != null ) 
            { 
                Item[] AllGold = this.Backpack.FindItemsByType( typeof(Gold), true ); 
                if( AllGold != null ) 
                { 
                    foreach( Gold g in AllGold ) 
                        this.m_GoldOnDeath += g.Amount; 
                } 
            } 

            return base.OnBeforeDeath(); 

        } 

        public override void OnDeath( Container c ) 
        { 

            if( this.m_GoldOnDeath > 0 ) 
                c.DropItem( new Gold( this.m_GoldOnDeath ) ); 
            base.OnDeath( c ); 
        } 

        [CommandProperty( AccessLevel.Administrator )] 
        public bool IsHired 
        { 
            get 
            { 
                return m_IsHired; 
            } 
            set 
            { 
                if ( m_IsHired== value ) 
                    return; 

                m_IsHired= value; 
                Delta( MobileDelta.Noto ); 
                InvalidateProperties(); 
            } 
        } 

        #region [ GetOwner ] 
        public virtual Mobile GetOwner() 
        { 
            if( !Controled ) 
                return null; 
            Mobile Owner = ControlMaster; 
          
            m_IsHired = true; 
          
            if( Owner == null ) 
                return null; 
          
            if( Owner.Deleted || Owner.Map != this.Map || !Owner.InRange( Location, 30 ) ) 
            { 
                Say( 1005653 ); // Hmmm.  I seem to have lost my master. 
                BaseHire.HireTable.Remove( Owner ); 
                SetControlMaster( null ); 
                return null; 
            } 

            return Owner; 
        } 
        #endregion 

        #region [ AddHire ] 
        public virtual bool AddHire( Mobile m ) 
        { 
            Mobile owner = GetOwner(); 

            if( owner != null ) 
            { 
                m.SendLocalizedMessage( 1043283, owner.Name ); // I am following ~1_NAME~. 
                return false; 
            } 

            if( SetControlMaster( m ) ) 
            { 
                m_IsHired = true; 
                return true; 
            } 
          
            return false; 
        } 
        #endregion 

        #region [ Payday ] 
        public virtual bool Payday( BaseHire m ) 
        { 
            m_Pay = (int)m.Skills[SkillName.Anatomy].Value + (int)m.Skills[SkillName.Tactics].Value; 
            m_Pay += (int)m.Skills[SkillName.Macing].Value + (int)m.Skills[SkillName.Swords].Value; 
            m_Pay += (int)m.Skills[SkillName.Fencing].Value + (int)m.Skills[SkillName.Archery].Value; 
            m_Pay += (int)m.Skills[SkillName.MagicResist].Value + (int)m.Skills[SkillName.Healing].Value; 
            m_Pay += (int)m.Skills[SkillName.Magery].Value + (int)m.Skills[SkillName.Parry].Value;
		m_Pay /= 35; 
		m_Pay += 1;
            return true; 
        } 
        #endregion 

        #region [ OnDragDrop ] 
        public override bool OnDragDrop( Mobile from, Item item ) 
        { 
            if( m_Pay != 0 ) 
            { 
                // Is the creature already hired 
                if( Controled == false ) 
                { 
                    // Is the item the payment in gold 
                    if( item is Gold ) 
                    { 
                        // Is the payment in gold sufficient 
                        if( item.Amount >= m_Pay ) 
                        { 
                            // Check if this mobile already has a hire 
                            BaseHire hire = (BaseHire)m_HireTable[from]; 

                            if( hire != null && !hire.Deleted && hire.GetOwner() == from ) 
                            { 
                                SayTo( from, 500896 ); // I see you already have an escort. 
                                return false; 
                            } 

                            // Try to add the hireling as a follower 
                            if( AddHire(from) == true ) 
                            { 
                                SayTo( from, 1043258, string.Format( "{0}", (int)item.Amount / m_Pay ) );//"I thank thee for paying me. I will work for thee for ~1_NUMBER~ days.", (int)item.Amount / m_Pay ); 
                                m_HireTable[from] = this; 
                                m_HoldGold += item.Amount; 
                                m_PayTimer = new PayTimer( this ); 
                                m_PayTimer.Start(); 
                                return true; 
                            } 
                            else 
                                return false; 
                        } 
                        else 
                        { 
                            this.SayHireCost(); 
                        } 
                    } 
                    else 
                    { 
                        SayTo( from, 1043268 ); // Tis crass of me, but I want gold 
                    } 
                } 
                else 
                { 
                    Say( 1042495 );// I have already been hired. 
                } 
            } 
            else 
            { 
                SayTo( from, 500200 ); // I have no need for that. 
            } 

            return base.OnDragDrop( from, item ); 
        } 
        #endregion 


        #region [ OnSpeech ] 
        internal void SayHireCost() 
        { 
            Say( 1043256, string.Format( "{0}", m_Pay ) ); // "I am available for hire for ~1_AMOUNT~ gold coins a day. If thou dost give me gold, I will work for thee." 
        } 

        public override void OnSpeech( SpeechEventArgs e ) 
        {    
            if( !e.Handled && e.Mobile.InRange( this, 6 ) ) 
            { 
                int[] keywords = e.Keywords; 
                string speech = e.Speech; 

                // Check for a greeting or 'Hire' 
                if( ( e.HasKeyword( 0x003B ) == true ) || ( e.HasKeyword( 0x0162 ) == true ) ) 
                { 
                    e.Handled = Payday( this ); 
                    this.SayHireCost(); 
                } 
            } 

            base.OnSpeech( e ); 
        } 
        #endregion    
        
        #region [ GetContextMenuEntries ] 
        public override void GetContextMenuEntries( Mobile from, ArrayList list ) 
        { 
            Mobile Owner = GetOwner(); 
          
            if( Owner == null ) 
            { 
                base.GetContextMenuEntries( from, list ); 
                list.Add( new HireEntry( from, this ) ); 
            } 
            else 
                base.GetContextMenuEntries( from, list ); 
        } 
        #endregion 
        
        #region [ Class PayTimer ] 
        private class PayTimer : Timer 
        { 
            private BaseHire m_Hire; 
          
            public PayTimer( BaseHire vend ) : base( TimeSpan.FromMinutes( 30.0 ), TimeSpan.FromMinutes( 30.0 ) ) 
            { 
                m_Hire = vend; 
                Priority = TimerPriority.OneMinute; 
            } 
          
            protected override void OnTick() 
            { 
                int m_Pay = m_Hire.m_Pay; 
                if( m_Hire.m_HoldGold <= m_Pay ) 
                { 
                    // Get the current owner, if any (updates HireTable) 
                    Mobile owner = m_Hire.GetOwner(); 

                    m_Hire.Say( 503235 ); // I regret nothing!postal 
                    m_Hire.Delete(); 
                } 
                else 
                { 
                    m_Hire.m_HoldGold -= m_Pay; 
                } 
            } 
        } 
        #endregion 

        #region [ Class HireEntry ] 
        public class HireEntry : ContextMenuEntry 
        { 
            private Mobile m_Mobile; 
            private BaseHire m_Hire; 

            public HireEntry( Mobile from, BaseHire hire ) : base( 6120, 3 )    
            { 
                m_Hire = hire; 
                m_Mobile = from; 
            } 
          
            public override void OnClick()    
            {    
                m_Hire.Payday(m_Hire); 
                m_Hire.SayHireCost(); 
            } 
        } 
        #endregion 
    }    
}
 
Top