Jump to content

Pausing invidual script execution


Core
 Share

Recommended Posts

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...

Link to comment
Share on other sites

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.

GPG: 3694569D | Peppermint OS | i7 | GTX 960 | Github

Link to comment
Share on other sites

Than you again, I actually thought something like what darthlukan explained. I'm slowly heading to the ballpark smile.png

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/

  • Upvote 1
Link to comment
Share on other sites

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.

GPG: 3694569D | Peppermint OS | i7 | GTX 960 | Github

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...