Tutorial:Creating Dungeon Shops

From PMDOWiki
(Redirected from Creating Dungeon Shops)

A guide on how to create shops in dungeons.

Initializing Shop Generation

Shops may be created by adding a Zone Step to a segment. Open the segment you want to add shops to in the editor. Then, add a "Spread Step Range Zone Step" to your zone steps, setting the priority field to (4.2).

Here, each item in the spawn section can be defined as a shop. You can create different shops with different sets of items using this. Let's start by adding our first shop.

Selecting add, select a Type of Shop Step <>. (tip: you can type the name of what you want to find to jump to it in the list - in this case, just type s and scroll down a little bit to find the step)

Press OK to save. This will now be the shop that will spawn - make sure to give it a Start and End value that covers the floors you want it to spawn on.

Quota

You can define how often any shops defined in this step will spawn - see the Using SpreadPlans page for details.

Adding Items

From the item section, you can add any single item in the game to spawn in the shop, and give it whatever price you would like. You can also adjust the weight, which influences the base percent chance an item has of spawning.

Themes

Here, you may add item themes for the shop to possibly roll.

No Theme

If you would not like an item theme, we still need to define a base theme for the shop items to spawn. Selecting add, change the type to "Item Theme None". Set the Special Ratio to 100, and select what amount range of items you want to spawn in the shop.

Shopkeeper

We need to set what mon will be the shopkeeper of the shop. Find "Start Mob" and press edit. This will open up a tab that allows us to define our shopkeeper.

There are some values here we should set a certain way.

Tactic

Tactic should be set to "shopkeeper", so the mob spawned uses the shop keeper AI.

Spawn Features

All of these default values are added by pressing add under the "Spawn Features" tab.

Discriminator ID

With type Descriminator, this is an ID that determines the personality value of the shop keeper. We can just set this value to 0.

Interactions

We would like the shopkeeper dialogue to appear when we interact with the shopkeeper. Adding an entry of type Interactions, we will add a script that will allow this interaction toCheck Events.

Select an entry of type Battle Script Event. Now, we want to tell the game what script to use while interacting - PMDO has several scripts pre-defined for us, and the shop script is one of them. The name of the script we want to type into the Script tab is:

ShopkeeperInteract

This script takes no arguments, so just type {} into "Arg Table.

Role Definition

We can explicitly define the shopkeeper as a shopkeeper. Selecting a type of "Lua Scripting", add the following into the Lua Table tab:

{ Role = "Shopkeeper" }

Guards

The Mobs tab contains the mons that will spawn and pursue the player if they steal from the shop. They will generally use the "shopkeeper" tactic, just like the Shopkeeper. They can be defined similarly to other mons in the editor.

Filters

We can define what rooms a shop can spawn in.

Default Filters

Generally there are two rooms we don't want the shop to spawn in: "Immutable" and "NoEvent" rooms.

To blacklist these rooms, add an entry with type "Room Filter Component". Tick the "Negate" box to tell the game that we don't want shop spawns in these rooms.

Then, we add two components: "Immutable Room" and "NoEvent".

Now the shop will not spawn in these rooms. Press OK to save.

Security Status

We want the game to be able to tell when something has been stolen, so it knows to spawn the guards. Under the Security Status tab, add the default shop_security.