Intermediate Tutorial: Special Shops via GPDL Function Trigger
The purpose of this tutorial is to show how the use of the GPDL Function Trigger can create "special shops" that are only open at very specific times of the day. For my example, I will create a Deli for the party to visit and buy lunch.
- In the Item Editor, create a new item called "Lunch". It should be a nonweapon item and priced at what you think a lunch should cost in your design. If you are unfamiliar with the Item Editor, see the Basic Tutorial: Adding an Item.
- Place a Shop event that sells the new item and only the new item. In my design, delis do not identify spells or appraise gems, so those options are disabled. If you do not know how to place a Shop event, see the Basic Tutorial: Placing a Shop Event.
- Once the event is placed, from the Event Trigger menu, select "Execute GPDL Function". Set the Chain Trigger to "If Event does not happen", which will be explained below.
- When it becomes active, click the "GPDL Script" button to open the Script Editor.
- The scripts for Event Triggers are special compared to other scripts in that they must return a "0" (false) or "1" (true). In this script, 12 equals noon. Remember that Dungeon Craft uses a 24 hour clock, so if we wanted the store to be open at 6 pm, say for dinner instead of lunch, we would use "18".
- The script used for this Event Trigger is as follows:
$IF ($GET_PARTY_HOURS() ==# 12) { $RETURN "1"; };
- When the Deli is not open, we want the player to know why it is unavailable. This is when we utilize the setting of the Chain Trigger placed above.
- Use the Normal Chain under the Shop event to place a Text Statement event. The Event Trigger should be set to "Always"
- In the event, check the "Backup party one step" to represent the party being chased out of a closed deli.
GPDL Function Trigger
Script Trigger
Text Statement Event
- Through modifying your script with another "$IF" statement or through use of a logical OR "||", you could easily have your deli open for dinner, too.
- You could have different shops in the same location that represent the same shop selling different things when it's open - the deli could sell "Lunch" at noon and "Dinner" at six pm
- This trigger could easily be adapted for special meetings the party must attend at a specific time
- Use with a Training Hall event and a time set to late at night could represent the local Thieve's Guild