Jump to content

combat.laststartattacktime could be nil, that causes crash


Whateverr
  • Fixed

After recent update (ver 436978), laststartattacktime  of combat component will be set to nil when Combat:CancelAttack() was called.

In crittersbrain.lua line 115, owner_combat.laststartattacktime is passed to math.max as the first param, it caused the following crash.

[02:01:05]: [string "scripts/brains/crittersbrain.lua"]:115: bad argument #1 to 'max' (number expected, got nil)
LUA ERROR stack traceback:
scripts/brains/crittersbrain.lua:115 in (upvalue) _avoidtargetfn (Lua) <87-120>
   self =

And combat.laststartattacktime is also used in some stategraphs without determining whether it is nil:

[02:52:29]: [string "scripts/stategraphs/SGshadowcreature.lua"]:75: attempt to perform arithmetic on field 'laststartattacktime' (a nil value)
LUA ERROR stack traceback:
scripts/stategraph.lua:505 in (method) GoToState (Lua) <456-515>

I believe that there also be other scripts have this issue.


Steps to Reproduce

First, get a critter pet.

Then try to force attack some creatures such as pigman, but cancel this action immediately.

Walks to your pet to let it get out of the way, the game will crash.

 

  • Like 2



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

We met this too

Especially when you choose Walter with Woby.

When you fight with a pigman, the game will crash immediately.

events = table: 29A04D98       behaviourqueue = table: 29A04BB8       runawayfrom = 119924 - icehound (valid:true)       stopped = false       inst = 132532 - wobybig (valid:true)    target = 119924 - icehound (valid:true)    owner = 131106 - walter (valid:true)    owner_combat = table: 38692220    target_combat = table: 2F234A40

Edited by Teegame
  • Like 1

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...