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!

[runUO 2.3] Help with serbo's level system

MrBurston

Traveler
installed the level system and its all working fine with 2.3 nut when ever I restart the server make a new char and I get this error (see attached pic) any ideas?

also uploaded the level system if anyone wants it for 2.3 credit does not go to me I simply updated base files to work with 2.3's basefiles
 

Attachments

  • error.png
    41.8 KB · Views: 12
  • Desktop.rar
    80.1 KB · Views: 6

Dian

Sorceror
You most likely have something entered wrong or incorrect order in the Serialize or Deserialize method in your playermobile.cs file. This happens when the world saves your player mobile data in one order, and loading is not the same exact order.

Recheck anything you added to the PlayerMobile, and make certain its correct. You might post the PlayerMobile.cs if you dont find the issue.
 
You completely skipped deserializtion. it's been set to 17, and you have 29 cases. did you have a back-up of your playermobile.cs? if so, please post it. it'll be easier to help you
 

MrBurston

Traveler
Found the error and it all seems fine now here's now upload with fix, so far working fine with runUO 2.3
 

Attachments

  • serbo's level system.rar
    80.1 KB · Views: 18

84stefano84

Wanderer
i try to do pt with my friend in mine server. when i kill a monster can't take any point of exp. idk why but i can see in journal the exp point get from him but if i do [level can see no exp gained..
 

84stefano84

Wanderer
Code:
                if ( !Summoned && !m_NoKillAwards )
                {
                    int totalFame = Fame / 100;
                    int totalKarma = -Karma / 100;
                    if (Map == Map.Felucca)
                    {
                        totalFame += ((totalFame/10)*3);
                        totalKarma += ((totalKarma/10)*3);
                    }
 
                    List<DamageStore> list = GetLootingRights( this.DamageEntries,
 
this.HitsMax );
                    List<Mobile> titles = new List<Mobile>();
                    List<int> fame = new List<int>();
                    List<int> karma = new List<int>();
 
                    bool givenQuestKill = false;
                    bool givenFactionKill = false;
                    bool givenToTKill = false;
 
                    for ( int i = 0; i < list.Count; ++i )
                    {
                        DamageStore ds = list[i];
 
                        if ( !ds.m_HasRight )
                            continue;
 
                        Party party = Engines.PartySystem.Party.Get( ds.m_Mobile );
 
                        if ( party != null )
                        {
                            int divedFame = totalFame / party.Members.Count;
                            int divedKarma = totalKarma / party.Members.Count;
 
                            for ( int j = 0; j < party.Members.Count; ++j )
                            {
                                PartyMemberInfo info = party.Members[ j ] as
 
PartyMemberInfo;
 
                                if ( info != null && info.Mobile != null )
                                {
                                    int index = titles.IndexOf(
 
info.Mobile );
 
                                    if ( index == -1 )
                                    {
                                        titles.Add( info.Mobile );
                                        fame.Add( divedFame );
                                        karma.Add( divedKarma );
                                    }
                                    else
                                    {
                                        fame[ index ] += divedFame;
                                        karma[ index ] +=
 
divedKarma;
                                    }
                                }
                            }
                        }
                        else
                        {
                            titles.Add( ds.m_Mobile );
                            fame.Add( totalFame );
                            karma.Add( totalKarma );
                        }
 
                        OnKilledBy( ds.m_Mobile );
 
                        if ( !givenFactionKill )
                        {
                            givenFactionKill = true;
                            Faction.HandleDeath( this, ds.m_Mobile );
                        }
 
                        Region region = ds.m_Mobile.Region;
 
                        if( !givenToTKill && ( Map == Map.Tokuno || region.IsPartOf(
 
"Yomotsu Mines" ) || region.IsPartOf( "Fan Dancer's Dojo" ) ))
                        {
                            givenToTKill = true;
                            TreasuresOfTokuno.HandleKill( this, ds.m_Mobile );
                        }
 
                        if ( givenQuestKill )
                            continue;
 
                        PlayerMobile pm = ds.m_Mobile as PlayerMobile;
 
                        if ( pm != null )
                        {
                            QuestSystem qs = pm.Quest;
 
                            if ( qs != null )
                            {
                                qs.OnKill( this, c );
                                givenQuestKill = true;
                            }
                        }
                    }
                    for ( int i = 0; i < titles.Count; ++i )
                    {
                        Titles.AwardFame( titles[ i ], fame[ i ], true );
                        Titles.AwardKarma( titles[ i ], karma[ i ], true );
                    }
                }
 
                base.OnDeath( c );
 
                if ( DeleteCorpseOnDeath )
                    c.Delete();
            }
        }
 
OPEN: PlayerMobile.CS
LOCATION: Scripts/Mobiles/

Find:
publicclass PlayerMobile : Mobile, IHonorTarget
{

Add Below It:
//Level System
privateint m_Level;
privateint m_MaxLevel;
privateint m_Exp;
privateint m_ToLevel;
public int m_kxp;
private int m_SKPoints;
private int m_StatPoints;

[CommandProperty(AccessLevel.GameMaster)]
public int Level
{ get { return m_Level; } set { m_Level = value; InvalidateProperties(); } }

[CommandProperty(AccessLevel.GameMaster)]
public int MaxLevel
{ get { return m_MaxLevel; } set { m_MaxLevel = value; InvalidateProperties(); } }

[CommandProperty(AccessLevel.GameMaster)]
public int Exp
{
get { return m_Exp = LevelCore.TExp(this); }
set { m_Exp = value; InvalidateProperties(); }
}

[CommandProperty(AccessLevel.GameMaster)]
public int ToLevel
{ get { return m_ToLevel; } set { m_ToLevel = value; InvalidateProperties(); } }

public int kxp
{ get { return m_kxp; } set { m_kxp = value; InvalidateProperties(); }

[CommandProperty(AccessLevel.GameMaster)]
public int SKPoints
{
get { return m_SKPoints; }
set { m_SKPoints = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int StatPoints
{
get { return m_StatPoints; }
set { m_StatPoints = value; }
}




}
//End Level System

FIND:
base.OnDamage( amount, from, willKill );
}

Add Above It:
//Level System
if (willKill && En.Enabled || PvP.Enabled)
LevelHandler.Set(from, this);
//End Level System

FIND:
publicoverridevoid Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();

switch ( version )
{
case 25:
{

Change To:
publicoverridevoid Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();

switch (version)
{
//Level System
case 26:
{
m_Level = reader.ReadInt();
m_MaxLevel = reader.ReadInt();
m_Exp = reader.ReadInt();
m_ToLevel = reader.ReadInt();
m_kxp = reader.ReadInt();
m_SKPoints = reader.ReadInt();
m_StatPoints = reader.ReadInt();

gotocase 25;
}
//End Level System
case 25:
{
NOTE: YOUR Deserialization Numbers May Be Different Than Mine! Change 26 (Level System Number) to 1 Above Your First Number... Change The 25 (below the m_kxp = reader.ReadInt();) To Be The Same As Your First Number. (or 1 less than your new Level System Number)

FIND:
CheckAtrophies( this );

base.Serialize( writer );

writer.Write( (int) 26 ); // version

if( m_AcquiredRecipes == null )
{
writer.Write( (int)0 );
}

Change To:
CheckAtrophies(this);

base.Serialize(writer);

writer.Write((int)26); // version

//Level System
writer.Write((int)m_Level);
writer.Write((int)m_MaxLevel);
writer.Write((int)m_Exp);
writer.Write((int)m_ToLevel);
writer.Write((int)m_kxp);
writer.Write((int)m_SKPoints);
writer.Write((int)m_StatPoints);
//End Level System

if (m_AcquiredRecipes == null)
{
writer.Write((int)0);
}

NOTE: Your Serialization number May Be Different Than Mine. If It Is Change 26 (Level System Number) To The Number You Changed It To In The Desiralization.

FIND:
publicoverridevoid GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );

Below It Add:
//Level System
if (BelowName.Enabled && Level > 0)
{
Configured c = new Configured();
string d = LevelCore.Display(this, new Configured());

if (d != null)
list.Add("" + d);
}
//End Level System

FIND:
public override string ApplyNameSuffix( string suffix )
{
if ( Young )
{
if ( suffix.Length == 0 )
suffix = "(Young)";
else
suffix = String.Concat( suffix, " (Young)" );
}

Below It Add:
//Level System
if (InName.Enabled && Level > 0)
{
Configured c = new Configured();
string d = LevelCore.Display(this, new Configured());

if (d != null)
{
if (suffix.Length == 0)
suffix = "" + d;
else
suffix = String.Concat(suffix, "" + d);
}
}
//Level System End

SAVE AND CLOSE

OPEN: BaseMount.CS
LOCATION: Scripts/Mobiles/Animals/Mounts/

FIND:
if (from.InRange(this, 1))
{
bool canAccess = (from.AccessLevel >= AccessLevel.GameMaster)
|| (Controlled && ControlMaster == from)
|| (Summoned && SummonMaster == from);

if (canAccess)
{
if (this.Poisoned)
PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1049692, from.NetState); // This mount is too ill to ride.
else
Rider = from;
}
else if (!Controlled && !Summoned)
{

Change To:
if (from.InRange(this, 1))
{
//Level System
if (!(Off.Enabled))
{
if (NeedLevel.MountCheck(from, this) == false)
return;
}
//End Level System

bool canAccess = (from.AccessLevel >= AccessLevel.GameMaster)
|| (Controlled && ControlMaster == from)
|| (Summoned && SummonMaster == from);

if (canAccess)
{
if (this.Poisoned)
PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1049692, from.NetState); // This mount is too ill to ride.
else
Rider = from;
}
else if (!Controlled && !Summoned)
{

SAVE AND CLOSE

OPEN: Titles.cs
LOCATION: Scripts/Misc/
FIND Function:
public static string GetSkillTitle( Mobile mob ) {

Change To:
public static string GetSkillTitle( Mobile mob ) {
Skill highest = GetHighestSkill( mob );// beheld.Skills.Highest;

if ( highest != null && highest.BaseFixedPoint >= 300 )
{
//Level System
PlayerMobile pm = mob as PlayerMobile;
Configured c = new Configured();
string d = LevelCore.Display(pm, new Configured());

string skillLevel = GetSkillLevel( highest );
string skillTitle = highest.Info.Title;

if ( mob.Female && skillTitle.EndsWith( "man" ) )
skillTitle = skillTitle.Substring( 0, skillTitle.Length - 3 ) + "woman";

if (!(c.PaperdollLevel) || pm.Level < 1 || d == null)
{
return String.Concat( skillLevel, " ", skillTitle);
}
else
{
return String.Concat( skillLevel, " ", skillTitle, " Level: ", d );
}

}

return null;
}


SAVE AND CLOSE















OPEN: BaseCreature.cs
LOCATION: Scripts/Mobiles
FIND:
public override string ApplyNameSuffix( string suffix )
{
if ( IsParagon )
{
if ( suffix.Length == 0 )
suffix = "(Paragon)";
else
suffix = String.Concat( suffix, " (Paragon)" );
}

Below It Add:
//Level System
Configured c = new Configured();

int cl = LevelCore.CreatureLevel(this, new Configured());

if (c.CreatureLevels)
{
if (cl > 0)
{
if (suffix.Length == 0)
suffix = String.Concat(suffix, "(level " + cl + ")");
else
suffix = String.Concat(suffix, " (level " + cl + ")");
}
}
//End Level System

FIND:
if ( speechType != null && !willKill )
speechType.OnDamage( this, amount );

if ( m_ReceivedHonorContext != null )
m_ReceivedHonorContext.OnTargetDamaged( from, amount );

base.OnDamage( amount, from, willKill );
}

Change To:
if ( speechType != null && !willKill )
speechType.OnDamage( this, amount );

//Level System
if (willKill && En.Enabled)
LevelHandler.Set(from, this);
//End Level System

if ( m_ReceivedHonorContext != null )
m_ReceivedHonorContext.OnTargetDamaged( from, amount );

base.OnDamage( amount, from, willKill );
}
SAVE AND CLOSE
OPEN: CraftItem.cs
LOCATION: Scripts/Engines/Craft/Core/

Find:
if (maxAmount > 0)
{
if (!item.Stackable && item is IUsesRemaining)
((IUsesRemaining)item).UsesRemaining *= maxAmount;
else
item.Amount = maxAmount;
}

from.AddToBackpack(item);

//from.PlaySound( 0x57 );
}

Change To:
if (maxAmount > 0)
{
if (!item.Stackable && item is IUsesRemaining)
((IUsesRemaining)item).UsesRemaining *= maxAmount;
else
item.Amount = maxAmount;
}

//Level System
PlayerMobile pm = from as PlayerMobile;
Configured c = new Configured();

double ch = GetSuccessChance(pm, typeRes, craftSystem, false, ref allRequiredSkills);
double ex = GetExceptionalChance(craftSystem, ch, pm);

LevelCore.Craft(item, quality, ch, ex, pm, new Configured());
//End Level System

from.AddToBackpack(item);

//from.PlaySound( 0x57 );
}


SAVE AND CLOSE
Did you do everything like this on the guide?
 

84stefano84

Wanderer
1 made ​​the party,
2 control experience,
3 killed the dragon in the party,
4 experience is not received even if displayed,
5 re controlled experience unchanged
 
Top