Does anyone know how to avoid the issue of creating (or teleporting) an object at location while the location is occupied by another unit?
Normally what happens is the unit does not get created until the location is free.
I have an idea of creating some manual objects in area checks to try and find a free spot but i was wondering if there was something better way to solve this problem.
If you want to guarantee a unit to be placed somewhere specific, and you are willing to use garrisoning, you can always modify a objects garrison capacity and use create garrisoned object. (even if it’s full, they are created outside.)
If not, and you are willing to lose objects at the location, you can just remove/kill all objects at the location first. That is the only way I can think of doing it.
As for teleporting, I do not recommend that. Although, if you have to use this, make sure there is a 3x3 empty space/area where you are going to teleport to and it should work just fine.
Very simple trick I’m using: Create an Invisible Object and Replace it with the wanted Object. If the tile is occupied, the invisible object will slightly move dynamically like a unit before getting replaced.
Note 1: With the current patch, Replace Object effect is kinda bugged as the HP of replaced objects does not currently scale up. So as the Invisible Object only has 1HP, the replacing Object will also only have 1HP. Temporary fix is to create a Heal Object effect lastly, to fully heal the replacing object up to its max HP value.
Note 2: Replaced Objects are automatically “forgotten” by AIs. That means that they won’t ever be used by the AI within attack groups or anything else. So keep that in mind.
thanks will have a look into this