statistnr1 Posted August 9, 2016 Share Posted August 9, 2016 (edited) Hy, I am fixing a character from somebody else, Isaac, it's almost done and only one bug gives me a headache. Isaac is supposed to cry after every x seconds, but only the character the host plays does it. What I mean is, when I have the server running, I play Wilson and somebody else plays Isaac, only Wilson plays the emote. for i, v in ipairs(AllPlayers) do --Get list of all players print("Prefab: " .. v.prefab .. " | " .. "Index: " .. i) --Debugstuff if v.prefab == "isaac" then --If character is Isaac print("Should be \"isaac\": " .. v.prefab .. " | " .. i) --Debugstuff - Values are the right ones UserCommands.RunTextUserCommand("sad", AllPlayers[i], false) --Make him cry, but no matter which index I use, always only host cries end end This is what selects the character that is supposed to play the emote, I get the right indexnumber for the Isaac player, but always the host plays the emote. Even when I replaced the variable "i" in UserCommands.RunTextUserCommand("sad", AllPlayers[i], false) with 1 or 2 Wilson cries. I hope one of you genies can help me with my little problem. Thanks - statistnr1 Edited August 9, 2016 by statistnr1 Link to comment https://forums.kleientertainment.com/forums/topic/69452-force-client-to-use-an-emote/ Share on other sites More sharing options...
Joachim Posted August 10, 2016 Share Posted August 10, 2016 (edited) The reason Wilson (the host) cries rather than Isaac is because UserCommands.RunTextUserCommand(...) is run server-side, which is associated with the host and therefore the host's character. It is also a very hacky and dirty way to accomplish this. It would be better to do it like this: inst:PushEvent("emote", { anim = "emoteXL_sad", fx = "tears", fxdelay = 17 * FRAMES, mounted = true }) Where inst is, of course, Isaac's prefab. Edited August 10, 2016 by Joachim Link to comment https://forums.kleientertainment.com/forums/topic/69452-force-client-to-use-an-emote/#findComment-802288 Share on other sites More sharing options...
statistnr1 Posted August 10, 2016 Author Share Posted August 10, 2016 Hy, thanks for your help! 20 minutes ago, Joachim said: The reason Wilson (the host) cries rather than Isaac is because UserCommands.RunTextUserCommand(...) is run server-side, which is associated with the host and therefore the host's character. I already thought this was the case. 23 minutes ago, Joachim said: It is also a very hacky and dirty way to accomplish this. True, first time modding and working with Lua, next time I know better. 23 minutes ago, Joachim said: It would be better to do it like this: inst:PushEvent("emote", { anim = "emoteXL_sad", fx = "tears", fxdelay = 17 * FRAMES, mounted = true }) Where inst is, of course, Isaac's prefab. I put this in the code and it at least worked for me when I am host. I just have to wait for somebody to come online in my friendslist to test it. I will let you know if I have more questions. - statistnr1 Link to comment https://forums.kleientertainment.com/forums/topic/69452-force-client-to-use-an-emote/#findComment-802293 Share on other sites More sharing options...
statistnr1 Posted August 10, 2016 Author Share Posted August 10, 2016 Hy, it works absolutly perfect. Thanks for the help! - statistnr1 Link to comment https://forums.kleientertainment.com/forums/topic/69452-force-client-to-use-an-emote/#findComment-802342 Share on other sites More sharing options...
Joachim Posted August 10, 2016 Share Posted August 10, 2016 Glad to hear that. Have fun. Link to comment https://forums.kleientertainment.com/forums/topic/69452-force-client-to-use-an-emote/#findComment-802352 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