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!

Mercenaries script edit need help please

HI

i want to change the settings for my merc.i use xanthos mercenary.

1. i want to change the skillcap lower...but coulnft find, witch schript i have to edit.
2. in mercenary.cs is this a part, where i can find the point of mercs healing procedure.

Code:
        public override void OnThink()
        {
            base.OnThink();
             
 
            if ( Hits < HitsMax - 100 && null == BandageContext.GetContext( this ))
            {
                Item item = Backpack.FindItemByType( typeof(Bandage) );
 
                if ( null != item && null != BandageContext.BeginHeal( this , this ))
                    item.Consume( 1 );
            }
            if ( Hunger < 10 || Loyalty <= BaseCreature.MaxLoyalty / 10 )
            {
                CheckFeedSelf();
            }
        }

now i want to create a heal-delay in the script, because the merc heals tooo fast. from 1-800 in 2 seconds.
i havnt an idea how i can create this. i tried to make a counter, but didnt work slow enough.

and 3. i want to increase the follower slots for the merc. intime we need 2 slots. its to low...but cant find the point in scripts to increase this.

can anybody help please?
 

Attachments

  • Mercenary.rar
    38.3 KB · Views: 8

daat99

Moderator
Staff member
You need to add a DateTime check before you try to heal the player.
Take a look at the special monsters that "talk" to players and see how their speech is being delayed.
 
You need to add a DateTime check before you try to heal the player.
Take a look at the special monsters that "talk" to players and see how their speech is being delayed.

Okay Daat99, ty for your response.
i look at the barra-script. i mean, he was talking to players :)
i "know" the date.time and timespan construct .... but havnt an idea, how to inplement in the existing script.

and sry for my fatal erros in writing english. its not my idendity :)

Greetings from Germany (we are the champions lalalaaaa.... :) )
Döschl
 
okay i try to explain my idea:

i give aktualy date.time to an varibale ... f.i. "lastheal"
and another variable is delay=3 (sekunden)
first is an if construct.... where i ask, if lastheal + delay >= date.time now ???
then comes the routine, where the merc is using bandages...

is my idea right?

Greetings Döschl
 
i think, i'm stupid .... didnt run .... its my mistake i know, but i tried it since yesterday all day long ....

Code:
        private static TimeSpan HealDelay = TimeSpan.FromSeconds(2.0);
          public override void OnThink()
        {
            
            base.OnThink();
            
            if ( Hits < HitsMax - 100 && null == BandageContext.GetContext( this ))
            {
                DateTime LastHeal = DateTime.Now;
                if( (LastHeal + TimeSpan.FromSeconds(2.0)) <= DateTime.Now)
                {
                     Item item = Backpack.FindItemByType(typeof(Bandage));

                    if (null != item && null != BandageContext.BeginHeal(this, this))
                        item.Consume(1);
                }
            }

what can i do?
the merc didnt use bandages now .... but why?
my problem is, that i dont understand c# correctly. i watch tutourials, read articles .... but its tooo much. but now, i have to finished the merc script, that it works finde.

Pls, need more help :oops:

Thank you!
Döschl
 

zerodowned

Sorceror
switch
DateTime LastHeal = DateTime.Now;
to after it heals
if (null != item && null != BandageContext.BeginHeal(this, this))
item.Consume(1);

otherwise you're setting last heal to the time now before if ever heals and so heal never happens
 
oh i tried this... but runuo gives a errormessage and says, that LastHeal is unknown in this context.

i must declare LastHeal first...i think.

ty for your help, but didnt work.

Greetings Döschl
 
Top