- GAME BUILD #: 39346
- GAME PLATFORM: Steam
- OPERATING SYSTEM: Windows 10
- One function I saw in the XS dump produced from using the AI debugger is called aiTaskUnitEject with default parameters (int = -1, int = -1). The function was added in DE. A similar function, aiTaskUnitEnter was also added, with the same parameters. In trying to improve the AI, I used both of these to create a custom garrison plan. aiTaskUnitEnter works, by setting the first int parameter equal to the unit’s ID and the second to the building’s ID. For example, you can use a settler’s ID and a town center’s. These values refer to specific units/buildings. However, I tried using using the building ID first when using aiTaskUnitEject, and second the unitID. It crashed. I reversed them, and it also crashed. I also tested just using the building’s ID, thinking perhaps it ejected them all. Still I experienced a crash when the function was executed in the code. I resorted to letting the AI just use the default town bell plan that it autocreates with autocreated bases until this can be fixed. If it is the case that I have misused the function, I will appreciate if anyone can let me know the correct way to use it that does not crash the game.
- 100% of the time / matches I play (ALWAYS)
Here’s the steps to reproduce the issue:
- Backup the default aiMain.xs file.
- Edit this file now by using aiTaskUnitEnter(villagerID, townCenterID) or you can also use aiTaskUnitMove(villagerID, townCenterID) to move a villager into the town center, at the start of the game is fine.
- Launch a rule and wait maybe 5 or 10 seconds then try to use aiTaskUnitEject to eject that same villager from that town center (the same unitIDs). The game should crash.
aiTaskUnitEject to work and not crash the game.
The game runs smoothly and the file compiles until it executes the function, and then the game crashes and closes completely, so there is nothing to include here.