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.

  1. 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.
  2. 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.
  3. GPDL Function Trigger

  4. 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.
  5. When it becomes active, click the "GPDL Script" button to open the Script Editor.
  6. Script Trigger

  7. 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".
  8. The script used for this Event Trigger is as follows:
    $IF ($GET_PARTY_HOURS() ==# 12)
    {
      $RETURN "1";
    };
    
  9. 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.
  10. Text Statement Event

  11. Use the Normal Chain under the Shop event to place a Text Statement event. The Event Trigger should be set to "Always"
  12. In the event, check the "Backup party one step" to represent the party being chased out of a closed deli.
Some ideas to consider:

Back to Design Tutorials

Back to Designer's Guide Index