SetTransferZone

Category: Objects / Status
Since engine version: 1.0 OC

Description

Sets the transfer zone of the object. If the pathfinding trail of another object leads through this transfer zone (a transfer zone is always considered completely passable in pathfinding) ControlTransfer calls will be made to the transfer zone object for the passing clonk. In these calls, the necessary script commands should be given to the clonk so he can pass the object and reach his destination.

Syntax

bool SetTransferZone(int x, int y, int width, int height);

Parameters

x:
X position of the top left corner of the new transfer zone, relative to the object center.
y:
Y position of the top left corner of the new transfer zone, relative to the object center.
width:
Width of the new transfer zone.
height:
Height of the new transfer zone.

Remark

Transfer zones have to be set anew when the object has moved. Also, they should be set anew in response to a OnSynchronized callback made by the engine.

Example

protected func Initialize() { return OnSynchronized(); }

protected func OnSynchronized() { return SetTransferZone(-GetX(), -GetY(), LandscapeWidth(), LandscapeHeight());

protected func ControlTransfer(clonk, endx, endy)
  {
  clonk->SetPosition(endx, endy);
  return 1;
  }
Script for a cheat object: a clonk with a movement command will be immediately warped to the destination.
Sven2, 2003-06