however this is entirely done with scripting alone
this is a normal template to increase kill counter normally for the killer alone
and this is for party support
Now to break it down part by part
this part is obvious, prevent *getpartymember throw error when the player doesn't own a party
change the scope of the killedrid from player based to script state
so there is no need to use *getvariableofpc (hercules) or *getvar (rAthena)
copy paste this part from script commands.txt
// loop through both and use 'isloggedin' to count online party members
for (.@i = 0; .@i < $@partymembercount; ++.@i)
if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i]))
.@count_online++;
// We search accountID & charID because a single party can have
// multiple characters from the same account. Without searching
// through the charID, if a player has 2 characters from the same
// account inside the party but only 1 char online, it would count
// their online char twice.
the first 2 conditions is to check the party members are within range of the killer
means if the attached party member having same map with the killer, and within 30 cells of the killer
Why 30 ?? this is actually a magical number
you see, because the OnNPCKillEvent return the mob ID (1002) instead of game ID (11000021)
we can't really use mob controller system to retrieve the coordinate of the monster
so we use the range from the killer instead
I have actually tried to use getbattleflag("area_size") before, but players complained it doesn't work
so I increased the distance to 30 (about twice the length), and they say the script is fixed
weird ... I know, so the number 30 is kinda stuck in most of my scripts
1 possible explanation is this
if the Archer shoot long distances, like using a bow, throw arrow, or mage firebolt, crusader throw shield
then the party member from across the screen should gets the kill
"area_size" is 14, so 14+14 = 28, so 30 works for them
Hp ... you don't want the counter to increase for dead party member
so if that player is dead, Hp is 0, and the condition will become false there
this is to prevent having players increase the kill count by just AFK there
External Links:
Euphy's Hunting Mission ( check this line )Party Share Kill ( tr0n's Quest Board )
thanks suhu
ReplyDelete