Skip to content

SetBuildingProduction

nyfrk edited this page Feb 3, 2022 · 2 revisions

ISettlers4Api::SetBuildingProduction method

Change the production goal of a building. This is the same event that is issued when the player commands a building to produce a certain amount of goods.

Syntax

BOOL ISettlers4Api::SetBuildingProduction(
	DWORD building, 
	S4_GOOD_ENUM good, 
	INT amount,
	DWORD player
);

Parameters

building

The index of the building to change the production. The player should own this building.

good

The good type you want to start or stop the building to produce. See S4_GOOD_ENUM for a list of possible good types. The building should be able to produce the specified good.

amount

The amount of units that you want to queue for production. This value is besides some exceptions additive. You can pass negative values to reduce the amount of units in the queue. The game does only use the following values.

Value Description
-5 Subtract five unit from the queue.
-1 Subtract one unit from the queue.
0 Clears the queue. This will stop the building from producing further units.
1 Add one unit to the queue.
5 Add five units to the queue.
100 The game will interpret this as infinity and will never decrease the queue.

player

The player who issues the command. Use 0 (zero) to issue this event as the local player.

Return value

If this method could append the event successfully it will return TRUE. If an error occurred it will return FALSE.

Remarks

The corresponding network event id of the command is ID 5033.

Usually the production for a building is distributed over all buildings of the same type in the eco sector of the specified building. So this command actually changes the eco sectors production goals.

Requirements

Minimum API Level 1
Target Edition Any
Header S4ModApi.h
Library S4ModApi.lib
DLL S4ModApi.dll

See also

ISettlers4Api

ISettlers4Api::SetBuildingProductionPercentMode

ISettlers4Api::SetBuildingProductionPercentage

Clone this wiki locally