Skip to content

[BUG - Release] Error: [Lua::Registry::get_function_ref] Ref was not function No traceback #346

Description

@BurgersMcFly

Branch or Release
Latest version 3.0, but it was happening with previous experimental release as well. D:

Game and Engine Version
Palworld, 5.1.1

Describe the bug
Hooking on certain functions across multiple mods causes this error when the hook initiates:
Error: [Lua::Registry::get_function_ref] Ref was not function No traceback

This makes some hooks not function, essentially making some mods not functional.

Moving the hooks in the same file fixes this issue.

The mods have enabled.txt in them, but setting the problematic one (the one that isn't functioning because of the error) to enabled in mods.txt fixes the issue but you still get the error. (????????) *Correction: Doing this actually makes the hook from DisplayDateTime not function, so I guess all it did was change which hook actually hooked.

To Reproduce
[1]Download my mod https://www.nexusmods.com/palworld/mods/348?tab=files&file_id=1257
[2]Download my mod https://www.nexusmods.com/palworld/mods/501 version 1.0.0.0,
[3]Install mods
[4]Launch Palworl
[5]Load into your worl
[6]Open map
[7]Get error
[8]FastTravelFromAnywhere is not working

Expected behavior
Expected for the hooks to work properly? Like why is this affecting only some functions? Have found two till now.

Screenshots and UE4SS Log
There's nothing else in the log, everything is working fine until you trigger the hook and get that error. Nothing else. D:

Desktop (please complete the following information):

  • OS: Win10

Additional context
I've tried moving the code to functions and calling the functions in the hooks. I've tried hooking the hooks with a delay so that they are hooked at different times. I've tried removing the ExecuteAsync or adding it to DisplayDateTime but nothing works. D:

Relevant code from DisplayDateTime:

RegisterHook("/Game/Pal/Blueprint/UI/UserInterface/Map/WBP_Map_Base.WBP_Map_Base_C:OnSetup", function(Context)
		if not customized then
			local fontMaterial = AssignFontMaterial(config.color)
			local textCursorLocation = Context:get().Text_CursorLocation
	
			textCursorLocation.Font["Size"] = config.fontSize
			textCursorLocation.Font["TypefaceFontName"] = FName(config.fontType)
			textCursorLocation.Font["FontMaterial"] = fontMaterial
	
			print("[DisplayDateTime] Did DisplayDateTime customizations!")
		end
		customized = true
	end)

Relevant code from FastTravelFromAnywhere:

RegisterHook("/Game/Pal/Blueprint/UI/UserInterface/Map/WBP_Map_Base.WBP_Map_Base_C:OnSetup", function(Context)
		Context:get():SetPropertyValue("Can Fast Travel", true)
		ExecuteAsync(function()
			for _, PalLocationPointFastTravel in ipairs(PalLocationPointFastTravels) do
				PalLocationPointFastTravel.ShouldUnlockFlag = false
			end
		end)
	end)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions