Resource icon

Code How To: Customize Settings for Shard

To start this off, I'm going to post some info that Peoharen posted on Peo's Tweaks

** Note: I haven't double checked any of these yet. Peo's post is from back in 2009 and chances are that some of it is outdated and/or isn't formatted correctly for ServUO

Peo's Tweaks

These are some small tweaks that you may find useful. All of them are minor one liners or so but can have huge impacts on how things work but are generally generic enough any shard can find a use for them. I'll occasionally add new things to it so check back every once in awhile.


***

New players are not penalized for insuring their items.
New players keep their items for free. The problem is insurance is checked before young status. so if a Young person has an insured item they are charged 600 gold for what should be a free service they already have due to being young. This tweak fixes that problem.

PlayerMobile, GetParentMoveResultFor method.
Find

C#:
            if ( CheckInsuranceOnDeath( item ) )
                return DeathMoveResult.RemainEquiped;
Change to

C#:
            // Fix the bug of young people would be charged if they insured their items despite the fact young players keep items for free
            if ( !Young )
                if ( CheckInsuranceOnDeath( item ) )
                    return DeathMoveResult.RemainEquiped;
This thread was talking about moving items on death which reminded me of fixing noobs death looting.

***

Keep blessed/insured items equipped.
Just an edit to keep items that don't leave you from death on your body rather than being dumped into your backpack. I suppose there is two sides with this, one your getting rid of an annoyance. Two you're not giving people a reason to setup arm/disarm macros in Razor since your shard does it for them.

PlayerMobile, GetParentMoveResultFor method.

C#:
            // Items remain equipped if possible
            if ( (res != DeathMoveResult.MoveToCorpse && item.Movable) || this.Young )
                res = DeathMoveResult.RemainEquiped;
            else if ( this.AccessLevel >= AccessLevel.GameMaster )
                res = DeathMoveResult.RemainEquiped;
Instead of MovetoBackpack RemainEquipped it used. Items that cannot be equipped are not even handled here so no worries on trying to equip your firehorn or w/e. Also included is a line so all staff keep their stuff equipped. You'll probably see a lot of staff only tweaks, I'm lazy enough to make them so I don't have to do anything in game but annoy people.

***

[Staff] Resurrects with full stats, and on one has those stupid damn death robes.
Speaking of Player death, staff tend to res in a state that gets them killed again. also, those stupid death robes are annoying. Any they also get created then deleted due to insured/blessed robes from the keep items equipped edit. Might as well stop their creation to begin with.

PlayerMobile, Resurrect method.

C#:
            /*if ( this.Alive && !wasAlive )
            {
                Item deathRobe = new DeathRobe();

                if ( !EquipItem( deathRobe ) )
                    deathRobe.Delete();
            }*/

            // Staff now res to full health
            if ( this.AccessLevel > AccessLevel.Player )
            {
                BodyValue = 987; // Lets them walk though doors instead of having to open them.
                Hits = HitsMax;
                Mana = ManaMax;
                Stam = StamMax;
                Fame = 0;
                Karma = 0;
            }
***

Staff cast spells without regents.
Title says all, almost the same edit can be used for regless casting so if you're making one of those retardedly lame all skills no regs uber arties to start pvp shards I'm sure you'll want something like this too.

MagerySpell, ConsumeReagents method.

C#:
            if ( Caster.AccessLevel != AccessLevel.Player )
                return true;
Srsly, it's that easy. For necro, see below, and for Chiv add an access level check to CheckCast.

C#:
else if ( [I]Caster.AccessLevel == AccessLevel.Player &&[/I] Caster.TithingPoints < RequiredTithing )

***

Hunger/thirst effects gain.
Ever seen those stupid must eat or take HP damage things posted? I suppose the idea sounds pretty fair, but again I'm lazy. Screw carrying around food to feed my player, I have enough problems feeding my self during a peerless run. Anyway, like OSI this tweak will mean you have to eat and drink for skill gains.

SkillCheck, CheckSkill method, below gc *= skill.Info.GainFactor;

C#:
            // Hunger & Thirst check
            if ( from is PlayerMobile )
            {
                if ( from.Hunger <= 5 )
                    gc *= 0.25;
                else if ( from.Hunger <= 10 )
                    gc *= 0.50;
                else if ( from.Hunger <= 15 )
                    gc *= 0.75;

                if ( from.Thirst <= 5 )
                    gc *= 0.25;
                else if ( from.Thirst <= 10 )
                    gc *= 0.50;
                else if ( from.Thirst <= 15 )
                    gc *= 0.75;
            }
For every 5 points they are from being 'full' their gain chance drops by 25%.

On a side note, generally increasing gc is how you speed up gains and also in this script allows you to edit the stat gain delay. If you're wanting a super fast shard that players can gain like +2.0 in a skill during the 0~50 range you should spend the 8 seconds allowing them to gain a stat point more than once every 15 minutes. You have no idea how much it pisses me off to find a shard where the skill gain and training areas proves the intent of getting you to GM within an hour or two or so but you only get like 4 points in str while doing it. It's like bitch smacking people, "I see you GMed all your skills overnight like I wanted, but alas I'm too stupid to know you cannot do the same with your stats so toggle a skill to decrease and train something else back and forth over the next week instead." On a good note, it does let you know what shards to avoid like a plague infested flies on a rat.

****

Creatures can use AOS items.
By default creatures cannot gain hits/stam/mana boosts from items. If you're like me, when you place an arty on your in game monster bash, you equip the monster with it rather than just tossing it into it's pack. For pokemon shards or those trainable mercenaries or whatever, this edit is required.

BaseCreature, ___Max methods.

C#:
        [CommandProperty( AccessLevel.GameMaster )]
        public override int StamMax
        {
            get
            {
                int stam = (m_StamMax > 0) ? m_StamMax : Dex;

                if ( Core.AOS )
                    stam += AosAttributes.GetValue( this, AosAttribute.BonusStam );

                return stam;
            }
        }
Do pretty much the same with the rest.

***

The damn weather.
It rains all the damn time in UO. The addition of rain is supposed to add an in game element towards the goal of providing a simulated world. Bullshit. If it rained even a 3rd of much in real life as it does in UO we'ed all be living in Waterworld. Where in the hell does all the rain come from? It rains like twice a UO day all year though out the entire world.

Weather, Initialize method.

C#:
            for ( int i = 0; i < 15; ++i )
	AddDynamicWeather( +15, 25, 5, 8, 400, 400, new Rectangle2D( 0, 0, 5120, 4096 ) );
Pretty much do the same for anything else. 25% chance seems to be better though I'm not a weather man to know for sure.

***


Increased vet cap.
I do a +100 increase in cap for veteran players instead of the mere +20.

RewardSystem, EventSink_Login

C#:
            if ( e.Mobile.SkillsCap >= 7000 && e.Mobile.SkillsCap < 7950 )
            {
                if ( level > 20 )
                    level = 20;
                else if ( level < 0 )
                    level = 0;

                if ( SkillCapRewards )
                    e.Mobile.SkillsCap = 7000 + (level * 50);
                else
                    e.Mobile.SkillsCap = 7000;
            }
Once they hit the 800.0 mark the script no longer cares about them, same for those counselors you capped at 0. If you run higher caps be sure to alter the numbers.


***

Rikktor is a Champion.
Of power, whom uses melee attacks only. Yet he cannot hit a damn thing. Behold the might champion of power miss a noob Samurai, becuase his combat skills are better than Rikktors!

Add SetSkill( SkillName.Wrestling, 100.0 ); to his file.

***

Leech life scales based on speed.
Yeah, at this point I wish I knew enough about the SVN to just upload some of this stuff, but what do I care right? Some of these things have been reported for years and I'm not about to learn why SVN is sooo useful. I'm dead set in my old ways.

BaseWeapon, just do a code search.

C#:
                if ( lifeLeech != 0 )
                    //attacker.Hits += AOS.Scale( damageGiven, lifeLeech );

//Should be something more akin to
	

	
                if ( lifeLeech != 0 )
                    attacker.Hits += AOS.Scale( damageGiven, (lifeLeech + 30) - (Speed / 2) );
I totally guessed on the formula though.

***

Breath is no longer auto kill.
Since breath damage is uncapped, a Leviathan deals like 1,000 fire damage to people. Ouch right? Same for anything else you pump up the HP on.

BaseCreature, BreathComputeDamage method.

C#:
            if ( damage > 375 )
                damage = 375;
375 - 70% = 112 right? So now it's possible to live though it. Provided you have 113 HP and at max fire res. :D

***

Magery summons are, well, summoned
Thought of this while I was looking over my post today (see edit date).

BaseCreature, Summon, below creature.m_SummonEnd = DateTime.Now + duration;


C#:
            if ( creature is AirElemental || creature is EarthElemental || creature is FireElemental || creature is WaterElemental || creature is EnergyVortex )
            {
                creature.Freeze( TimeSpan.FromSeconds( 1.1 ) );
                creature.MoveToWorld( p, caster.Map );
                creature.Animate( 12, 5, 1, true, false, 0 );
            }
            else
                creature.MoveToWorld( p, caster.Map );
I think thats it.

***

Councilors cannot pick items up
Per OSI, councilors cannot pick items up. Combine with blocking their skill gains to prevent skill use and a blessed state and the only unlogged thing they can do is spy on opposing guilds/factions. The much less abusable staff condition will allow you to hire new staffmen with less risk to your shard.

C#:
namespace Server.Network
{
    public class LiftHandler
    {
        public static void Configure()
        {
            PacketHandlers.Register( 0x07, 7, true, new OnPacketReceive( NewLiftReq ) );
        }

        public static void NewLiftReq( NetState state, PacketReader pvSrc )
        {
            if ( state.Mobile.AccessLevel == AccessLevel.Counselor )
                state.Send( new LiftRej( LRReason.CannotLift ) );
            else
                PacketHandlers.LiftReq( state, pvSrc );
        }
    }
}
***
More later.
Author
zerodowned
Views
83
First release
Last update
Rating
0.00 star(s) 0 ratings