SoundX 14 Report post Posted April 12, 2018 (edited) Hello everyone, Sorry for the stupid question, I am novice in lua and am having a very big confusion regarding where some functions are defined. My question is: in the file "itemeffect.lua" inside the function: "function Check_Baoliao(ATKER, DEFER, ... )": There is this line repeated 3 times, for when player is killed in PVP, when monster is killed in PVE or when resource is used: SetItemFall ( count , item[1] , item[2] , item[3] , item[4] , item[5] , item[6], item[7] ,item[8],item[9],item[10] ) I am trying to understand where the "SetItemFall" is defined, as I want to use it in another function in order to alter drops. However, it seems it cannot be used outside "Check_Baoliao"? However, it is not defined as a function in Check_Baoliao either, or in any other file inside the "calculate" directory. The reason I want to use it is because I am trying to add a drop for every mob in "exp_and_level.lua": Spoiler This works: -- >>> Add item dropping to every mob local ItemFallsMonster = GetChaAttrI( dead , ATTR_LV ) if ValidCha (team_atker) == 0 then SystemNotice(atk,'A hidden Fairy Ration') GiveItem( atk , 0 , 227 , 1, 4 ) end -- <<< END Add item dropping to every mob But this does not: -- >>> Add item dropping to every mob local ItemFallsMonster = GetChaAttrI( dead , ATTR_LV ) if ValidCha (team_atker) == 0 then SystemNotice(atk,'A hidden Fairy Ration') SetItemFall( 1, 227 ) end -- <<< END Add item dropping to every mob Trying to get this working before start playing with dropping chance percentages (that I think depend on the "StateLv" and "MF_RAID_STATE"?) Sorry for my English and thanks in advance Edited April 12, 2018 by SoundX Quote Share this post Link to post Share on other sites
SoundX 14 Report post Posted April 13, 2018 Having looked at this more, it seems like the "item[n]" parametres correspond to probability for the item to fall, and cannot be set to determine the item's ID. So, I am wondering two things: - Is there any function that controls drop from monsters? I can achieve what I want with "GiveItem()", but I would rather the item to drop and not appear directly on inventory. - My initial question: Where are all these functions defined? Like the "SetItemFall", "GiveItem", etc? Are they lua functions, or are they somehow integrated with the server's code? Sorry for the rookie question, I don't know a lot about programming. Thanks for reading Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted April 13, 2018 (edited) Hello @SoundX! SetItemFall() and GiveItem() are c++ functions coded on source codes. As far i know SetItemFall control or/and reads monster drop on characterinfo, where there's max of 10 items per monster. If you willing to create custom drop to monsters using GetExp_PKM i'm not sure you can make them drop it on the floor, at least for monsters that are arealdy summoned. A way to make monsters drop items on the floor are giving them a item and removing it from him... for that work you must push monster userdata, like this: local ForestSpirit = CreateCha(103, 100, 100, 90, 60) GiveItem(ForestSpirit, 0, 885, 1, 4) RemoveChaItem(ForestSpirit, 885, 1, 2, -1, 0, 1) That will summon a forest spirit and give it a refining gem, but after created it will drop the refining gem on the floor. That just a sketch, ofc. Edited April 13, 2018 by Satan 1 Quote Share this post Link to post Share on other sites