Pre-ML Style in 095!
After a 4 page post on the old forums, I decided to make this quick and simple guide. This is based of 095 Distro, so be sure to change where you put this as needed (if you are not using distro, you should know where it goes then).
Remember, this is based off the older AOS method for displaying damage, and the 095 core's way of handling this. Hope to post a 096 version, with the new style method for displaying damages soon!
In the file /pkg/systems/combat/hitScriptInc.inc add these 2 functions:
Code: Select all
// ***************************************************
function DisplayDamage(attacker, damaged, dmg)
if(dmg <= 255)
var pkt := "BF000B002201SSSSSSSSDD";
pkt["SSSSSSSS"] := fixPacketLength( (Hex(damaged.serial)-"0x"), 4) ;
pkt["DD"] := fixPacketLength( (Hex(dmg)-"0x"), 1);
if(attacker.acct)
SendPacket(attacker, pkt);
endif
if(damaged.acct)
SendPacket(damaged, pkt);
endif
endfunction
///////////////////////////////////////////////////////////////
//Pads a string with a "0" prefix, until it is of proper length
// packetString value to pad.
// byteLength number of bytes. Byte counted as two chars.
///////////////////////////////////////////////////////////////
function fixPacketLength( packetString, byteLength )
if( !packetString || packetString == error )
packetString := 0;
endif
packetString := cStr(packetString);
if( packetString[1,2] == "0x" )
packetString := cStr(packetString[3,len(packetString)]);
endif
if( len(packetString) > byteLength * 2 )
// var extraBytes := (byteLength*2) - len(packetString);
var extraBytes := len(packetString) - (byteLength*2) + 1;
return cStr(packetString[extraBytes,len(packetString)]);
endif
while( len(packetString) < byteLength * 2 )
packetString := "0" + packetString;
endwhile
return packetString;
endfunction
// ***************************************************
Code: Select all
// ***************************************************
set_critical(1);
DisplayDamage(attacker, defender, rawdamage);
// ***************************************************
Code: Select all
// ***************************************************
//Original
function DealDamage(defender, attacker, rawdamage, weapon)
// New
function DealDamage(defender, attacker, rawdamage, weapon:=0)
if(weapon)
rawdamage := rawdamage + RandomInt( (GetEffectiveSkill(attacker, 1) ) / 20);
endif
// ***************************************************
Remember, you send it to both the attacker and the defender. DisplayDamage will see if there is a need to send it (aka, if it's a mob or item then no need).
The easiest way to achieve this being sent always, is to search your scripts to find the damage commands and update them with hitScriptInc.inc and use DealDamage instead. Below is a list of all the core's damage giving commands to replace.
ApplyDamage
ApplyRawDamage
I think those are all anyway. Could be wrong
Then, in the scripts that are NOT in the combat package, just send the defender, attacker, and the rawdamage. By not giving a fake weapon to send, it will know it was not the combat pkg calling it, and will NOT add the anatomy mod to it.