Alurien___ Posted August 27, 2019 Share Posted August 27, 2019 (edited) 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. AddPlayerPostInit(function(inst) inst:ListenForEvent("pickdiseasing", function(inst) inst.SoundEmitter:PlaySound("dontstarve/common/Horn_beefalo") end) end) DiseaseWarning.zip Edit: I got everything working! AddPrefabPostInit("disease_puff", function(inst) GLOBAL.TheFocalPoint.SoundEmitter:PlaySound("dontstarve/common/Horn_beefalo") end) Edited August 29, 2019 by Alurien___ Link to comment Share on other sites More sharing options...
Serpens Posted August 27, 2019 Share Posted August 27, 2019 (edited) 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 August 27, 2019 by Serpens Link to comment Share on other sites More sharing options...
Alurien___ Posted August 27, 2019 Author Share Posted August 27, 2019 Ah, i was worried it might be something like that. I've got my heart set on client-side, so I'll try to find another way of doing this. Thank you for your help! Link to comment Share on other sites More sharing options...
eXiGe Posted August 28, 2019 Share Posted August 28, 2019 AddPrefabPostInit("disease_puff", function(inst) print("TEST") end) Might work for you. Link to comment Share on other sites More sharing options...
Alurien___ Posted August 28, 2019 Author Share Posted August 28, 2019 Oh good idea, I was thinking of replacing the sound of the disease puff but adding to the prefab makes way more sense. Thank you so much! (Also I'm a huge fan of your mods <3<3<3) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now