. . . Posted May 28, 2016 Share Posted May 28, 2016 Hello, I need help ... So, when my character goes insane he goes into this inst.AnimState:PlayAnimation("yawn") which I edited a texture to make it look like his roaring, now the problem's the anim won't play if his moving or it will cancel if he moves which makes me ... Is there a way to force the inst.AnimState:PlayAnimation("yawn") anim to play no matter what until it finishes and even better get him to stop in place until it finishes? All help's extremely accepted & thank you so, so, so, so, so, so, so, so, MUCH for reading this !!! Link to comment Share on other sites More sharing options...
Aquaterion Posted May 28, 2016 Share Posted May 28, 2016 18 minutes ago, SuperDavid said: Hello, I need help ... So, when my character goes insane he goes into this inst.AnimState:PlayAnimation("yawn") which I edited a texture to make it look like his roaring, now the problem's the anim won't play if his moving or it will cancel if he moves which makes me ... Is there a way to force the inst.AnimState:PlayAnimation("yawn") anim to play no matter what until it finishes and even better get him to stop in place until it finishes? All help's extremely accepted & thank you so, so, so, so, so, so, so, so, MUCH for reading this !!! local function onstopyawn(inst) inst:RemoveEventCallback("animover", onstopyawn) -- stop listenng for animations being over if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(true) -- reenable keypressing end inst.sg:GoToState("idle") -- go to idle end if inst.components.playercontroller ~= nil then--stop keypresses inst.components.playercontroller:Enable(false) end inst.components.locomotor:Stop() -- stop movement inst.components.locomotor:Clear() inst:ClearBufferedAction() -- and any actions you were going to do inst.AnimState:PlayAnimation("yawn") -- play animation inst:ListenForEvent("animover", onstopyawn) -- go to above function when this animation is done Link to comment Share on other sites More sharing options...
. . . Posted May 28, 2016 Author Share Posted May 28, 2016 Aquaterion it works really well, thank you ! I just have one more thing to ask is if you know if there's an way to stop the yawn sound from playing when he goes into inst.sg:GoToState("yawn")? Link to comment Share on other sites More sharing options...
Aquaterion Posted May 28, 2016 Share Posted May 28, 2016 4 minutes ago, SuperDavid said: Aquaterion it works really well, thank you ! I just have one more thing to ask is if you know if there's an way to stop the yawn sound from playing when he goes into inst.sg:GoToState("yawn")? I think you'd have to edit the sound file or modify the volume while yawning(via code). but I thought you just wanted to play the animation, so why go to yawn state? Link to comment Share on other sites More sharing options...
. . . Posted May 28, 2016 Author Share Posted May 28, 2016 Because when he goes insane inst.sg:GoToState("idle") doesn't make him stop right in his place and yawn but inst.sg:GoToState("yawn") does but it makes a yawn sound ... Link to comment Share on other sites More sharing options...
Aquaterion Posted May 28, 2016 Share Posted May 28, 2016 4 minutes ago, SuperDavid said: Because when he goes insane inst.sg:GoToState("idle") doesn't make him stop right in his place and yawn but inst.sg:GoToState("yawn") does but it makes a yawn sound ... isnt that what my code is suppose to do?? Link to comment Share on other sites More sharing options...
. . . Posted May 28, 2016 Author Share Posted May 28, 2016 (edited) I put this local function OnStopYawn(inst) inst:RemoveEventCallback("animover", OnStopYawn) if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(true) end inst.sg:GoToState("idle") -- this has to be changed into inst.sg:GoToState("yawn") for him to stop and yawn while moving but it makes a yawn sound :( end if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(false) end inst.components.locomotor:Stop() inst.components.locomotor:Clear() inst:ClearBufferedAction() inst.AnimState:PlayAnimation("yawn") inst:ListenForEvent("animover", OnStopYawn) if i'm moving and go insane he just stops in place idling for a couple seconds, with this code he has to stand completely still for him to yawn. if you change inst.sg:GoToState("idle") into inst.sg:GoToState("yawn") is the only way he stops in place and yawns but it makes a yawn sound... Edited May 28, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
Aquaterion Posted May 28, 2016 Share Posted May 28, 2016 (edited) 6 minutes ago, SuperDavid said: I put this local function OnStopYawn(inst) inst:RemoveEventCallback("animover", OnStopYawn) if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(true) end inst.sg:GoToState("idle") -- this has to be changed into inst.sg:GoToState("yawn") for him to stop and yawn but it makes a yawn sound :( end if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(false) end inst.components.locomotor:Stop() inst.components.locomotor:Clear() inst:ClearBufferedAction() inst.AnimState:PlayAnimation("yawn") inst:ListenForEvent("animover", OnStopYawn) if i'm moving and go insane he just stops in place idling for a couple seconds, with this code he has to stand completely still for him to yawn. if you change inst.sg:GoToState("idle") into inst.sg:GoToState("yawn") is the only way he stops in place and yawns but it makes a yawn sound... if that isnt working then just using inst.sg:GoToState("yawn") is needed, the rest of the code was because I thought yawning automatically makes you sleepy for overriding the yawn sound u can do inst.yawnsoundoverride = "" -- put a sound file in there, not sure if you can just leave empty. Edited May 28, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
. . . Posted May 28, 2016 Author Share Posted May 28, 2016 3 minutes ago, Aquaterion said: inst.yawnsoundoverride = "" Can I put multiple sounds? Because his roar uses multiple sounds Link to comment Share on other sites More sharing options...
Aquaterion Posted May 28, 2016 Share Posted May 28, 2016 2 minutes ago, SuperDavid said: Can I put multiple sounds? Because his roar uses multiple sounds nop Link to comment Share on other sites More sharing options...
. . . Posted May 28, 2016 Author Share Posted May 28, 2016 Thank you, so, so, so much!!! Everything works perfectly now, you're so awesome Aquaterion !!!!!! Link to comment Share on other sites More sharing options...
Aquaterion Posted May 28, 2016 Share Posted May 28, 2016 10 minutes ago, SuperDavid said: Thank you, so, so, so much!!! Everything works perfectly now, you're so awesome Aquaterion !!!!!! what you could do for the 2nd sound inst:ListenForEvent("yawn", function() inst:DoTaskInTime(1, function() inst.SoundEmitter:PlaySound("sound2") end) end) listen for "yawn" event and calculate how long the first sound is, and change 1 with how long the first sound is, and sound2 with the second sound Link to comment Share on other sites More sharing options...
. . . Posted May 28, 2016 Author Share Posted May 28, 2016 I did this and everything worked perfectly ! And it's all thanks to you Aquaterion ! Now I have a fully functional roar! Thanks so much Aquaterion your help was extremely critical for the roar to be roar-ish-er, i'm definitely giving you full credit for my character's roar because without you he wouldn't be able to roar, thanks so much !!!! -- Stop everything then I can roar. local function OnStopYawn(inst) inst:RemoveEventCallback("animover", OnStopYawn) if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(true) end inst.sg:GoToState("yawn") inst.SoundEmitter:PlaySound("dontstarve/creatures/werepig/howl") inst.SoundEmitter:PlaySound("dontstarve/creatures/worm/distant") inst.SoundEmitter:PlaySound("dontstarve/creatures/werepig/grunt") inst.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/vargr/howl") -- Other players lose 50 sanity when I roar. local x, y, z = inst.Transform:GetWorldPosition() local players = FindPlayersInRange(x, y, z, (15), true) for _, v in pairs(players) do if(v~=inst) then if(v.components and v.components.sanity) then v.components.health:DoDelta(-300) end end end end if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(false) end inst.components.locomotor:Stop() inst.components.locomotor:Clear() inst:ClearBufferedAction() inst.yawnsoundoverride = "dontstarve_DLC001/creatures/vargr/howl" inst:ListenForEvent("animover", OnStopYawn) Link to comment Share on other sites More sharing options...
Aquaterion Posted May 28, 2016 Share Posted May 28, 2016 (edited) 7 minutes ago, SuperDavid said: I did this and everything worked perfectly ! And it's all thanks to you Aquaterion ! Now I have a fully functional roar! Thanks so much Aquaterion your help was extremely critical for the roar to be roar-ish-er, i'm definitely giving you full credit for my character's roar because without you he wouldn't be able to roar, thanks so much !!!! I think this should work the same: -- Stop everything then I can roar. inst.sg:GoToState("yawn") inst.SoundEmitter:PlaySound("dontstarve/creatures/werepig/howl") inst.SoundEmitter:PlaySound("dontstarve/creatures/worm/distant") inst.SoundEmitter:PlaySound("dontstarve/creatures/werepig/grunt") inst.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/vargr/howl") -- Other players lose 50 sanity when I roar. local x, y, z = inst.Transform:GetWorldPosition() local players = FindPlayersInRange(x, y, z, (15), true) for _, v in pairs(players) do if v ~= inst and v.components and v.components.sanity then v.components.health:DoDelta(-300) end end btw this lowers health by 300 not sanity by 50? intentional or what? Edited May 28, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
. . . Posted May 28, 2016 Author Share Posted May 28, 2016 (edited) 14 minutes ago, Aquaterion said: btw this lowers health by 300 not sanity by 50? intentional or what? Thanks for telling me that! I'll change it now ! I was testing to see if dodelta was working properly, if you didn't point that out then my character would've had a death howl instead !!! -- Stop everything then I can roar. inst.sg:GoToState("yawn") inst.SoundEmitter:PlaySound("dontstarve/creatures/werepig/howl") inst.SoundEmitter:PlaySound("dontstarve/creatures/worm/distant") inst.SoundEmitter:PlaySound("dontstarve/creatures/werepig/grunt") inst.yawnsoundoverride = "dontstarve_DLC001/creatures/vargr/howl" inst.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/vargr/howl") -- Other players lose 50 sanity when I roar. local x, y, z = inst.Transform:GetWorldPosition() local players = FindPlayersInRange(x, y, z, (15), true) for _, v in pairs(players) do if v ~= inst and v.components and v.components.sanity then v.components.sanity:DoDelta(-50) end end ^Yes this code works even better, thanks Aquaterion again ! Edited May 28, 2016 by SuperDavid 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