Developer Store
Support
Member Forums

Screenshots
FAQ
Documentation
License
Known Issues
Downloads

MMOWorkshop BACK!

PyTorque
TGB Web Browser


DarkBaneStudios

hallsofvalhalla - Been A while
xapken - Wizards and Champions
J.C. Smith - The Repopulation - 0.5.2 Build Notes
EmpireGames - Elementals in Rise of Heroes
Empire Games - WarPath.
jaidurn - Warcall 0.0.1.0 build notes
medafor - Final detailing of models
Thamior - Presence system GONE! [May 25th 2009)]
... MORE BLOGS!

Building a MMO
Wow I had no idea....
Quest Remnants of Chaos
Checking to see if anyone is sti...
Well here I am again :)
T3D and MMOKit
afx 2.0
Terrain specularity [video]
Torque T3D MMO Kit
[3dFoin] Dragon Bug

Vendor Creation

For this example we are going to create a new Feather vendor, create some new feather items, and assign the vendor dialog to Guard Andarry in Zone One.

STEP ONE: Creating a New Vendor Type

1. Load the Torque MMO Kit IDE. Create a new file and save it as: ~\test.game\genesis\vendor\feathervendor.py. At the top of the document add the following text and save:

from genesis.dbdict import DBVendorProto,DBItemProto,DBDict
from mud.world.defines import *

Setup the vendor prototype:

vendor = DBVendorProto(name="Feather Vendor")

Now, assign the parameters in an item's ItemProto that will note the item belongs in the Feather Vendor's item list.

for ip in DBDict.registry['ItemProto']:
    if 'FEATHER' in ip.itemType and 'COMMON' in ip.itemType:
        vendor.addItem(ip.name)

Save the file.

If you have already completed Spells: Adding Spell Scrolls to Vendors you can proceed to step 4.

2. Create a new file and save it as ~\test.game\genesis\vendor\vendormain.py and add the following text and save:

import feathervendor


3. Open ~\my.mmorpg\genesis\main.py and add the following text and save:

import vendor.vendormain


4. Open ~\test.game\genesis\vendor\vendormain.py, add the following text and save:

You can skip this step if you did steps 2 and 3 above.

import feathervendor


5. Save the file. Select World -> Compile World and verify that there are no errors in the message window.

STEP TWO: Creating Vendor Specific Items

As set up in the previous step, all items with 'COMMON' and 'FEATHER' in their itemType will automatically be added to Feather Vendors. Let's create a few feathers.

1. Create a new python file and save it as: ~\test.game\genesis\item\feathers.py. To the top of the document add the following text and save:

from genesis.dbdict import *
from mud.world.defines import *


2. Open ~\test.game\genesis\item\itemmain.py and add the following text and save:

import feathers


3. Return to the feathers.py file and we'll create some new items.

First, create a new item prototype:

item = DBItemProto()

Give the item a name, description, and an icon:

item.name = "Small Feather"
item.bitmap = "STUFF/48"
item.desc = "A feather from a bird."

***********add feather image to test.game***********

Now, we'll define the vendor information by inserting the correct itemType tags and we'll give it a cost for players to purchase this item:

item.itemType = ['COMMON','FEATHER']
item.worthCopper = 1

Finally, we'll clone this item and make a few more, changing only the parameters that should be different:

item = item.clone()
item.name = "Medium Feather"
item.worthCopper = 5

item = item.clone()
item.name = "Large Feather"
item.worthCopper = 10


4. Save the file. Select World -> Compile World and verify that there are no errors in the message window.

STEP THREE: Adding Vendor Dialog to NPC

Our last step is to assign Guard Andarry as a Feather Vendor.

1. Open ~\test.game\genesis\zone\zoneone\spawns.py and locate Guard Andarry's spawn information. Add the following line:

spawn.vendor = "Feather Vendor"

Note: if he already has an assigned vendor parameter, remove it and replace with the above text.

2. Save the file. Select World -> Compile World and verify that there are no errors in the message window.

3. Select World -> Edit Zone and select zoneone. Double-click Guardy Andarry to interact with him, you'll see that he has 2 tabs, make sure to select his vendor tab. You should now be able to purchase feathers from him.




Return to Tutorials