- ServUO Version
- Publish Unknown
- Ultima Expansion
- High Seas
Ok its really not fame on kil but same concept its experience on kill but same method. I get a crash I added exp to base creature so when a player kills a mobile they gain exp which levels them up I am trying to get pets to also gain exp to level up a custom leveling system but having issues with crashing here is code on death which i have that is crashing. I didnt post the entire section just the begining of section the OnDeath title and the // commented sections taken out that were causing the crash. if i take out the // parts then it crashs not really sure how to fix this. Attached my BaseCreature.cs everything else works great.
C#:
public override void OnDeath( Container c )
{
for ( int i = 0; i < list.Count; ++i )
{
DamageStore ds = list[i];
if ( !ds.m_HasRight )
continue;
//BasePet bp = ds.m_Mobile as BasePet;
Party party = Engines.PartySystem.Party.Get( ds.m_Mobile );
if ( party != null )
{
int divedFame = totalFame / party.Members.Count;
int divedKarma = totalKarma / party.Members.Count;
int divedExp = totalExp / 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 );
expeirence.Add( divedExp );
}
else
{
fame[ index ] += divedFame;
karma[ index ] += divedKarma;
expeirence[ index ] += divedExp;
}
}
}
}
else
{
titles.Add( ds.m_Mobile );
levels.Add( ds.m_Mobile );
fame.Add( totalFame );
karma.Add( totalKarma );
expeirence.Add(totalExp);
//if ( bp.Controlled = true )
//{
//expeirence.Add(totalExp);
//}
}