Skip to content
nyfrk edited this page Aug 29, 2020 · 2 revisions

ISettlers4Api::SendWarriors method

Commands warriors or specialists to move to a certain position on the map. This will create the same event that the player induces when commanding units.

Syntax

BOOL ISettlers4Api::SendWarriors(
	INT x, 
	INT y, 
	S4_MOVEMENT_ENUM mode, 
	PWORD warriors, 
	SIZE_T countOfWarriors,
	DWORD player
);

Parameters

x

This is the target x coordinate on the map of this movement command.

y

This is the target y coordinate on the map of this movement command.

mode

The mode parameter can be one of the following values.

Value Description
S4_MOVEMENT_FORWARD
0
Forward
Units will move towards a target and idle at the target. They will attack enemies on sight.
S4_MOVEMENT_PATROL
1
Patrol
Units will patrol between its current position and the target position. They will attack enemies on sight.
S4_MOVEMENT_ACCUMULATE
2
Accumulate
The position will be appended to the units target list. After reaching its current target it will go to the next. It will idle at the last target of the list. They will attack enemies on sight.
S4_MOVEMENT_WATCH
4
Watch
Units will move towards a target and idle at the target. They will not attack enemies while moving towards the target.
S4_MOVEMENT_STOP
8
Stop
Stops the Units and makes them idle. They will attack enemies on sight.

warriors

A pointer to a WORD array of the settler IDs that are to be commanded. The units must be owned by the local player.

countOfWarriors

The number of elements in the warriors array.

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 movement command is ID 5014.

If more than 100 units are in the buffer, the method will create multiple events such that one event contains at most 100 units.

This method does not trigger the callbacks registered by the ISettlers4Api::AddSettlerSendListener method. It is therefore safe to call it from withing a S4SettlerSendProc callback procedure.

Requirements

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

See also

ISettlers4Api

S4SettlerSendProc

ISettlers4Api::AddSettlerSendListener

Clone this wiki locally