Jump to content

Recommended Posts

I only want to override the onpickedfn in grass.lua to add another cutgrass to the player's inventory.Obviously i want the code in the mainmod file. It doens't work this way:

function grassPostInit(inst)	inst.onpickedfn = function(self)		self.SoundEmitter:PlaySound("dontstarve/wilson/pickup_reeds") 		self.AnimState:PlayAnimation("picking") 			if self.components.pickable:IsBarren() then			self.AnimState:PushAnimation("idle_dead")		else			self.AnimState:PushAnimation("picked")		end		local pla = GLOBAL.GetPlayer()		local cutg = GLOBAL.SpawnPrefab("cutgrass")		pla.components.inventory:GiveItem(cutg, nil, Vector3(TheSim:GetScreenPos(self.Transform:GetWorldPosition())))	endendAddPrefabPostInit("grass", grassPostInit)
Does somebody have an idea? ^^

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