Skip to content
nyfrk edited this page Feb 3, 2022 · 2 revisions

ISettlers4Api::TradeGood method

Specifies what goods and how many a market or harbor shall transport.

Use ISettlers4Api::SetTradingRoute to establish the destination building for the trade.

Syntax

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

Parameters

building

The index of the building whose trade goods are being changed. The player should own this building.

good

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

amount

The amount of units that you want to queue for trade. 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 trading 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 5006.

Requirements

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

See also

ISettlers4Api

ISettlers4Api::SetTradingRoute

Clone this wiki locally