.

Lord Olleus said:
Is there anyway for finding out which square a unit has just moved from?
Well the hard way would be to log the location of each unit in the OnBeginPlayerTurn event. Otherwise I have no idea how you would do it.

Lord Olleus said:
pPlot only tells you the square to which it has moved. Also if the unit moves along a long path, is it called every time it moves a single square or only once per turn?
Thanks in advance.
It is called for every plot the unit moves.
 
Lord Olleus said:
Well thats not to bad then. just 8 squares to check. Still it would be a nice thing for someone to mod once they release the SDK. That and a function called after an attack has been launched but before it has been resolved.

8 squares to check? Huh? you would need to do it for every unit in the game if you wanted to cover all your bases.
 
He means 8 per unit and move.

Im checking all the surrounding squares every time a unit moves in my StackAid code. Trade-off on efficency.
 
TheLopez said:
Well the hard way would be to log the location of each unit in the OnBeginPlayerTurn event. Otherwise I have no idea how you would do it.

Or whenever a unit moves. Just define a dictionary that stores the current unit location with the unit ID as key and update it whenever a unit moves (or is created). Takes up some memory, but that's insignificant compared to all other info stored about each unit. Only takes, what, 3 lines of code?

Of course, passing the old location in the event would be more efficient, but it will indeed take the SDK to acomplish that.
 
Locutus said:
Or whenever a unit moves. Just define a dictionary that stores the current unit location with the unit ID as key and update it whenever a unit moves (or is created). Takes up some memory, but that's insignificant compared to all other info stored about each unit. Only takes, what, 3 lines of code?

Of course, passing the old location in the event would be more efficient, but it will indeed take the SDK to acomplish that.

This is exactly what I do in the Moon Mod.
 
Locutus said:
Or whenever a unit moves. Just define a dictionary that stores the current unit location with the unit ID as key and update it whenever a unit moves (or is created). Takes up some memory, but that's insignificant compared to all other info stored about each unit. Only takes, what, 3 lines of code?
Yep that's about it.

Locutus said:
Of course, passing the old location in the event would be more efficient, but it will indeed take the SDK to acomplish that.
I agree, but nobodies perfect.
 
Back
Top Bottom