Bad Player
Deity
I'd like to cause all units with the undead promotion to move towards a lure (either a fixed tile or an item). Is it possible to code this? I can't think of any code already done that I could easily modify (maybe someone can think of some similar code?).
EDIT: are the Lurchuip AI attracted to pieces of Barnaxis?
EDIT2: A slow way to do this (because it would cycle through all units each turn) might be:
def onturnbegin:
Get lure x coordinate and name it LurePosX
Get lure y coordinate and name it LurePosY
If lure exists
... Cycle through all units (maybe using the for loop) on map and if a unit has the undead promotion
...... Get unit's x coordinate and name it UndeadUnitX
...... Get unit's y coordinate and name it UndeadUnitY
...... MoveUnitX = 0
...... MoveUnitY = 0
...... If UndeadUnitX < LurePosX
......... MoveUnitX = 1
...... If UndeadUnitX > LurePosX
......... MoveUnitX = -1
...... If UndeadUnitY < LurePosY
......... MoveUnitY = 1
...... If UndeadUnitY > LurePosY
......... MoveUnitY = -1
...... Change the unit's (x,y) position by adding MoveUnitX and MoveUnitY to its position (maybe check if it is a valid tile for the unit - not water/mountain, not owned by another nation)
...... Subtract one movement point from the unit
EDIT: are the Lurchuip AI attracted to pieces of Barnaxis?
EDIT2: A slow way to do this (because it would cycle through all units each turn) might be:
def onturnbegin:
Get lure x coordinate and name it LurePosX
Get lure y coordinate and name it LurePosY
If lure exists
... Cycle through all units (maybe using the for loop) on map and if a unit has the undead promotion
...... Get unit's x coordinate and name it UndeadUnitX
...... Get unit's y coordinate and name it UndeadUnitY
...... MoveUnitX = 0
...... MoveUnitY = 0
...... If UndeadUnitX < LurePosX
......... MoveUnitX = 1
...... If UndeadUnitX > LurePosX
......... MoveUnitX = -1
...... If UndeadUnitY < LurePosY
......... MoveUnitY = 1
...... If UndeadUnitY > LurePosY
......... MoveUnitY = -1
...... Change the unit's (x,y) position by adding MoveUnitX and MoveUnitY to its position (maybe check if it is a valid tile for the unit - not water/mountain, not owned by another nation)
...... Subtract one movement point from the unit