Jump to content

Recommended Posts

hello

Before the hunting update last summer (varg forks), I had a block of code that produced extra hunt beasts (hunt surprises) and it worked correctly.

After the update it does not produce any error however it no longer functions. I cannot figure out what's wrong, please help

here is the block in question

-- New hunts
local UpvalueHacker = require("tools/upvaluehacker")

AddComponentPostInit("hunter", function(self)
	local _SpawnHuntedBeast = UpvalueHacker.GetUpvalue(self.OnDirtInvestigated, "SpawnHuntedBeast")
	local ALTERNATE_BEASTS = UpvalueHacker.GetUpvalue(_SpawnHuntedBeast, "_alternate_beasts")

	if ALTERNATE_BEASTS ~= nil then
		table.insert(ALTERNATE_BEASTS, "claywarg")
		table.insert(ALTERNATE_BEASTS, "gingerbreadwarg")
		table.insert(ALTERNATE_BEASTS, "mermking")
		table.insert(ALTERNATE_BEASTS, "shadowthrall_horns")
	end

	UpvalueHacker.SetUpvalue(_SpawnHuntedBeast, ALTERNATE_BEASTS, "_alternate_beasts")
end)

 

Link to comment
https://forums.kleientertainment.com/forums/topic/156187-hunts-surprises/
Share on other sites

On 5/24/2024 at 7:56 AM, _zwb said:

ALTERNATE_BEASTS is now defined outside of SpawnHuntedBeast function.

There's also a GetHuntedBeast function you can use to determine the mob spawned(defined at line 370 of hunter.lua).

how can I use GetUpvalue without specifying a function? since ALTERNATE_BEASTS is defined globally now

UpvalueHacker.GetUpvalue(_GetHuntedBeast, "_alternate_beasts")

 

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