AI Core

ai-pedscale for developers

The player state and character metadata ai-pedscale keeps.

ai-pedscale has no exports and no events for other scripts. A character's size can be read in two places.

Player state aiPedScale

Set on the player when their character loads and on every change. { height: number, width: number }, 1 = normal. Removed when the size is back to 1 x 1. Written by the server only.

// Client: the height of another player (1 when not scaled).
export function heightOf(serverId: number): number {
  const scale = Player(serverId).state.aiPedScale as { height: number; width: number } | undefined;
  return scale?.height ?? 1;
}

Character metadata pedScale

The stored size in ai-core's character metadata, { height, width }. Read it on the server with GetPlayerData(source).metadata.pedScale.

Do not write pedScale from another script: ai-pedscale keeps its own copy in memory and would not draw the change. Use the panel or the commands.

On this page