Jump to content

how to use TheFocalPoint in modmain action


Recommended Posts

Hello, I have problem I do not undersand, help is appreciate.

 

I try use TheFocalPoint in modmain action (I want sound only play for one who preform action)

Spoiler

local ACTION1 = GLOBAL.Action()
ACTION1.str = "Action1"
ACTION1.id = "ACTION1"
ACTION1.fn = function(act)
	GLOBAL.TheFocalPoint.SoundEmitter:PlaySound("dontstarve/creatures/smallbird/chirp")
end
AddAction(ACTION1)

 

and get this crash

attempt to index upvalue 'TheFocalPoint' (a nil value)

If anyone can help that be fantasic, thanks for your time!

Link to comment
Share on other sites

The problem is act doesn't contain focalpoint or inst. I don't know off the top of my head but I believe focalpoint is similar to cameras and requires finding parent or child of act.doer which is inst. Usually I think sound emitters are called in states not actions as it is easier to control the timing and link to the sound emitter.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...