Jump to content

Recommended Posts

hi,

i'm trying to make orange staff not able to see the reticule for teleporting when you're insane. right now the character when go to 0 sanity get "nosanity" tag and this is code i have

Spoiler

local function reticuleshouldhidefn(inst)
	return inst.replica.inventoryitem ~= nil and inst.replica.inventoryitem:IsHeldBy(ThePlayer) and ThePlayer.components.playercontroller ~= nil and ThePlayer:HasTag("nosanity")
end

AddPrefabPostInit("orangestaff", function(inst)
	inst.components.reticule.shouldhidefn = reticuleshouldhidefn
end)

 

i see this "inst.components.reticule.shouldhidefn" is used in the oceanfishingrod and apparently it works? so i have no idea why this doesn't seem to work for anything else i add it to which has a reticule..

does anyone know if i'm doing something wrong or is this actually a bug that should be reported?

i tested so many thing from reticule and i am so lost now. so my short question is does anybody know how to hide reticule/remove it then add it back?

Edited by --- -.-
7 hours ago, --- -.- said:

hi,

i'm trying to make orange staff not able to see the reticule for teleporting when you're insane. right now the character when go to 0 sanity get "nosanity" tag and this is code i have

  Hide contents


local function reticuleshouldhidefn(inst)
	return inst.replica.inventoryitem ~= nil and inst.replica.inventoryitem:IsHeldBy(ThePlayer) and ThePlayer.components.playercontroller ~= nil and ThePlayer:HasTag("nosanity")
end

AddPrefabPostInit("orangestaff", function(inst)
	inst.components.reticule.shouldhidefn = reticuleshouldhidefn
end)

 

i see this "inst.components.reticule.shouldhidefn" is used in the oceanfishingrod and apparently it works? so i have no idea why this doesn't seem to work for anything else i add it to which has a reticule..

does anyone know if i'm doing something wrong or is this actually a bug that should be reported?

i tested so many thing from reticule and i am so lost now. so my short question is does anybody know how to hide reticule/remove it then add it back?

This should work

AddPrefabPostInit("orangestaff", function(inst)
	local _targetfn = inst.components.reticule.targetfn
	inst.components.reticule.targetfn = function(...)
		local data = _targetfn(...)
		local player = ThePlayer
		if data and player and player.replica.sanity and player.replica.sanity:GetPercent() == 0 then
			return nil
		end
		return data
	end
end)

 

  • Thanks 1

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...