Full Version : Kills/Deaths problem
xmlspawner >>XMLPoint's Troubleshooting >>Kills/Deaths problem


<< Prev | Next >>

The Jedi- 08-02-2006
Hey folks, maybe someone can help me...

It seems that my XMLSpawner and XMLpoints installations are working properly, as my server has been having many challenges as well as a climbing leaderboard for over a week now. However, no players are recieving any deaths. For example; say two players both with 0 kills and 0 deaths challenge eachother, the winner will go to 1 kill, 0 deaths - while the loser stays at 0 and 0. I thought it had to do with the scaling of points, but I set it to 1/1 with no effect.

Anyone know where to point me? I'm prepared to post any code needed, but also with no crashes or error logs its more difficult to pin down. I know my way around C# but I'm newer to this XMLSpawner system, so all my efforts so far have had no effect. Thanks in advance.

-The Jedi-

ArteGordon- 08-02-2006
are the losing players losing points?
Are they young, or in the same guild?
Have you modified the minimum time between deaths?
CODE

 private static TimeSpan m_DeathDelay = TimeSpan.FromSeconds(60);    // 60 seconds default min time between deaths for point loss


The Jedi- 08-03-2006
Actually my server is currently being run as a public test center. They are given an "All skills 120 ball", so no, none are young. Also, if you look at the board, it looks something like this:

xmlspawner/page1.bmp Billyjoe Kills: 15 Deaths: 0 Points: 115
xmlspawner/page2.bmp Tommy Kills: 7 Deaths: 0 Points: 107

.. and so on. Every player (different guilds, none young) has every kill they have made, but with 0 deaths and no point loss; although all the gain. Also, no, the kill timing is not modified. You can see why I am so confused.

ArteGordon- 08-03-2006
is this with RunUO 2.0 or 1.0?

Try adding this debugging code into the OnKilled method in xmlpoints.cs around line 2260

QUOTE

  // check to see whether points can be taken
  if(!(AttachedTo is Mobile) || !CanAffectPoints((Mobile)AttachedTo, killer, killed, false))
  {
    awardpoints = false;
  }

            Console.WriteLine("killer={0} killed={1} awardpoints={2}", killer, killed, awardpoints);



and let me know what it reports

The Jedi- 08-03-2006
Compiling now....

killer=0x1234 "Bob" killed=0x5678 "Joe" awardpoints=False

There she is. Seems clear, but whats with the false, is that right?

The Jedi- 08-03-2006
Sorry, should have just posted new. *bump* xmlspawner/Checked2.gif

ArteGordon- 08-03-2006
QUOTE (The Jedi @ August 03, 2006 04:04 am)
Compiling now....

killer=0x1234 "Bob" killed=0x5678 "Joe" awardpoints=False

There she is. Seems clear, but whats with the false, is that right?


it means that your players are failing one of the tests in the CanAffectPoints method in xmlpoints.cs

Can you post your CanAffectPoints method?

The Jedi- 08-03-2006
Following so far, but I didn't see anything at first look. You are the master though...

xmlspawner/fastscroll.bmp
CODE
public bool CanAffectPoints(Mobile from, Mobile killer, Mobile killed, bool assumechallenge)
 {
  // uncomment this for newbie protection
  //if( ((killed.SkillsTotal < 6000 && (killer.SkillsTotal - killed.SkillsTotal ) > 1000) ||
  //(killed.RawStatTotal <= 200 && (killer.RawStatTotal - killed.RawStatTotal) > 20 ) ) && m_Challenger != killer && m_Challenger != killed) return false;

  // check for within guild kills and ignore them if this has been disabled
  if(!AllowWithinGuildPoints &&  SameGuild(killed,killer)) return false;

  // check for within team kills and ignore them
  if(AreTeamMembers(killer, killed)) return false;

  // are the players challengers?
  bool inchallenge = false;
  if((from == killer && m_Challenger == killed) || (from == killed && m_Challenger == killer))
  {
   inchallenge = true;
  }
           
  bool norestriction = UnrestrictedChallenges;
           
  // check for team challenges
  if(ChallengeGame != null && !ChallengeGame.Deleted)
  {
   // check to see if points have been disabled in this game
   if(!ChallengeGame.AllowPoints) return false;

   inchallenge = true;
               
   // check for kill delay limitations on points awards
   norestriction = !ChallengeGame.UseKillDelay;
  }

  // if UnlimitedChallenges has been set then allow points
  // otherwise, challenges have to obey the same restrictions on minimum time between kills as normal pvp
  if(norestriction && (inchallenge || assumechallenge)) return true;

  // only allow guild kills to yield points if in a challenge
  if(!(assumechallenge || inchallenge) &&  SameGuild(killed,killer)) return false;

  // uncomment the line below to limit points to challenges. regular pvp will not give points
  //if(!inchallenge && !assumechallenge) return false;

  // check to see whether killing the target would yield points
  // get a point for killing if they havent been killed recent

  // get the points attachment on the killer if this isnt the killer
  XmlPoints a = this;
  if (from != killer)
  {
   a = (XmlPoints)XmlAttach.FindAttachment(killer, typeof(XmlPoints));
  }
  if(a != null)
  {
   a.RefreshKillList();

   // check the kill list if there is one
   if(a.KillList != null)
   {
    foreach(KillEntry k in a.KillList)
    {
     if(k.WhenKilled + m_KillDelay > DateTime.Now)
     {
      // found a match on the list so dont give any points
      if(k.Killed == killed)
      {
       return false;
      }
     }
    }
   }
  }

  // check to see whether the killed target could yield points
  if(from == killed)
  {
   // is it still within the minimum delay for being killed?
   if(DateTime.Now < m_LastDeath + m_DeathDelay) return false;
  }

  return true;
 }

ArteGordon- 08-03-2006
by any chance, have you recently changed your system clock?

Look at the LastDeath property on the XmlPoints attachment on one of your players and see what it says.

The Jedi- 08-03-2006
Hah! I was just about to ask if it might be time related. And no, hasn't been manually set in at least 3 years. And I have glanced at the Last Killed DateTime() and they are all zerod out. Should mean that any value you add (from death delay) should still be less than the current date/time, right?

Edit: even after kills the Last Killed remains at 1/1/1 12:00, but the kill has the proper timing. So even the DateTime from the death isn't being registered.

ArteGordon- 08-03-2006
QUOTE (The Jedi @ August 03, 2006 05:57 am)
Hah! I was just about to ask if it might be time related. And no, hasn't been manually set in at least 3 years. And I have glanced at the Last Killed DateTime() and they are all zerod out. Should mean that any value you add (from death delay) should still be less than the current date/time, right?

Edit: even after kills the Last Killed remains at 1/1/1 12:00, but the kill has the proper timing. So even the DateTime from the death isn't being registered.

LastDeath doesnt get updated unless the kill awarded points so that is correct.

Well, I would just pepper a few Console.WriteLine statements in CanAffectPoints to see how far it is getting to figure out which test is causing the problem.

The Jedi- 08-03-2006
Okay. I created two new players on two seperate accounts, both player level. I set both to be 120 all skills, and challenged. I "peppered" writeline statements like you suggested, and though it went through the method 4 times total (one issue one accept, one killer, one killed I think), on the last (which I BELIEVE is the killed) it came here:

CODE
// check the kill list if there is one
   if(a.KillList != null)
   {
    foreach(KillEntry k in a.KillList)
    {
     if(k.WhenKilled + m_KillDelay > DateTime.Now)
     {
                           Console.WriteLine("Are they on the kill list?");
                           // found a match on the list so dont give any points
      if(k.Killed == killed)
      {
       return false;
      }
     }
    }
   }
  }

           Console.WriteLine("Is the time right?");
           // check to see whether the killed target could yield points
  if(from == killed)
  {
   // is it still within the minimum delay for being killed?
                              ....... etc


It did not make it to the time check, "Is the time right?". The last line written was the "Are they on the kill list?". So.... what? Why? huh.gif

EDIT: Why is it making it past this line on two new characters?
CODE
if(k.WhenKilled + m_KillDelay > DateTime.Now)

That's the part I don't get.

The Jedi- 08-03-2006
Oh, I'm sorry. This is RunUO 2.0 RC1. Hope maybe that helps in some strange way. smile.gif

ArteGordon- 08-03-2006
ok, I now see what is going on. The killed player gets added to the kill list too early.

Try making this change around line 2300 in the OnKilled method in xmlpoints.cs

QUOTE

  // take points from the killed, either a fixed amount or scaled by the difference with the points of the killer
  // if the killer has fewer points than the killed then lose more
  XmlPoints xp = XmlAttach.FindAttachment(killer, typeof(XmlPoints)) as XmlPoints;

  if(xp != null)
  {
    killerpoints = xp.Points;


                // add to the recently killed list
                xp.KillList.Add(new KillEntry(killed, DateTime.Now));

  }


and comment out this line in the OnKill method around line 1975

CODE


  // add to the recently killed list
  //KillList.Add(new KillEntry(killed, DateTime.Now));

The Jedi- 08-03-2006
Problem solved. Makes enough sense. If a new player has already been killed, he's definately being killed too early. Has no one else had this problem?!?!? Hmmm....

The way I see it this fix elevates you to a level of godness that even you hadn't yet known. xmlspawner/Left3.bmp

Thanks Arte. Now to remove 34,000 WriteLines wink.gif