#4507 closed defect (fixed)
Something wrong with TreasureCollected event in treasure islands scenario map
Reported by: | fatherbushido | Owned by: | fatherbushido |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 23 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: |
Description (last modified by )
In a21 or current svn r19287,
when collecting a treasure on the treasure islands scenario map (where the goal is to collect all treasures) the TreasureCollected
method is called many times and so it leads to the victory. That event is called by ResourceGatherer.TryInstantGather
(That's the map given in example in the wiki doc http://trac.wildfiregames.com/wiki/Triggers#Examples)
See also what happens with the AI
Attachments (3)
Change History (17)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
comment:3 by , 7 years ago
4 would be false too. You tried to gather the first one then stop (don't auto gather)?
by , 7 years ago
Attachment: | commands.txt added |
---|
yep, revealed map, clicked that one, then with a merchantship the closest treasure around
comment:4 by , 7 years ago
in fact there is different kind of treasure (use a cargo treasure to reproduce)
The dashed remark makes no sense. I succeed to reproduce with the persian metal treasure on the starting island.
comment:5 by , 7 years ago
Description: | modified (diff) |
---|
comment:6 by , 7 years ago
(unrelated but there are some treasures templates in gaia/ and some in other/, there should be some logic but I didn't really find it)
See also around L2400 of UnitAI (In fact, we don't leave and loop on trying to gather the treasure - dunno if it's related to the I am too busy cheat-code)
comment:7 by , 7 years ago
This doesnt seem related to the map but UnitAI or so.
If you add an warn("Pickup:" + this.entity);
to the if (cmpResourceGatherer.TryInstantGather(this.gatheringTarget))
line in UnitAI which initiates the TreasureCollected
event, you see that that it is somehow called for many entities, despite the fact that we sent the order only to one.
comment:9 by , 7 years ago
(See also ResourceSupply.TakeResources
)
In fact with the i am too busy code, the destroy message (for the treasure) is sent but we try again to gather him and that many times (so we don't add the ress, but we try to gather it and call the trigger event).
So happy that this map revealed that bug.
I wonder if we can't have that with some stats without the cheat code.
Changing the treasure rate gathering in unit template allow to reproduce the bug without the time cheat code.
I see several fix but I don't want to just add an hack.
comment:10 by , 7 years ago
Description: | modified (diff) |
---|
Now (r20140) after taking the first treasure, I still have the bug but -that's the purpose of the update- also an error:
ERROR: JavaScript error: gui/session/messages.js line 899 TypeError: Engine.GetGUIObjectByName(...) is undefined addChatMessage@gui/session/messages.js:899:51 playersFinished@gui/session/session.js:549:1 g_NotificationsTypes.defeat@gui/session/messages.js:316:3 handleNotifications@gui/session/messages.js:531:4 onSimulationUpdate@gui/session/session.js:824:2 __ eventhandler263 (simulationupdate)@sn simulationupdate:0:1__
(introduced by r19955)
comment:11 by , 7 years ago
Also the treasure in the middle island seems unpickable (a fix like r19553 could be done)
by , 7 years ago
Attachment: | patch.diff added |
---|
Simple fix. Needs to figure if that approach is better than an owner check in the calling code.
comment:14 by , 7 years ago
Milestone: | Backlog → Alpha 23 |
---|
Got replay of insta victory? In my test I had to collect about 4 treasures