Brothers 24 Report post Posted July 26, 2023 Hi all. I use BD altar in my server. To unseal it we need the stones. Theres a change it will fail and bring a curse on the altar. Is there a way to make the succes rate better? I think this is the file i need to edit: function ItemUse_HZLi ( role , Item , Item_Traget ) local Item_ID = GetItemID ( Item_Traget ) if Item_ID ~= 266 then SystemNotice(role ,"Please place the Power of Flame on the altar") UseItemFailed ( role ) return end local Cha_Boat = 0 Cha_Boat = GetCtrlBoat ( role ) if Cha_Boat ~= nil then SystemNotice( role , "Cannot use while sailing" ) UseItemFailed ( role ) return end local Item_type = GetItemType ( Item ) local Item_Traget_Type = GetItemType ( Item_Traget ) if Item_type == 66 and Item_Traget_Type == 65 then local str = GetItemAttr( Item_Traget ,ITEMATTR_VAL_STR ) --力量 if str >= 5 then UseItemFailed ( role ) return end local rad = math.random ( 1, 100 ) if rad<=50 then local Elf_URE = GetItemAttr(Item_Traget,ITEMATTR_URE) --当前耐久记录剩余封印点数 str = str + 1 if Elf_URE >= 50 then Elf_URE = Elf_URE-50 end SetItemAttr( Item_Traget ,ITEMATTR_VAL_STR ,str ) SetItemAttr( Item_Traget ,ITEMATTR_URE ,Elf_URE ) else local Elf_MaxEXP = GetItemAttr(Item_Traget,ITEMATTR_MAXENERGY) --最大能量记录诅咒点数 local Elf_EXP = GetItemAttr(Item_Traget,ITEMATTR_ENERGY) --最大能量记录诅咒点数 Elf_MaxEXP = Elf_MaxEXP + 1 Elf_EXP = Elf_EXP + 1 SystemNotice( role , "Unfortunately, the Altar has been cursed by the soul of the black dragon" ) SetItemAttr( Item_Traget ,ITEMATTR_MAXENERGY ,Elf_MaxEXP ) SetItemAttr( Item_Traget ,ITEMATTR_ENERGY ,Elf_EXP ) end end end Is 100 100%, and , <= 50 , 50 => / 50% succeed and fail? Quote Share this post Link to post Share on other sites
Daxter 1 Report post Posted July 27, 2023 local rad = math.random ( 1, 100 ) This means it'll randomly choose a number between 1 and 100 if rad<=50 then If the random number is less than or equal to 50 do this local Elf_URE = GetItemAttr(Item_Traget,ITEMATTR_URE) --当前耐久记录剩余封印点数 str = str + 1 if Elf_URE >= 50 then Elf_URE = Elf_URE-50 end SetItemAttr( Item_Traget ,ITEMATTR_VAL_STR ,str ) SetItemAttr( Item_Traget ,ITEMATTR_URE ,Elf_URE ) Else (meaning >=51), do the curse part. You can: Decrease the maximum value, eg. math.random (1, 60) Increase the threshold for positive result (not cursing), eg. if rad<=70 then Or both! 1 Quote Share this post Link to post Share on other sites