Staff members are employees that maintain and operate the park. Access them using map.getAllEntities('staff').
Staff Types
There are four types of staff:
"handyman" - Sweeps litter, mows lawns, waters gardens, empties bins
"mechanic" - Inspects and fixes rides
"security" - Stops vandals
"entertainer" - Entertains guests
const staff = map.getAllEntities('staff');
staff.forEach(member => {
console.log(`${member.name}: ${member.staffType}`);
});
Base Staff Properties
Name of the staff member.member.name = 'Bob the Handyman';
The type of staff member.console.log(`Type: ${member.staffType}`);
Colour of the staff member (0-31). Not applicable to entertainers.member.colour = 10; // Change uniform color
The enabled jobs the staff can do (bitmask).For handymen:
1 (0001): Sweeping
2 (0010): Watering flowers
4 (0100): Empty bins
8 (1000): Mowing
For mechanics:
1 (0001): Inspect rides
2 (0010): Fix rides
member.orders = 15; // Enable all handyman tasks (1+2+4+8)
member.orders = 3; // Enable both mechanic tasks (1+2)
costume
StaffCostume | string | number
The staff member’s costume. Primarily for entertainers.Available costumes: “panda”, “tiger”, “elephant”, “roman”, “gorilla”, “snowman”, “knight”, “astronaut”, “bandit”, “sheriff”, “pirate”member.costume = 'panda';
Array of costumes available to this staff member.console.log('Available costumes:', member.availableCostumes);
Location
The x-coordinate in game units.
The y-coordinate in game units.
The z-coordinate in game units.
The staff member’s direct destination.console.log(`Going to: (${member.destination.x}, ${member.destination.y})`);
The staff member’s orthogonal direction (0-3).
How tired the staff member is (32-128). Lower is more tired.
Patrol Area
Gets the patrol area for the staff member.
The patrol area object has these methods:
tiles
Gets or sets all individual tiles in the patrol area.
// Get all patrol tiles
const tiles = member.patrolArea.tiles;
console.log(`Patrol area has ${tiles.length} tiles`);
// Set patrol tiles
member.patrolArea.tiles = [
{ x: 32, y: 32 },
{ x: 33, y: 32 },
{ x: 34, y: 32 }
];
Fetching all patrol area tiles can degrade performance for large areas.
clear()
Clears all tiles from the patrol area.
member.patrolArea.clear();
add()
Adds coordinates or a map range to the patrol area.
coords
CoordsXY[] | MapRange
required
Array of coordinates or a map range to add.
// Add individual tiles
member.patrolArea.add([
{ x: 32, y: 32 },
{ x: 33, y: 32 }
]);
// Add a rectangular range
member.patrolArea.add({
leftTop: { x: 10, y: 10 },
rightBottom: { x: 20, y: 20 }
});
remove()
Removes coordinates or a map range from the patrol area.
coords
CoordsXY[] | MapRange
required
Array of coordinates or a map range to remove.
member.patrolArea.remove([
{ x: 32, y: 32 }
]);
member.patrolArea.remove({
leftTop: { x: 10, y: 10 },
rightBottom: { x: 15, y: 15 }
});
contains()
Checks whether a coordinate is within the patrol area.
if (member.patrolArea.contains({ x: 32, y: 32 })) {
console.log('Tile is in patrol area');
}
Handyman
Handymen clean and maintain the park.
The number of lawns mown by the handyman.console.log(`Lawns mown: ${handyman.lawnsMown}`);
The number of gardens watered by the handyman.console.log(`Gardens watered: ${handyman.gardensWatered}`);
The number of litter swept by the handyman.console.log(`Litter swept: ${handyman.litterSwept}`);
The number of bins emptied by the handyman.console.log(`Bins emptied: ${handyman.binsEmptied}`);
Mechanic
Mechanics inspect and fix rides.
The number of rides fixed by the mechanic.console.log(`Rides fixed: ${mechanic.ridesFixed}`);
The number of inspections performed by the mechanic.console.log(`Inspections: ${mechanic.ridesInspected}`);
Security Guard
Security guards stop vandals.
The number of vandals stopped by the security guard.console.log(`Vandals stopped: ${security.vandalsStopped}`);
Animations
The animations available to this staff member.
The animation the staff member is currently exhibiting.
Animations include: “walking”, “watchRide”, “wave”, “staffMower”, “staffSweep”, “staffAnswerCall”, “staffCheckBoard”, “staffFix”, “staffWatering”, “staffEmptyBin”, etc.
The frame offset in the current animation.
The total number of frames in the current animation.
getAnimationSpriteIds()
Gets sprite IDs for a staff animation.
The animation to get sprites for.
const sprites = member.getAnimationSpriteIds('staffSweep', 0);
getCostumeStrings()
Returns an array of costume strings with inline sprites.
const costumes = member.getCostumeStrings();
console.log('Costumes:', costumes);
Usage Examples
Hire Staff
// Hire a handyman
context.executeAction('staffhire', {
autoPosition: true,
staffType: 0, // Handyman
costumeIndex: 0,
staffOrders: 15 // All tasks enabled
}, (result) => {
if (result.error === 0) {
const staffId = result.peep;
const staff = map.getEntity(staffId);
console.log(`Hired ${staff.name}`);
}
});
// Hire a mechanic
context.executeAction('staffhire', {
autoPosition: true,
staffType: 1, // Mechanic
costumeIndex: 0,
staffOrders: 3 // Inspect and fix
});
function staffPerformanceReport() {
const staff = map.getAllEntities('staff');
console.log('=== Staff Performance ===');
staff.forEach(member => {
console.log(`\n${member.name} (${member.staffType})`);
if (member.staffType === 'handyman') {
console.log(` Lawns mown: ${member.lawnsMown}`);
console.log(` Gardens watered: ${member.gardensWatered}`);
console.log(` Litter swept: ${member.litterSwept}`);
console.log(` Bins emptied: ${member.binsEmptied}`);
} else if (member.staffType === 'mechanic') {
console.log(` Rides fixed: ${member.ridesFixed}`);
console.log(` Inspections: ${member.ridesInspected}`);
} else if (member.staffType === 'security') {
console.log(` Vandals stopped: ${member.vandalsStopped}`);
}
});
}
Set Patrol Areas
function setPatrolArea(staff, area) {
staff.patrolArea.clear();
staff.patrolArea.add(area);
console.log(`Set patrol area for ${staff.name}`);
}
// Set rectangular patrol area
const handyman = map.getAllEntities('staff')
.find(s => s.staffType === 'handyman');
if (handyman) {
setPatrolArea(handyman, {
leftTop: { x: 10, y: 10 },
rightBottom: { x: 30, y: 30 }
});
}
Fire Inefficient Staff
function fireInefficientStaff() {
const staff = map.getAllEntities('staff');
staff.forEach(member => {
let shouldFire = false;
if (member.staffType === 'handyman') {
const total = member.lawnsMown + member.gardensWatered +
member.litterSwept + member.binsEmptied;
if (total < 10) shouldFire = true;
} else if (member.staffType === 'mechanic') {
if (member.ridesFixed + member.ridesInspected < 5) {
shouldFire = true;
}
}
if (shouldFire) {
console.log(`Firing ${member.name} for poor performance`);
context.executeAction('stafffire', { id: member.id });
}
});
}
function changeUniformColors() {
const staff = map.getAllEntities('staff');
staff.forEach(member => {
if (member.staffType === 'handyman') {
member.colour = 2; // Green
} else if (member.staffType === 'mechanic') {
member.colour = 10; // Blue
} else if (member.staffType === 'security') {
member.colour = 0; // Black
}
});
}
Auto-Assign Patrol Areas
function autoAssignPatrolAreas() {
const handymen = map.getAllEntities('staff')
.filter(s => s.staffType === 'handyman');
const mapSize = map.size;
const sections = handymen.length;
const sectionWidth = Math.floor(mapSize.x / sections);
handymen.forEach((handyman, index) => {
const startX = index * sectionWidth;
const endX = (index + 1) * sectionWidth - 1;
handyman.patrolArea.clear();
handyman.patrolArea.add({
leftTop: { x: startX, y: 0 },
rightBottom: { x: endX, y: mapSize.y - 1 }
});
console.log(`${handyman.name} assigned section ${index + 1}`);
});
}