Game Function "aiTaskUnitEject" crashes the Game

:arrow_forward: GAME INFORMATION

  • GAME BUILD #: 39346
  • GAME PLATFORM: Steam
  • OPERATING SYSTEM: Windows 10

:arrow_forward: ISSUE EXPERIENCED

  • 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.

:arrow_forward: FREQUENCY OF ISSUE

  • 100% of the time / matches I play (ALWAYS)

:arrow_forward: REPRODUCTION STEPS

Here’s the steps to reproduce the issue:

  1. Backup the default aiMain.xs file.
  2. 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.
  3. 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.

:arrow_forward: EXPECTED RESULT

aiTaskUnitEject to work and not crash the game.

:arrow_forward: IMAGE

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.

2 Likes

Heey @NewMercies1775, thanks for your report :smiley:. We’re now tracking this issue. The second parameter has to become a vector instead of an int :slight_smile:.

3 Likes

Thank you! I look forward to a fix, and the vector makes sense! I tried that initially but the file did not compile since it takes two integers as a parameter, which I found out after I saw it in the dump.

1 Like