Quote from the pccommand_list.txt inside the rathena doc folder:
+ PCCommand: OnOnNPCKillEvent
+ Code by: lordalfa
+ How it works:
When a player kills a monster, the NPC will run as if he just clicked it. Which means
if the script is like this:
+ Sample:
- script OnNPCKillEvent -1,{
mes "Holy shit";
close;
}
+ Explaination:
whenever a player kills a monster on the map, the words "Holy Shit" will appear
on the guy's face.
+ Note:
1) This script runs everytime a player kills a monster It is adviced if
you want to repeatedly use this script, to use a sort of filter.
2) The var "KilledRid" is set on the killer, this can be used in
strmobinfo to find out info about the Monster that was killed
Create a switch argument which will define a random number between 1 and 10
switch(rand(10)){
case 1:
getitem xx, amount;
end;
default:
end;
}
This will cause the script to check if number is 1, if yes it will give you an item, if no it will cancel the script.
Here the two possibilities:
1.
-%tab%script%tab%INSERTNPCNAMEHERE%tab%-1,{
end;
OnNPCKillEvent:
switch(rand(10)){
case 1:
getitem xx, amount;
end;
default:
end;
}
end;
}
For the second function you need to do this (change the value to 1)
---> PC Command List
------> Here's a list of scripts that can be triggered by PC actions and what they do.
------> Configuration is found at conf/script_athena.conf
------> There are two methods to define the script to be use (event_script_type)
------> 0 - By NPC. There has to be an NPC named in the same manner as the event
------> 1 - By Label. Every label from every NPC with the event name will be
executed (note that in this case the event HAS to start with the
word 'On', eg: 'OnPCBaseLvUpEvent:')
Hope this gives you an idea : )
Additional informations:
1 out of 10 is a 10% chance, 1 out of 100 is a 1% chance and so on.