17/10/2021 21:28
Código:
RandomlyMoveNPC(npcid, Float: radius = 3.0) {
new Float: x,
Float: y,
Float: z,
Float: min_x,
Float: min_y,
Float: max_x,
Float: max_y;
FCNPC_GetPosition(npcid, x, y, z);
min_x = x - radius;
min_y = y - radius;
max_x = x + radius;
max_y = y + radius;
x = random(floatround(max_x) - floatround(min_x)) + floatround(min_x);
y = random(floatround(max_y) - floatround(min_y)) + floatround(min_y);
FCNPC_GoTo(npcid, x, y, z);
}
Agora, para que o NPC não atravesse paredes, você precisará usar o plugin ColAndreas.