Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unique loot is giving error #711

Closed
2 of 5 tasks
Typeczek123 opened this issue Dec 19, 2022 · 4 comments · Fixed by #712
Closed
2 of 5 tasks

unique loot is giving error #711

Typeczek123 opened this issue Dec 19, 2022 · 4 comments · Fixed by #712
Labels
Priority: Medium This issue may be impactful and needs some attention. Status: Pending Test This PR or Issue requires more testing Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@Typeczek123
Copy link

Priority

Medium

Area

  • Datapack
  • Source
  • Map
  • Other

What happened?

Hello, i have problem with unique loot cuz if its true it gives error and only one character gets full loot and the rest have empty reward bag. NOTICE THAT ONLY BOSSES WITH UNIQUE LOOT GIVES THAT ERROR. OTHER REWARD BAG BOSSES ARE FINE
It gives me error like this. Its the latest release of canary(2.6.0).
Lua script error:
scriptInterface: [Scripts Interface]
scriptId: [/home/xxx/canary/data-otservbr-global/scripts/reward_chest/boss_death.lua:callback]
timerEvent: []
callbackId:[]
function: []
error [...data-otservbr-global/scripts/reward_chest/boss_death.lua:76: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: at 0x56494ccd4940
[C]: in function 'ipairs'
...data-otservbr-global/scripts/reward_chest/boss_death.lua:76: in function <...data-otservbr-global/scripts/reward_chest/boss_death.lua:3>

What OS are you seeing the problem on?

Linux

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Typeczek123 Typeczek123 added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Dec 19, 2022
@github-actions github-actions bot added Priority: Medium This issue may be impactful and needs some attention. Status: Pending Test This PR or Issue requires more testing labels Dec 19, 2022
@dudantas
Copy link
Contributor

You can test this code?

function MonsterType.getBossReward(self, lootFactor, player_position, unique_loots)
    local result = {}
    if getConfigInfo("rateLoot") > 0 then
        local loot = self:getLoot() or {}
        for i = #loot, 0, -1 do
            local lootBlock = loot[i]
            if lootBlock then
                local showSite = false
                if lootBlock.unique or lootBlock.list then
                    showSite = true
                end
                if lootBlock.unique and lootBlock.list then -- if list with unique, block message
                    showSite = false
                end
                if lootBlock.unique then 
                    if player_position > 0 and isInArray(unique_loots[player_position],lootBlock.itemId) then
                        self:createLootItem(lootBlock, lootFactor, result, showSite)
                    end
                else
                    self:createLootItem(lootBlock, lootFactor, result, showSite)
                end
            end
        end
    end
    return result
end

@Typeczek123
Copy link
Author

dumb question but where i should put this code?

@dudantas
Copy link
Contributor

dudantas commented Dec 19, 2022

dumb question but where i should put this code?

Replace the one I sent with the existing one
Here:

function MonsterType.getBossReward(self, lootFactor, topScore)

@Typeczek123
Copy link
Author

Typeczek123 commented Dec 19, 2022

image

Now there is no reward bags even. Totally no loot

dumb question but where i should put this code?

Replace the one I sent with the existing one Here:

function MonsterType.getBossReward(self, lootFactor, topScore)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium This issue may be impactful and needs some attention. Status: Pending Test This PR or Issue requires more testing Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants