Jump to content

[SOLVED] How to listen for "pickdiseasing" event with a client mod?

Recommended Posts

I'm trying to make a client mod that plays a sound whenever the character picks a plant that is soon going to become diseased.

The way I'm currently trying to do this is to listen for the event "pickdiseasing" that triggers the character to comment.

My current method works when hosting a world without caves, but sound does not play on worlds with caves or when not the host.

When I ThePlayer:PushEvent("pickdiseasing") with the console set to local it plays the sound,

when I do it with the console set to remote it triggers the character comment.

How can I make this work, and what am I doing wrong?

This is everything that I have in my modmain.lua.

    inst:ListenForEvent("pickdiseasing", function(inst)




Edit: I got everything working!

AddPrefabPostInit("disease_puff", function(inst)


Edited by Alurien___
Link to comment
Share on other sites

the problem is the location where "PushEvent("pickdiseasing",..) is called, you have to make sure that this is also called for clients. Problem is, that if it is inside a component, components are not available to clients.
Try to find a solution, but if it is really only available to server, you have to add netvars for server-client comunication, which will only work if your mod is allclientsrequire. An only client-side mod wont work then.

Edited by Serpens
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

  • Create New...