[MODCOMP] New sentry actions for units

Pep

King
Joined
May 28, 2002
Messages
688
Location
Spain
New sentry actions for units by Pep (use it with official patch 3.19. See attached files)

Changes from official patch:

New sentry orders:

  • Added new mission button: "Sentry until Healed" (Hotkey: Shift + H). Orders the active unit to sleep. The unit remains inactive until it reaches full strength OR an enemy unit of the same type (types: land or naval) enters its visibility range. Naval units carrying on this mission DO NOT activate by naval enemy units docked in a city within their visibility radius.
  • Added new mission button: "Sentry on naval units" (Hotkey: Shift + N). Orders the active naval unit to sleep. The unit remains inactive until an enemy NAVAL unit enters its visibility range (Very useful for privateers on enemy territory ;-)). Naval units carrying on this mission DO NOT activate by naval enemy units docked in a city within their visibility radius.
  • Added new mission button: "Sentry on land units" (Hotkey: Shift + L). Orders the active land unit to sleep. The unit remains inactive until an enemy land unit enters its visibility range.
  • Added new mission button: "Go To and Sentry" (Hotkey: X). Orders the active land or naval unit to move to a destination. The movement ends before reaching the destination if an enemy unit of the same type (land or naval) is within the visibility radius. Note: This order can´t be selected (and the action button remains invisible) if a enemy unit is already in the visibility range.

(see attached image Civ4ScreenShot0000.jpg to view the new order icons)

New city modes:

  • "Units built at city start fortified": When a city is in this mode, all the units built in the city start fortified instead of active. If the city has a waypoint, the unit fortifies when it reaches its destination. Very useful for make a city built units indefinitely without being disturbed by the interface for each new unit. Select a city or a group of cities and press <V> to select this mode. Press <J> to revert to normal mode. You can see in which mode is a particular city by selecting it and looking at the last line of the help (see attached image Civ4ScreenShot0001.jpg). The city mode is stored in the savegame using flag extension to maintain savegame compatibility.
  • "Units built at city autoairlift":
    When a city is in this mode, has an airport and a waypoint for units is set, if the built unit can't reach its destination in one turn and the destination is a city where the unit can airlift, it uses the airport automatically. Select a city or a group of cities and press <CTRL+V> to select this mode. Press <CTRL+J> to revert to normal mode. You can see in which mode is a particular city by selecting it and looking at the last line of the help. The city mode is stored in the savegame using flag extension to maintain savegame compatibility.

New mass effects for existing orders:

  • Added "mass delete mode": Presing ALT while clicking "Delete" on the active unit, deletes ALL player's units of the same type as the active one.
  • Added "mass fortify mode": Presing ALT while clicking "Fortify" on the active unit, fortifies ALL player's units of the same type as the active one. It only works if the active unit is ungroupped or groupped with units of the same type only. Also, only ungroupped or groupped with units of the active unit's type only, are fortified by this order.
  • Added "mass sleep mode": Presing ALT while clicking "Sleep" on the active unit, orders ALL player's units of the same type as the active one to sleep. Same restrictions as in "mass fortify mode".
  • Added "mass intercept mode": Presing ALT while clicking "Intercept" on the active unit (Fighter or Jet Fighter), orders ALL player's units of the same type as the active one to intercept. Same restrictions as in "mass fortify mode".

Standard movement behaviour changes:

  • Modified movement "standard" attack behaviour: now, if a unit ends its path movement on an unseen or unrevealed tile occupied by an enemy unit, the unit stops and activates so you can choose whether to attack or not (Standard behaviour was to attack the unseen unit).
  • Modified movement "standard" disembark behaviour: now, if a naval unit ends its path movement on an unrevealed land tile the unit stops and activates so you can choose whether to disembark or not (Standard behaviour was to disembark on the unrevealed land tile).

Standard selection mode changes:

  • Modified "standard" ALT + C behaviour when units from multiple domains (air, sea, land) are in the same plot. For example, standard ALT + C selects always all naval units in a sea plot, regardless of the domain of the selected unit. With the modified behaviour, if you select a unit and then pulse ALT + C, all the units of the SAME DOMAIN are selected. With this new behaviour if you select a land unit (loaded in a ship) in a sea plot and then pulse ALT + C, all land units (same domain type) in the same plot are selected.
  • Modified "standard" CTRL + H behaviour when units from multiple domains (air, sea, land) are in the same plot. For example, standard CTRL + H selects always all wounded naval units in a sea plot, regardless of the domain of the selected unit. With the modified behaviour, if you select a unit and then pulse CTRL + H, all wounded units of the SAME DOMAIN are selected. With this new behaviour if you select a land unit (loaded in a ship) in a sea plot and then pulse CTRL + H, all wounded land units (same domain type) in the same plot are selected.

New game options:

  • Added a new game option: "City governors build workboats". Now, city governors build workboats ONLY if this option is active. (Default: deactivated)
  • Added a new game option: "City governors train workers". Now, city governors trains workers ONLY if this option is active. (Default: deactivated)
  • Added a new game option: "City Governors Prioritize Goods Over Non Essential Buildings" If this option is NOT active (Default: deactivated), city governors try first to construct "non essential" buildings (like bunkers when not at war) over goods (gold, culture, etc.). Check this option if you like Civ 4 "standard" building order.

Bug fixes in official patch version:


Compatibility mode: Press CTRL + SHIFT + V to clear all new sentry orders for all units so you can save the game and load it without the mod. The units with cleared orders become active so that you can give them new orders.

How to use:

Official patch 3.19 version:
  • Copy CvGameCoreDLL.dll to Civ 4 directory subfolder: "Beyond the Sword\Assets" (Make a backup of the original file first!)
  • Copy the XML and DDS files to your "My Documents\My Games\Beyond the Sword\CustomAssets" subfolders.

Better BTS AI 0.82 merged version:

Better BTS AI mod main thread is:
http://forums.civfanatics.com/forumdisplay.php?f=245
  • Copy CvGameCoreDLL.dll to Civ 4 directory subfolder: "Beyond the Sword\Assets" (Make a backup of the original file first!)
  • Copy the XML, Python and DDS files to your "My Documents\My Games\Beyond the Sword\CustomAssets" subfolders.

DOWNLOAD:
New sentry actions for units v0.91: http://forums.civfanatics.com/downloads.php?do=file&id=12941
New sentry actions for units v0.93 merged with Better BTS AI v0.82: http://forums.civfanatics.com/downloads.php?do=file&id=12942

Notes:

  • Help for the new actions is only in English (and Spanish if selected in standard menu options). Sorry!
  • Source files that have been changed to build the dll are included.
  • WARNING: If you save a game using this mod and want to load it without the mod, make sure none of your units is carrying on any of the new "sentry orders" (use compatibility mode described above). If so, the game may hang your computer!
 

Attachments

  • Civ4ScreenShot0000.jpg
    Civ4ScreenShot0000.jpg
    106.7 KB · Views: 394
  • Civ4ScreenShot0001.jpg
    Civ4ScreenShot0001.jpg
    113.1 KB · Views: 376
Hmm. Somehow I missed those bugfixes. Mind if I include them in the next Unofficial Patch (with due credit of course)?

Also, I like the "Standard movement behaviour changes." :thumbsup: Always thought it was stupid that the game forces you to attack a unit in the black.
 
Hmm. Somehow I missed those bugfixes. Mind if I include them in the next Unofficial Patch (with due credit of course)?

Also, I like the "Standard movement behaviour changes." :thumbsup: Always thought it was stupid that the game forces you to attack a unit in the black.

Please, feel free to include my source changes in your unofficial patch. In fact, I'm currently compiling your patch with my modcomp :) .

You can follow the changes to the code as they are marked with a "// jlc:" comment. The comments are not very explanatory, though.

About changing the behaviour of attacking a unit in the black, I codded it as:
- new property m_lastPlotVisible in class CvSelectionGroup, to save the state (visible or not) of the last plot of the movement.
- two new functions, "void setLastPathPlotVisibility(bool eVisible)" and "bool isLastPathPlotVisible()" to establish and retrieve the value of the new property.
- Property initialization on CvSelectionGroup::reset.
- When a new move mission begins (CvSelectionGroup::startMission) setLastPathPlotVisibility is called.
- In CvSelectionGroup::groupAttack is called isLastPathPlotVisible.
 
Your "Go To and Sentry" (Hotkey: X) doesn't work for me. I merged it into my sdk, but its effect is the same as the standard "Go To" - the unit doesn't sentry (no enemy visible).
 
Your "Go To and Sentry" (Hotkey: X) doesn't work for me. I merged it into my sdk, but its effect is the same as the standard "Go To" - the unit doesn't sentry (no enemy visible).

I think I misnamed this new order. It's not intended to work as "first go to and then sentry when reached the destination". It works as a "sentry while going to": you give a unit an order to go to a distant tile, but if an enemy unit is spotted in its way, the movement ends and you retake the control of the unit.
 
That is actually a nice moid and I will be downloading it!

Any chance of including the 0.60 better AI into it? I believe it is more of a test version than a release, so no real need if you don 't want!

But, really, nice and simple changes right there!
:goodjob:
 
That is actually a nice moid and I will be downloading it!

Any chance of including the 0.60 better AI into it? I believe it is more of a test version than a release, so no real need if you don 't want!

But, really, nice and simple changes right there!
:goodjob:

Updated Better AI version to 0.60 :)
 
Modified movement "standard" behaviour: now, if a unit ends its movement on an unrevealed tile (from the initial tile when the movement begun point of view) the movement ends and thus you can choose whether to disembark or not.
This reminds me of something I find frustrating about transports.

I play a lot of games on Terra maps, and will park an empty transport in the middle of the ocean waiting to take a relay of the cargo destined for the New World from another transport that will end its turn on that exact spot. Well-organized relays like this can get a settler, missionary, and worker across the ocean and unloaded in as little as 2 turns if enough transports are in the right spots, but it requires a lot of micromanagement.

There's nothing I can see in the standard missions to do this, so my choice is to have the first transport stop one tile short of the rendezvous point to give me control to complete the order. I've tried ordering the transport to go to the tile and then unload, but the Unload order doesn't seem to queue; it immediately wakes the carried units, so I have to wait/skip each of them until they get to the RP.

It would be nice to have an Unload or Transfer Cargo order that properly queues, but failing that I want to be able to give a special conditional mission to any carried unit: When a ship carrying one of these units ends its turn in a city/fort, adjacent to land, or on the same tile as a transport with movement points remaining, I want the carried unit(s) to wake up so that I can decide whether they should leave the transport/enter the other one on this turn. It would be fine with me if this were the default behavior for all units sleeping in a ship, but making it a checkbox somewhere wouldn't be bad either, as I can imagine some people getting equally frustrated at having carried units waking up all the time.


I just hate it when a ship gets focus right next to a landmass or on top of a transport that the units could have entered last turn, and I realize that city will now be founded a turn later than it should have been.
 
Nice changes. I may include some of these in BULL (the BUG DLL). Do you have an all-encompassing short name for this modcomp for use in the comments to mark changes? I haven't looked at the source yet, so if you do already, RTFS is an acceptable answer. :mischief:

For example, in BULL I use

Code:
// BULL - [B]UP - Barrage Fix[/B] - start
...
// BULL - [B]UP - Barrage Fix[/B] - end

for the Unofficial Patch Barrage Fix. I'm looking for something to go where "UP" goes, preferably a little shorter than "New sentry actions for units". ;)

Edit: Nevermind. I see you used "jlc" to mark your changes, so I'll use the same in BULL.

Also, I've got some questions about a few of these features.

  • Mass delete action: does ALT + DELETE work?
  • Mass fortify action: does ALT + F work?
For ending moving in the black, do the changes take effect only when you move into an enemy-occupied or land (for ships) tile? If I'm exploring the ocean, does my unit stop for every empty unrevealed ocean tile so I can no longer click deep into the black and have it go until it hits land?

If not, you might want to make the explanation a little clearer as it only says, "if a unit ends its movement on an unseen or unrevealed tile, the movement ends," nothing about it being occupied by an enemy, only that you won't attack automatically. For that matter, what if there's an enemy along your path before the endpoint?

Perhaps something like this:

Units will no longer attack enemies or unload their cargo automatically when entering an unrevealed tile. Instead, they will stop moving (interrupt their mission) and allow you to issue new orders.​
 
Do the mass effects apply to all your units everywhere or only the ones on the current tile? If the latter, I recommend using CTRL because that's what Civ4 already uses for "apply to units of same type"

Also, from post 13

  • Mass delete action: does ALT + DELETE work?
  • Mass fortify action: does ALT + F work?
 
Do the mass effects apply to all your units everywhere or only the ones on the current tile? If the latter, I recommend using CTRL because that's what Civ4 already uses for "apply to units of same type"

Also, from post 13

  • Mass delete action: does ALT + DELETE work?
  • Mass fortify action: does ALT + F work?

It applies over all the units everywhere. With "Mass delete" you erase all your units of the same type in the whole map but "Mass fortify" has groupping restrictions (see the first post).

I chose "ALT" because is the key Civ 4 already uses for "Mass upgrade" (whole map effects). Indeed, I decided to introduce a "Mass fortify" action because I got tired of fortifying one by one all the units activated by a "Mass upgrade".

Mass effects only work when pressing "ALT" while clicking over the proper button. They don't work with the shortcuts, so ALT + DELETE and ALT + F do nothing.
 
Top Bottom