PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Critical bug in combat system [current 96 svn]

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion
Display posts from previous:   

Author Message
Bracco



Joined: 28 Dec 2006
Posts: 80

PostPosted: Sun Jan 14, 2007 5:33 pm    Post subject: Critical bug in combat system [current 96 svn] Reply with quote

while i was looking at the distro attackhook i noticed a little, but critical bug that practically breaks the whole hook...

in this function

Code:

function GetArmorHit(byref d_info)
   var hit_zone := CS_GetRandomArmorZone();
   var armor_hit := CS_GetEquipmentInArmorZone(d_info.mobile, hit_zone);

   if ( armor_hit.Size() < 1 )
      return 0;
   endif

   var best_armor := 0;
   foreach item in ( armor_hit )
      if ( item.ar > best_armor.ar )
         best_armor := item;
      endif
      SleepMS(2);
   endforeach

   return best_armor;
endfunction


there is var best_armor := 0; and then if ( item.ar > best_armor.ar )

which is terribily wrong, and causes the function to return 0 nearly always, and with 0 armor you get huge damage...

so this is the fixed function:

Code:

function GetArmorHit(byref d_info)
   var hit_zone := CS_GetRandomArmorZone();
   var armor_hit := CS_GetEquipmentInArmorZone(d_info.mobile, hit_zone);

   if ( armor_hit.Size() < 1 )
      return 0;
   endif

   var best_armor := armor_hit[1];
   foreach item in ( armor_hit )
      if ( item.ar > best_armor.ar )
         best_armor := item;
      endif
      SleepMS(2);
   endforeach

   return best_armor;
endfunction


cheers

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Thu Apr 26, 2007 11:39 pm    Post subject: Reply with quote

Just for my own notes, this has been fixed (a long time ago).

Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty