Core Posted November 22, 2015 Share Posted November 22, 2015 Hello again! And again I'm here asking stupid questions... I still have some problems with the door jamming, but moved on for now. So I'm modifying default enemy AI for my needs and making slow, but steady progress. Now enemy has basic patrol mode and it attacks player. And gives up hunting if player gets too far away. Thanks for Nick Ace for navpoint tutorial! But I would like enemy to stop for a few seconds when reaching navpoint, so is there pause function in lua? I tried to search but could not find anything useful... Quote Link to comment Share on other sites More sharing options...
Josh Posted November 23, 2015 Share Posted November 23, 2015 Just set a breakpoint and run in debug mode: http://www.leadwerks.com/werkspace/page/tutorials/_/script-debugger-r34 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
darthlukan Posted November 23, 2015 Share Posted November 23, 2015 Hello again! And again I'm here asking stupid questions... I still have some problems with the door jamming, but moved on for now. So I'm modifying default enemy AI for my needs and making slow, but steady progress. Now enemy has basic patrol mode and it attacks player. And gives up hunting if player gets too far away. Thanks for Nick Ace for navpoint tutorial! But I would like enemy to stop for a few seconds when reaching navpoint, so is there pause function in lua? I tried to search but could not find anything useful... Check out the time documentation for lua. What you can do is set an idle delay variable, grab the time the mob gets to the navpoint, start a loop, then set it's mode to "idle", and check the "end time" variable (start + delay) against the "current time". If current time (set in the loop) is greater than or equal to "end time" (set before the loop), set your mob's mode appropriately to "roam", else continue the loop. Quote GPG: 3694569D | Peppermint OS | i7 | GTX 960 | Github Link to comment Share on other sites More sharing options...
Core Posted November 23, 2015 Author Share Posted November 23, 2015 Than you again, I actually thought something like what darthlukan explained. I'm slowly heading to the ballpark Quote Link to comment Share on other sites More sharing options...
thehankinator Posted November 23, 2015 Share Posted November 23, 2015 Than you again, I actually thought something like what darthlukan explained. I'm slowly heading to the ballpark You should take a look at the time api included in Leadwerks. Using lua's time functions would work if implemented correctly however Leadwerks Engine manages how and when the game time is updated, this ensures that your logic is tied to game time rather than system time. You would be mostly interested in Time:GetCurrent(). http://www.leadwerks.com/werkspace/page/api-reference/_/time/ 1 Quote Link to comment Share on other sites More sharing options...
darthlukan Posted November 23, 2015 Share Posted November 23, 2015 You should take a look at the time api included in Leadwerks. Using lua's time functions would work if implemented correctly however Leadwerks Engine manages how and when the game time is updated, this ensures that your logic is tied to game time rather than system time. You would be mostly interested in Time:GetCurrent(). http://www.leadwerks.com/werkspace/page/api-reference/_/time/ I totally forgot to check and see Leadwerks' API Reference. That's definitely the best route to take. Quote GPG: 3694569D | Peppermint OS | i7 | GTX 960 | Github Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.