ImDaBanana Posted November 17, 2017 Share Posted November 17, 2017 I made this mod, and with something I did (I don't really know what it was), it broke. The mod only works when a server launches, but stops doing anything after that. local function LikeJazz(inst) --Make sure inst has a talker component if not inst.components.talker then inst:AddComponent("talker") end --Decide wether it should say something local num = math.random() local shouldsay = num >= GetModConfigData("frequency") if shouldsay and inst.components.talker then inst.components.talker:Say("Ya like jazz?") end end --Bees should say "Ya like jazz?" randomly when their state changes AddPrefabPostInit("bee", function(inst) inst:ListenForEvent("newstate", LikeJazz(inst)) end) This is my modmain. If I set shouldsay to true it will still only work once. What's wrong in the code? I've been looking for quite a while now and and any help would be appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/84359-mod-seems-to-only-do-something-when-the-server-launches-doesnt-do-anything-afterward/ 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