local dropped_item = nil
local is_cigarettepack = false
function spawn_item(obj, item)
if obj then
obj = alife():create(item, obj:position(), obj:level_vertex_id(), obj:game_vertex_id(), obj:id())
return obj.id
end
return nil
end
– ************************************************** ************* –
local cigarette = Cigarette()
function on_item_drop(obj)
if not has_alife_info(“ui_inventory”) then
return
end
if string.find(obj:section(), “cigarettepack_”) then
is_cigarettepack = true
dropped_item = obj:id()
end
end
function check_dropped_item()
if dropped_item and is_cigarettepack then
id not alife():object(dropped_item) then
string.find(obj:section, “cigarettepack_s25”) then
spawn_item(db.actor, “cigarettepack_s24”)
end
end
end
end
is_cigarettepack = false
dropped_item = nil
cigarette:update()
end
I keep getting “attempt to index global ‘whatever’ (a nil value)” errors, anyone know whats fucked up with my code?