Skip to content
nyfrk edited this page Feb 2, 2022 · 1 revision

ISettlers4Api::SetMaxSelection method

Set the maximum number of settlers (warriors and the like) that the player may select.

This will extend the games capabilities beyond the hardcoded behavior of allowing the player to select at most 100 settlers. When assigning a selection with more than 100 settlers to a group the game will add only the first 100 settlers of the selection to the group. This is to not cause game logic issues (groups are considered for attack bonuses).

Syntax

DWORD ISettlers4Api::SetMaxSelection(
	DWORD dwMaxSelection
);

Parameters

dwMaxSelection

The amount of settlers the player is allowed to select. It must be a value in the range 0..10000. If it is set to 100 the selection modifications will be removed and the original static and hardcoded memory is used.

Return value

If this method could set the selection maximum successfully it will return 0. Otherwise it will return non-zero.

Remarks

Gold Edition support is hit and miss. You may have luck but it may not work with every gold release available.

When calling this function during loader lock (i.e. from DllMain) the modifications take place as soon as the loader lock is released.

The function changes the behavior when commanding settlers. Instead of just commanding the first 100 settlers when doing a right mouse click all other units in the selection are also commanded with an equal event. This may result in multiple SendSettler events since the event is limited to 100 units.

Other selection related functions like ISettlers4Api::GetSelection work with more than 100 units. So keep that in mind when using these with fixed array sizes.

Requirements

Minimum API Level 2.0.0
Target Edition HistoryEdition
Limited GoldEdition support
Header S4ModApi.h
Library S4ModApi.lib
DLL S4ModApi.dll

See also

ISettlers4Api

ISettlers4Api::GetMaxSelection

ISettlers4Api::GetSelection

ISettlers4Api::RemoveSelection

ISettlers4Api::ClearSelection

Clone this wiki locally