๐ŸŽข Episode 5 ยท Improver ยท Guests

Help the Guests
Episode 5: Working with Guests

Guests are entities with a position, a mood and a mind of their own. You will find guests who need help and change what happens to them.

๐Ÿ‘ถ Ages 10+ โฑ๏ธ ~50 mins ๐ŸŽข OpenRCT2 โœ“ Free workshop
๐Ÿ‘€ Find guests ๐Ÿ“ Positions โค๏ธ Mood ๐Ÿ›Ÿ Change behaviour
โญ
0 XP
Level 1
๐Ÿ”ฅ0
Your Progress 0 / 5 steps
Build it in our OpenRCT2 Studio too: set up a park plugin, wire up events, read the park and export real plugin files in the browser, with no install. Open the OpenRCT2 Mod Studio →
๐Ÿ”ฅ
Ember says: a guest is just an object with properties like x, y and happiness. Learn to find the ones you care about, and the rest is action.
1
๐Ÿ‘€
Find the Right Guest
Loop and filter
Active
๐ŸŽฏ
Goal for this step

Loop over guests and pick out the unhappy ones.

  • 1Get all guests with map.getAllEntities("guest").
  • 2Each guest has a happiness value.
  • 3Collect the ones below a threshold into a shortlist.
var guests = map.getAllEntities("guest");
var sad = guests.filter(function (g) { return g.happiness < 100; });
โœ๏ธ
Fill in the Blanks
+15 XP
We use filter to keep only the guests who are .
๐Ÿง 
Knowledge Check
+15 XP
What does the filter here do?
ARemoves all guests
BKeeps only the guests matching the test
CAdds new guests
2
๐Ÿ“
Where Is a Guest?
x, y and z
Locked
๐ŸŽฏ
Goal for this step

Read a guest position.

  • 1Every entity has x, y and z coordinates.
  • 2z is the height above the ground.
  • 3These let you spot guests in odd places, like the water.
โœ๏ธ
Fill in the Blanks
+15 XP
A guest position has x, y and coordinates.
๐Ÿง 
Knowledge Check
+15 XP
Which coordinate is the height above the ground?
Ax
By
Cz
3
๐Ÿ›Ÿ
Act on a Guest
Change what happens
Locked
๐ŸŽฏ
Goal for this step

Teleport a guest to safety.

  • 1You can set a guest position with the entity API.
  • 2Move the guest to the nearest path tile.
  • 3Post a message so the player knows you helped.
g.setCoordinates(safeX, safeY, safeZ);
park.postMessage("Rescued a soggy guest!");
โœ๏ธ
Fill in the Blanks
+15 XP
We set a guest position with set.
๐Ÿง 
Knowledge Check
+15 XP
What is a friendly way to use powers over guests?
AHelp guests in trouble
BScare everyone away
CDelete the park
4
โค๏ธ
Track the Mood
Are guests happy?
Locked
๐ŸŽฏ
Goal for this step

Report how many guests are unhappy.

  • 1Count the unhappy guests from your shortlist.
  • 2If the number is high, tell the player what might help.
  • 3Keep the advice kind and specific.
โœ๏ธ
Fill in the Blanks
+15 XP
A good tip is , not just "make it better".
๐Ÿง 
Knowledge Check
+15 XP
Your plugin sees 20 unhappy guests. Best message?
A"Everyone is unhappy!"
B"20 guests want a bench and a drink nearby."
CSilence
5
๐Ÿงช
Test a Rescue
Make it happen safely
Locked
๐ŸŽฏ
Goal for this step

Set up a guest near water and watch your rescue work.

  • 1Load a park with a lake.
  • 2Cheat a guest into the water using the developer tools.
  • 3Watch your plugin find them and move them out.
๐Ÿง 
Knowledge Check
+15 XP
Why cheat one guest into the water while testing?
ATo avoid ruining a real park
BTo make the game harder
CIt is required by law
๐ŸŽ‰โœจ๐Ÿ†๐ŸŽ‰
Guest Guardian!
Your plugin can find guests and help them. Next you build the full Swim Rescue tool.
0
Total XP
1
Level
0
Best Streak
0%
Accuracy
Next: Episode 6: Build Swim Rescue โ†’