RoboMat Posted August 6, 2013 Share Posted August 6, 2013 I have a problem with the luautils.walkAdj function that I can't figure out. When I use it in my Sleeping Overhaul the player goes to sleep before walking to the object. It also happens sometimes that after he wakes up he is on the outside of the building he tried to sleep in. This is the code I use:if luautils.walkAdj(ISSleepMenu.object.square) then if ISSleepMenu.player == nil then ISSleepMenu.player = getSpecificPlayer(ISContextMenu.globalPlayerContext); end... do more stuffend Does anyone know how to make the game wait for the player to walk to the object before executing the rest of the block? Link to comment Share on other sites More sharing options...
Gelswolf Posted August 6, 2013 Share Posted August 6, 2013 Waking up outside with sleep overhaul is a feature, you will notice the door is open. You are sleep walking. RoboMat 1 Link to comment Share on other sites More sharing options...
RoboMat Posted August 6, 2013 Author Share Posted August 6, 2013 Waking up outside with sleep overhaul is a feature, you will notice the door is open. You are sleep walking. God damn it, I really would love to take that as the best answer Link to comment Share on other sites More sharing options...
johndough Posted August 6, 2013 Share Posted August 6, 2013 Well, do you queue the sleep action also? Link to comment Share on other sites More sharing options...
RoboMat Posted August 6, 2013 Author Share Posted August 6, 2013 No because it isn't a timed action in my mod... But I thought the vanilla sleeping isn't a time action neither? Actually I just followed the functions by RobertJohnson. Link to comment Share on other sites More sharing options...
johndough Posted August 6, 2013 Share Posted August 6, 2013 The function you're calling, luautils.walkAdj, queues ISWalkToTimedAction, so naturally the sleep will be done first if that is not done as a queued action also. Link to comment Share on other sites More sharing options...
RoboMat Posted August 6, 2013 Author Share Posted August 6, 2013 Of course ... how didn't I get this!? It should work if I call a dummy timed action before handling the sleeping stuff. Have to try it tomorrow. Link to comment Share on other sites More sharing options...
johndough Posted August 6, 2013 Share Posted August 6, 2013 I think it would save you a lot of hazzle if you just wrapped your sleeping code in a Timed Action. Trying to time things with a dummy sounds difficult. You could also make a generic timed action and pass it any function you like. Link to comment Share on other sites More sharing options...
RoboMat Posted August 6, 2013 Author Share Posted August 6, 2013 Well the only thing the dummy would do is being passed to the queue and call the sleeping functions once it is reached. Then the walkAdj would be executed correctly, right? I haven't spent too much time looking through the Timed Actions so I might be wrong here, but I don't think the sleeping mechanics of my mod would work with a timed action. For example its length isn't predetermined but changed randomly while it is executed. Link to comment Share on other sites More sharing options...
johndough Posted August 6, 2013 Share Posted August 6, 2013 Well the only thing the dummy would do is being passed to the queue and call the sleeping functions once it is reached. That's precisely what a timed action does Then the walkAdj would be executed correctly, right? Yes, just call the sleep code in the perform() method. Link to comment Share on other sites More sharing options...
RoboMat Posted August 8, 2013 Author Share Posted August 8, 2013 Just wanted to say it works like a charm now Thanks for your help johndough. 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