Phoenix 0 Report post Posted October 14, 2017 How can I make a NPC to check for pet Lv and give out an Item? Thanks in advance. Quote Share this post Link to post Share on other sites
iZae 55 Report post Posted October 14, 2017 (edited) untested and not sure if every step is correct, but as a starting hint will be really good. Inside functions.lua add function CheckPetLv (role) local Pet_Slot = GetChaItem ( role , 2 , 1 ) local Pet_ID = GetItemID ( Pet_Slot ) local item_type = GetItemType ( Pet_Slot ) local str = GetItemAttr( Pet_Slot ,ITEMATTR_VAL_STR ) local con = GetItemAttr( Pet_Slot ,ITEMATTR_VAL_CON ) local agi = GetItemAttr( Pet_Slot ,ITEMATTR_VAL_AGI ) local dex = GetItemAttr( Pet_Slot ,ITEMATTR_VAL_DEX ) local sta = GetItemAttr( Pet_Slot ,ITEMATTR_VAL_STA ) local Lv = str + agi + dex + con + sta if item_type == 59 then return Lv else return 0 end end function GiveIfHasPet(role) local petLv = CheckPetLv (role) local done = HasRecord( role, RecordID) if petLv ~= 0 then if done == 0 then GiveItem( role, 0, ItemID, Qt, Ql ) SetRecord( role, RecordID) else SystemNotice(role, 0. "You took your prize already") end else SystemNotice(role, 0, "You don't have a fairy on the Pet Slot") end end and edit: petLv condition (set "if petLv ~= 0 then" to "if petLv < 40 then", in case you set the condition to have a lv 41 or higher pet) edit ItemID to the item you're willing to give players, Qt to its quantity, Ql to its quality, RecordID to an unused record (just to avoid players re-take the items more than once) then go to npcsdk and under if item.func == JumpPage then return JumpPage( character, npc, page, item.p1 ) add elseif item.func == GiveIfHasPet then return GiveIfHasPet( character) and now you can use the following line on a npc script Text(1, "Redeem your item", GiveIfHasPet) Edited October 14, 2017 by iZae 1 Quote Share this post Link to post Share on other sites