-- This is the function i made, which will be called when the player is found to have two types of cannon, or two types of bomb etc..
function WeaponAbuse(player, itemcategory, itemname)
local pos = victim:coords()
player:message("You had two items in the " .. itemcategory .. " category, one has now been dropped from your ship")
player:inventory_modify(itemname, -1)
g_arena:item_create(itemname, 1, pos.x, pos.y)
end
-- this is in the player_ondeath function, it checks to see whether a player has multiple weapons (i.e two types of cannon)
if (player:inventory_find("Bio Cannon") == 1) then
catcannon = catcannon + 1
if catcannon == 2 then
item = "Bio Cannon"
cat = "Primary Weapons"
WeaponAbuse(victim,cat,item)
end
end
-- this brings up an error: [Lua] Fatal error: No self reference given as first parameter to the member function 'player:inventory_find'. Have you used '.' instead of ';'?