The problem with NeverWinter Script is it fires and it is done. Instructions can’t be run midway telling it to wait and check again later. When it comes to things that should take time (such as digging or chopping trees) we have limited options.
The first is to run an on-hit system, requiring the player character to repeatedly hit a target object to run the script. This is perfect for chopping trees. The animation is there and it looks realistic. This doesn’t work so well for digging holes in the ground.
The second option is to pin the player for the entire time they should be doing something, playing an animation. The problem of course is that the player is vulnerable. However, this works for short period actions, such as drinking from the river.
Another option is one that I think is perfect for digging applications and others where a player must remain in position. This option involves running a check through the modules heartbeat script to check and make sure a player is doing something. This script checks that the player is still “doing” an action and runs the appropriate script.
Our mining script (digging side) involves the player using the shovel, and the character starts digging (using the nasty digging animation that puts the shovel through your knees). The location of the player is memorised and the action of “digging” is set on the player. A mound is created at the digging point and the heartbeat checks that the player hasn’t moved.
Assuming all is good then the deductions are calculated and applied to the mound and player until completion. Once the hole has been dug, the mine is ready and the mound is replaced by the “entrance”. Mining is complete.
This is an excellent way for our mining system to work. Not only does it ensure that the player doesn’t go walkabout in between, it also means that the player CAN go walkabout in between. If they get attacked, they can fight back and resume mining afterwards.
With just a few things to optimise and iron out, the action script and mining systems should be almost finished very soon indeed.