Jump to content

Recommended Posts

Here's what I have, but I don't think I'm doing it right and how do I add it not taking health?:

local function postInitFunc(reader)
    if reader.components.inventory:Has("nightmarefuel", 1) then
        reader.components.inventory:ConsumeByName("nightmarefuel", 1)
    end
end


AddPrefabPostInit("waxwelljournal", postInitFunc)

Edited by maxisawesome101

I'll take a look to see what you can do and get back to you on this!

If you do something kinda like this,

function bookread(argshere)
	--function here
end

function Mod(inst)
	if inst.prefab == nil then
		return
	end

	if inst.prefab == "waxwell" then
		for _,item in pairs(GetPlayer().components.inventory.itemslots) do
			if item.prefab == "waxwelljournal" then
				item.book.onread = bookread
			end
		end
	end

	if item.prefab == "waxwelljournal" then
		item.book.onread = bookread
	end
end

AddPrefabPostInitAny(Mod)

I think you'll get the desired result.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...