Jump to content

How to fix mobs doing nothing after embarking

Recommended Posts

Mobs neither continue or abort buffered actions upon embarking, which leads to them standing idle until interrupted. For example, Sea Striders will be idle for 15 seconds after jumping off a platform to eat a fish. I assume this timeout was added specifically for that issue.

This can be fixed by adding this to behaviours/doaction:


function DoAction:Visit()
    if self.status == RUNNING and self.inst.sg:HasStateTag("idle") then
        self.status = READY --try again if we're idle for some reason...

    if self.status == READY then
        local action = self.getactionfn(self.inst)
        if action then
            action:AddFailAction(function() self:OnFail() end)
            action:AddSuccessAction(function() self:OnSucceed() end)
            self.pendingstatus = nil
            self.inst.components.locomotor:PushAction(action, self.shouldrun)
            self.action = action
            self.time = GetTime()
            self.status = RUNNING
            self.status = FAILED
    if self.status == RUNNING then
        if self.timeout and (GetTime() - self.time > self.timeout) then
            self.status = FAILED
            --print("Action timed out, failing")
        if self.pendingstatus then
            self.status = self.pendingstatus
        elseif not self.action:IsValid() then
            self.status = FAILED


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...