To those that also encountered the problem:
Background: When you order a ship to guard your position, it just stops and refuses to do any other orders
Problem: This seems to happens because it is trying to index a nil value to a ship variable. The function OnGuardButtonPressed is not successful.
Possible Solution: A local ship variable is used in the function and it was never instantiated before. I instantiated it after CheckCaptain evaluation to store the craft entity of the Player(me). After that, the error message doesn't appear when ordering to guard the position and the targeted ship effectively guards where you were at the moment of giving the order
Ill upload the new craftorder.lua version with the correction.. beware that it will overwrite any effect that any mod had on that file before. You have to place this file in "\data\scripts\entity"
If you want to modify it yourself instead: Just add the following in craftorder.lua inside the OnGuard Function, after "if checkCaptain() then" (see image below)
local ship = Player().craft
craftorders.zip