Hello Guys
Sry for my Complete Treads here and i have scripting my Loot System.. And he is not works
Errors:
[ERROR] gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:153: attempt to call upvalue 'AmmoListNew' (a table value)
1. unknown - gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:153
2. FireBullets - [C]:-1
3. WeaponAttack - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:257
4. unknown - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:97
Lines
local AmmoListNew = DeriveTable(BaseItem)
local AmmoListNew = {
["item_smallammo_small"] = true,
["item_smallammo_big"] = true,
["item_smallammo_large"] = true,
}
This Script
if entKiller:GetInfoNum( "ud_fruitautoloot", 0 ) == 1 then
for BaseItem, tblInfo in pairs(AmmoListNew{}) do
local tblItemTable = ItemTable(strItem)
local AmmoListNew = QuickCreateItemTable(BaseItem)
-- 244132089
if npcTarget:GetLevel() >= (tblInfo.MinLevel or 0) then
if !tblItemTable.QuestItem or (entKiller:GetQuest(tblItemTable.QuestItem) && !entKiller:HasCompletedQuest(tblItemTable.QuestItem)) then
-- strItem, tblInfo = entKiller:CallSkillHook("drop_mod", strItem, tblInfo)
local intChance = (tblInfo.Chance or 0) * (1 + (entKiller:GetStat("stat_luck") / 45))
local ItemChance = 100 / math.Clamp(intChance, 0, 100)
if math.random(1, (ItemChance or 100)) == 1 then
local intAmount = math.random(tblInfo.Min or 1, tblInfo.Max or tblInfo.Min or 1)
entKiller:AddItem(AmmoListNew,strItem, intAmount, npcTarget:GetPos() + Vector(0, 0, 30))
entKiller:CreateNotification(" You get the item in the inventory " .. tostring(intAmount) .. " " .. tblItemTable.PrintName)
end
end
end
end
end
Remove the extra {}
@code_gs by What
On the line that errored
@code_gs @Gonzo i become ever error
[ERROR] gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:154: attempt to index local 'tblInfo' (a boolean value)
1. unknown - gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:154
2. FireBullets - [C]:-1
3. WeaponAttack - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:257
4. unknown - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:97
[ERROR] gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:154: attempt to index local 'tblInfo' (a boolean value)
1. unknown - gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:154
2. FireBullets - [C]:-1
3. WeaponAttack - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:257
4. unknown - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:97
[ERROR] gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:154: attempt to index local 'tblInfo' (a boolean value)
1. unknown - gamemodes/underdone/gamemode/core/serverfiles/sv_ai.lua:154
2. FireBullets - [C]:-1
3. WeaponAttack - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:257
4. unknown - gamemodes/underdone/entities/weapons/weapon_primaryweapon/shared.lua:97
149-167 Line
if entKiller:GetInfoNum( "ud_fruitautoloot", 0 ) == 1 then
for strItem, tblInfo in pairs(AmmoListNew) do
local tblItemTable = ItemTable(strItem)
local AmmoListNew = QuickCreateItemTable(BaseItem)
-- 244132089
if npcTarget:GetLevel() >= (tblInfo.MinLevel or 0) then
if !tblItemTable.QuestItem or (entKiller:GetQuest(tblItemTable.QuestItem) && !entKiller:HasCompletedQuest(tblItemTable.QuestItem)) then
-- strItem, tblInfo = entKiller:CallSkillHook("drop_mod", strItem, tblInfo)
local intChance = (tblInfo.Chance or 0) * (1 + (entKiller:GetStat("stat_luck") / 45))
local ItemChance = 100 / math.Clamp(intChance, 0, 100)
if math.random(1, (ItemChance or 100)) == 1 then
local intAmount = math.random(tblInfo.Min or 1, tblInfo.Max or tblInfo.Min or 1)
entKiller:AddItem(AmmoListNew, intAmount, npcTarget:GetPos() + Vector(0, 0, 30))
entKiller:CreateNotification(" You get the item in the inventory " .. tostring(intAmount) .. " " .. tblItemTable.PrintName)
end
end
end
end
end
This wouldn't produce the error you described but I'm surprised it's not producing one at all, unless you missed it.
local AmmoListNew = DeriveTable(BaseItem)
local AmmoListNew = {
["item_smallammo_small"] = true,
["item_smallammo_big"] = true,
["item_smallammo_large"] = true,
}
^ Extra Comma ^
local AmmoListNew = DeriveTable(BaseItem)
local AmmoListNew = {
["item_smallammo_small"] = true,
["item_smallammo_big"] = true,
["item_smallammo_large"] = true
}
Also, those are 3 of the same error.
Where do you define tblInfo? It's a boolean, when it should be an integer.
(Boolean is true/false, integer is 1/2/3/4 etc.)
Ok for me
@WasabiThumbs
The Code here is not Changed he is Original
for strItem, tblInfo in pairs(tblNPCTable.Drops or {}) do
local tblItemTable = ItemTable(strItem)
-- 244132089
if npcTarget:GetLevel() >= (tblInfo.MinLevel or 0) then
if !tblItemTable.QuestItem or (entKiller:GetQuest(tblItemTable.QuestItem) && !entKiller:HasCompletedQuest(tblItemTable.QuestItem)) then
strItem, tblInfo = entKiller:CallSkillHook("drop_mod", strItem, tblInfo)
local intChance = (tblInfo.Chance or 0) * (1 + (entKiller:GetStat("stat_luck") / 45))
local ItemChance = 100 / math.Clamp(intChance, 0, 100)
if math.random(1, (ItemChance or 100)) == 1 then
local intAmount = math.random(tblInfo.Min or 1, tblInfo.Max or tblInfo.Min or 1)
local entLoot = CreateWorldItem(strItem, intAmount, npcTarget:GetPos() + Vector(0, 0, 30))
entLoot:SetOwner(entKiller)
local phyLootPhys = entLoot:GetPhysicsObject()
if !IsValid(phyLootPhys) && IsValid(entLoot.Grip) then phyLootPhys = entLoot.Grip:GetPhysicsObject() end
phyLootPhys:Wake()
phyLootPhys:ApplyForceCenter(Vector(math.random(-100, 100), math.random(-100, 100), math.random(350, 400)))
end
end
end
end
end
and this is my Code
if entKiller:GetInfoNum( "ud_fruitautoloot", 0 ) == 1 then
for strItem, tblInfo in pairs(tblNPCTable.Drops or {}) do
local tblItemTable = ItemTable(strItem)
-- 244132089
if npcTarget:GetLevel() >= (tblInfo.MinLevel or 0) then
if !tblItemTable.QuestItem or (entKiller:GetQuest(tblItemTable.QuestItem) && !entKiller:HasCompletedQuest(tblItemTable.QuestItem)) then
strItem, tblInfo = entKiller:CallSkillHook("drop_mod", strItem, tblInfo)
local intChance = (tblInfo.Chance or 0) * (1 + (entKiller:GetStat("stat_luck") / 45))
local ItemChance = 100 / math.Clamp(intChance, 0, 100)
if math.random(1, (ItemChance or 100)) == 1 then
local intAmount = math.random(tblInfo.Min or 1, tblInfo.Max or tblInfo.Min or 1)
local entLoot = CreateWorldItem(strItem, intAmount, npcTarget:GetPos() + Vector(0, 0, 30))
entLoot:SetOwner(entKiller)
local phyLootPhys = entLoot:GetPhysicsObject()
if !IsValid(phyLootPhys) && IsValid(entLoot.Grip) then phyLootPhys = entLoot.Grip:GetPhysicsObject() end
phyLootPhys:Wake()
phyLootPhys:ApplyForceCenter(Vector(math.random(-100, 100), math.random(-100, 100), math.random(350, 400)))
end
end
end
end
end
end
I will do everything you tell me now.
Can you help me with Teamviewer? #
I just want to be able to determine what NPCS are allowed to drop
Where do you define AmmoListNew? It isn't valid.
Also, I can see that English isn't your first language but that's okay.
I just want that the Kake finally goes .. otherwise I have a nervous break here
And no I'm from Germany
I hang on it since 4 days and nobody here wants to help me ... Everything handicapped! except for some
GAMEMODE:RemoveAll() Isn't a thing. I looked it up and I found this...
Where are you getting this code from?
This is Underdone RPG from Commander and he say this is not works
i know this he is works
Sorry, you need to Log In to post a reply to this thread.