AddUserStatic
Adds a user-defined static item to the shard data and returns its index. The index can later be used to remove it via RemoveUserStatic.
User statics behave exactly like normal shard statics for pathfinding and step calculations. This is useful when an area is blocked by dynamic objects (such as fences) that the pathfinder doesn’t know about in advance. By adding these objects as user statics, the pathfinder will account for them from the start, avoiding repeated re-pathing.
Important: User statics are added to the shard data, not to a specific character. They will apply to all characters using the same shard files.
User statics are not cleared on disconnect. Use ClearUserStatics to remove them explicitly.
Returns -1 on error.
In Python, this method is named CreateUserStatic + synonym AddUserStatic, with the parameter set.
Добавляет пользовательский статик-объект в данные шарда и возвращает его индекс. Индекс может быть использован для удаления через RemoveUserStatic.
Пользовательские статики ведут себя точно так же, как обычные статики шарда при расчёте пути и шагов. Это полезно, когда область заблокирована динамическими объектами (например, заборами), о которых pathfinder не знает заранее. Добавив эти объекты как пользовательские статики, pathfinder учтёт их с самого начала.
Важно: Пользовательские статики добавляются в данные шарда, а не к конкретному персонажу. Они будут применяться ко всем персонажам, использующим те же файлы шарда.
Пользовательские статики не очищаются при отключении. Используйте ClearUserStatics для их удаления.
Возвращает -1 при ошибке.
В Python метод называется CreateUserStatic + есть синоним AddUserStatic с набором параметров.
function AddUserStatic(const StaticItem: TStaticItem; WorldNum: Byte): Integer;
Parameters:
- StaticItem — record describing the static item.
- WorldNum — world/facet number (0 = Felucca, 1 = Trammel, etc.).
Type definition:
TStaticItem = packed record
Tile: Word;
X: Word;
Y: Word;
Z: ShortInt;
Color: Word;
end;
def CreateUserStatic(StaticItem: UserStaticItem, WorldNum: int) -> int: ...
def AddUserStatic(tile: int, x: int, y: int, z: int, color: int, world_num: int) -> int: ...
var
item: TStaticItem;
begin
item.Tile := $0822;
item.X := 500;
item.Y := 200;
item.Z := 0;
item.Color := 0;
AddUserStatic(item, 0); // add to Felucca
AddToSystemJournal('User static added at (500, 200)');
end.
item = UserStaticItem()
item.Tile = 0x0822
item.X = 500
item.Y = 200
item.Z = 0
item.Color = 0
CreateUserStatic(item, 0) # add to Felucca
AddToSystemJournal('User static added at (500, 200)')