Jump to content
SoundX

Question about Check_Baoliao function in skilleffect.lua

Recommended Posts

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 by SoundX

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by Satan
  • Like 1

lelouch_signature_by_vahntheknight-d4uafwj.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...