Jump to content

[Need Help!] Trying to make Maxwell's book not take away health and not use fuel.


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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...