[General] How to properly change structures' (with pathing map) location?

Level 3
Joined
Nov 11, 2021
Messages
33
How to properly move structure (with pathing map)?

SetUnitX/Y: does not refresh ground texture graphics; does not refresh unit graphics in case of gold mine.
SetUnitPosition: highly broken -- tend to move structure unnecessarily. e.g. SetUnitPosition(u, GetUnitX(u), GetUnitY(u)) moves gold mines on stock melee map Lost Temple.
ShowUnit(false) & ShowUnit(true): sort of like SetUnitPosition, but with additional fading/transition animation.

I want to have the effect of SetUnitX/Y plus unbreak the graphics.
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
833
Id imagine theres really no center to every pathing map. Like where is the center cell of 4 cells if the building can only be placed at a cell? If the pathing map is 9 cells then the center is the middle cell, easy, but if its like 12 cells then where is the most center cell? Its a draw between 4 cells and Id imagine the game has a rule it follows each time, f.e. it might always choose the cell to the northeast, offsetting the center a bit. Dont know if thats the actual rule it was an example. Hence it might help to just offset the x and y by like -0.02 and -0.02 but that could potentially cause an issue with pathing maps that actually do have a center. It might be a rare case or not possible for that error though since if its the middle of a cell it would require an offset of at least 32 to change the cell.
 
Level 3
Joined
Nov 11, 2021
Messages
33
what about removing and creating a new version of the building at the target location?
It could be a potential workaround, but may introduce some side effect (e.g. melee AI).
I would prefer some way to move the buildings & mines (which is easier to verify than melee AI).
 
Level 3
Joined
Nov 11, 2021
Messages
33
Id imagine theres really no center to every pathing map. Like where is the center cell of 4 cells if the building can only be placed at a cell? If the pathing map is 9 cells then the center is the middle cell, easy, but if its like 12 cells then where is the most center cell? Its a draw between 4 cells and Id imagine the game has a rule it follows each time, f.e. it might always choose the cell to the northeast, offsetting the center a bit. Dont know if thats the actual rule it was an example. Hence it might help to just offset the x and y by like -0.02 and -0.02 but that could potentially cause an issue with pathing maps that actually do have a center. It might be a rare case or not possible for that error though since if its the middle of a cell it would require an offset of at least 32 to change the cell.
Did you read the post and know what are you talking about? I explicitly listed the example of gold mines on melee maps.
ngol has 16x16 pathtex with 8x8 un-groundable center, and melee maps objects are properly placed without conflictions.

In addition, SetUnitPosition() isn't off by 32, it is off by hundreds.
Apparently its calculation is broken and requires extra margin from nearby trees and/or structures.
 
Level 3
Joined
Nov 11, 2021
Messages
33
this is a strange way to talk to someone trying to help you
Well, I tried to distinguished between helpers and bullshiters, as usually the majority are the former on any Q&A communties (like stackoverflow).
I classified #3 as 80% noise and 20% maybe trying to help, so I did a unnoisy reply with a discourteous tone.
 
Top