Ryuushu Posted January 3, 2015 Share Posted January 3, 2015 Is it possible? Right now I'm trying to do:local function StartDetectingPlayers_Handler(inst) inst:AddComponent("playerprox") inst.components.playerprox:SetDist(3, 4) inst.components.playerprox:SetOnPlayerNear(greetplayer) inst.components.playerprox:SetOnPlayerFar(goodbyeplayer)endlocal function OnDoneBuilding_Handler(inst) if inst.components.talker then inst.AnimState:PlayAnimation("talk", false) inst:playtalksound() inst.components.talker:Say("I'M ALIVE! ... kind of.") end inst:DoTaskInTime(10, inst:startdetectingplayers()) inst.AnimState:PushAnimation("idle", true)endlocal function onbuilt(inst) inst.AnimState:PlayAnimation("place", false) inst:DoTaskInTime(2, inst:ondonebuilding())endBut, right after my object is built it says right away the "I'm alive" part, skips the place animation and starts detecting players while playing the idle animation. Any ideas how this can be done? Link to comment https://forums.kleientertainment.com/forums/topic/48291-nesting-dotaskintime/ Share on other sites More sharing options...
simplex Posted January 3, 2015 Share Posted January 3, 2015 The problem is you're passing the result of inst:startdetectingplayers() (and likewise within onbuilt) as the argument to DoTaskInTime, while you should be doing this:inst:DoTaskInTime(10, function(inst) inst:startdetectingplayers() end) Link to comment https://forums.kleientertainment.com/forums/topic/48291-nesting-dotaskintime/#findComment-596309 Share on other sites More sharing options...
Ryuushu Posted January 3, 2015 Author Share Posted January 3, 2015 Ah, so that was it. It now works perfectly, thank you very much! Link to comment https://forums.kleientertainment.com/forums/topic/48291-nesting-dotaskintime/#findComment-596329 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