Follow and Cover

Thanks for trying Hambil. I loaded up yesterday's version and found that it had an issue with frigates guarding missionaries where the frigate would fall a turn behind the missionary. Also initially when the unit is commanded it thinks it should be exploring then double backs to guarding duties.

Keep trying, if I come up with any ideas I'll let you know. It's a great concept and honestly escorting should be in the default game already. It is ridiculous not to have it considering the tedium of shuffling 1UPT units independently which is almost a game breaker on larger maps. There is really no excuse for its absense in the game.

Good luck modding it.

Cheers
 
To answer the question in the code ;)

Code:
function GetOtherUnitByPlot( unit )
  local plot = unit:GetPlot()
	
  for i = 0, plot:GetNumUnits()-1, 1 do
    if unit ~= plot:GetUnit(i) then
      return plot:GetUnit(i)
    end
  end
end
 
Thanks! Doesn't really answer the question though. I don't want a loop inside a loop in an event called so often. However, there appears to be no obvious way to find out who the hell is on a tile with you, only that they are. BTW: Ran into an interesting edge case: City has archer. Worker crosses into city just as new warrior is constructed. Tile now has 3 units. Warrior is confused.
 
no obvious way to find out who the hell is on a tile with you

And looping only the units on the plot you're on doesn't do that???
 
Thanks Hambil. I had to give the mod up last game because I started getting units following and covering when I hadn't asked them too. I think it happened when a unit and worker temporarily sat on the same tile (seemed to automatically trigger it).

It would be great if the covering unit could actually keep up with a unit that is moving along a path. At this stage the covering unit falls behind by one turn.

Keep up the good work. The code is very readable.

Cheers
 
I think it happened when a unit and worker temporarily sat on the same tile (seemed to automatically trigger it).
Thanks for the feedback! I'll see if I can make it do this and get it fixed. As for the falling one turn behind, it shouldn't do that, unless it started one turn behind. What conditions did you run into the 'one turn behind' bug?

I'm very much looking forward to continue development on this. Whoward has written some great code that has given me plenty of ideas. And I know there is much more I can do. I just needed some sleep :p
 
So far I am unable to reproduce this bug. If a combat unit is already automated and not a scout, and not covering someone, then it will move to do so if it crosses paths with an unescorted civilian. But I'm not sure why non-scout combat units would be automated (unless you're desperate for a scout). In the later case, move the unit a few tiles away from the nearest worker before automating it. However, if in scouting it gets too close it will stop scouting and escort.
 
Just curious - is this a DLL mod?
 


Make sure you finish any current games before updating from an older version of Follow and Cover, or your saved games may not load.

This mod changes UnitPanel.lua and will conflict with any mods that change that file.

Beta release.
Where in the program files does this mod go?
 
Put the .civ5mod file into the "~\Documents\My Games\Sid Meier's Civilization 5\MODS" sub-folder (where ~ will depend on what version of Windows you're using), start the game, go into the Mods screen, wait a bit and the game will unpack the mod and let you enable it (just as if it had been downloaded from Steam)
 
Put the .civ5mod file into the "~\Documents\My Games\Sid Meier's Civilization 5\MODS" sub-folder (where ~ will depend on what version of Windows you're using), start the game, go into the Mods screen, wait a bit and the game will unpack the mod and let you enable it (just as if it had been downloaded from Steam)
Gotcha—thanks…
 
Back
Top Bottom