#3430 closed defect (fixed)
[PATCH] UnitAI - undefined property this.order.data.type while gathering
Reported by: | Kieran P | Owned by: | Itms |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 19 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: |
Description
These errors got repeated hundreds of times.
WARNING: JavaScript warning: simulation/components/UnitAI.js line 2218 reference to undefined property this.order.data.type ERROR: JavaScript error: simulation/components/UnitAI.js line 2218 TypeError: this.order.data.type is undefined UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.GATHER.GATHERING.enter@simulation/components/UnitAI.js:2218:11 FSM.prototype.SwitchToNextState@simulation/helpers/FSM.js:376:1 FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:284:4 UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3840:63 ERROR: Script message handler OnMotionChanged failed ERROR: Error in timer on entity 7325, IID 89, function TimerHandler: TypeError: resourceType is undefined UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.GATHER.GATHERING.Timer@simulation/components/UnitAI.js:2262:1 FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29 UnitAI.prototype.TimerHandler@simulation/components/UnitAI.js:3798:68 Timer.prototype.OnUpdate@simulation/components/Timer.js:100:4
Attachments (3)
Change History (17)
comment:1 by , 9 years ago
Summary: | JS Errors during AI autoplay → UniAI - undefined property this.order.data.type while gathering |
---|
comment:3 by , 9 years ago
Summary: | UniAI - undefined property this.order.data.type while gathering → UnitAI - undefined property this.order.data.type while gathering |
---|
by , 9 years ago
Attachment: | commands.txt added |
---|
I reproduced the error with this commands.txt. Notice that about 30 turns before the error, there is a warning issued "WARNING: unexpected PathResult (5439 3 3)"
comment:4 by , 9 years ago
@ mimo: you sure that is the correct commands.txt? It seems "empty" to me.
By looking at the code it seems logical this crash occurs, because
this.order.data.type.specific
is never allocated.
This crash should occur when the check above is true, could not reproduce that.
follow-up: 6 comment:5 by , 9 years ago
Yes sure. It is an autostart with 4 AI, so all commands are generated by the AI.
this.order.data.type should be allocated in PerformGather for a true Gather order. But here, we enter in the gathering state with an Attack order !!! which should never happen.
comment:6 by , 9 years ago
Replying to mimo:
this.order.data.type should be allocated in PerformGather for a true Gather order. But here, we enter in the gathering state with an Attack order !!! which should never happen.
Found what is going wrong in the game: on this map player 3 (green normaly) starts of with a boar (animal with attack, not domestic) near it's cc. When he has a cav skirm he tries to attack that animal. So far no problems. But what happens then is that the cav walks all the way to the boar (like is normal for domestic animals) and then attacks, not like trowing spears from a distance (this triggers the warning "unexpected path result").
Then when the animal is dead we get all the errors, because the cav tries to gather state with an attack order.
The errors end when gatherring is done and the time between warning and errors is the killing time.
This should have something to do with the changes in the AI/pathfinding, wich allowed the AI (not on purpose) to attack not domestic animals, like domestic animals.
comment:7 by , 9 years ago
I had a look at it, and in fact it is a UnitAI problem, not a pathFinder one. The origin of it is that, when a unit finishes an order and has no other order, FinishOrder set it to IDLE. But this setting does not mean the state is switched to IDLE, this will only be done at the first message processed. In this case, after being set to IDLE, the unit is reordered to gather, and it is only when it starts to move (giving a MoveStarted message) that it is effectively switched to IDLE. And this makes it in a weird state: switching to IDLE (which means attacking nearby dangerous animals like the boar) while it has just started to move to gather chicken.
comment:8 by , 9 years ago
Keywords: | review added |
---|---|
Summary: | UnitAI - undefined property this.order.data.type while gathering → [PATCH] UnitAI - undefined property this.order.data.type while gathering |
by , 9 years ago
Attachment: | ticket3430.patch added |
---|
comment:9 by , 9 years ago
Above patch fixes the warnings.
I still got this error : Maybe it's not related at all
<p class="warning">WARNING: JavaScript warning: simulation/components/UnitAI.js line 2039 Script value conversion check failed: v.isNumber() (got type undefined)</p>
by , 9 years ago
Attachment: | ticket3430-v2.patch added |
---|
yes, i forgot to upload my current more complete patch, fixing that warning and another undef which may arise in the AI.
comment:12 by , 9 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
As the fix itself was not commited (I only commited the fixes for the flaws revealed by the fix), this ticket should not have been closed. So reopen it.
comment:14 by , 9 years ago
Keywords: | review removed |
---|
Can you provide the commands.txt file where that error occured? Which version did you use?