Creating Interactive objects
Any .dts (3d model) shape with collision can be set up to 'interact' with. Examples of objects used in game include: boats, doors, rocks, obelisks, altars. The interaction can transport players, spawn monsters, give/take/check items, play sound effects, etc.
Unlike quest dialog, interactive object dialog requires fail lines because a player will see all available choices even if they do not have the items they need or meet the necessary requirements.
Let's add a campfire to one of our zones that will transport us to another zone. For the sake of this tutorial we'll use Zone One and Zone Two that we created in the New Zone Tutorial.
Step One: Finding Transport Location
1. Load the Torque MMO Kit IDE and select World -> Edit Zone and load zoneone.
2. Position the player, including rotation, where you want them to zone in. Hit Alt-C to enter Camera View. Select your character with your mouse. On the right hand side of the screen click on the "Expand All" button. Under transform note the 3 position numbers and the 4 rotation numbers, write these numbers down. Yours will be different but should look something like this: position 12.3657 -180.694 93.2139 rotation 0 0 -1 12.1827
3. /camp out of the game.
Step Two: Writing the Dialog
Writing dialog for interactive objects is the same as quest dialog.
1. Inside of the Torque MMO Kit IDE open ~\test.game\genesis\zone\zonetwo\quests.py
2. We are going to assign 2 possible actions for this dialog. The first action teleports the player to the location noted in the step above (your numbers will be different than mine and don't forget to round your numbers up), plays a sound effect, and takes some money from the player. The second action closes the dialog window.
action = DBDialogAction() action.teleportZone="zoneone" action.teleportTransform="12.4 -180.7 93.3 0 0 -1 12.2" action.playSound = "sfx/Magic_Appear01.ogg" action.takeGold = 5 action2 = DBDialogAction() action2.endInteraction = True
3. Now let's create the choices that lead to the above actions. Add the following text beneath the actions above:
choice = DBDialogChoice(text = "Yes.") choice.successLine = DBDialogLine(text = "") choice.successLine.addAction(action) choice.failLine = DBDialogLine(text = "You do not have enough money.") choice.failLine.addAction(action2) choice2 = DBDialogChoice(text = "No thanks.") choice2.successLine = DBDialogLine(text = "") choice2.successLine.addAction(action2)
Note: By selecting 'Yes' the player is either transported or if they do not have enough money, they receive a different message and action2 is carried out.
4. Finally, we'll assign these actions to a dialog. After the above choices, add the following text and save:
dialog = DBDialog() dialog.title = "Magical Fire of Transport" dialog.name = "Magical Fire" dialog.greeting = DBDialogLine(text = """If you rub these rocks and drop a few gold pieces in, you'll be safely transported. Do you wish to do so?\\n""") dialog.greeting.addChoice(choice) dialog.greeting.addChoice(choice2)
Note in the dialog text that the title and name of the dialog is different. We'll be using the title of the dialog in the next step.
5. Save the file, select World -> Compile World and verify that there are no errors in the message window.
Step Three: Adding Dialog to .dts Shape
1. From inside the Torque MMO Kit IDE select World -> Edit Zone and load zonetwo.
2. Find a good location to place your campfire. Hit F4 to enter World Editor Creator mode. The model can be found here: StaticShapes\test.game\data\shapes\campfires and select 'campfire'. Use the gizmo to place the campfire on the ground properly.
3. Now we'll add the dialog to the campfire. Select the campfire in the Mission Group. Hit F3 to enter the World Editor Inspector. Click on the Expand All button and look for the Heading called 'RPG'. Where it says dialogTrigger enter the dialog.name from above and hit the Apply button.
The campfire should now be glowing green. You can adjust the distance at which the campfire glows by changing the dialogRange number.
4. Save your mission file and /camp out to the main menu.
5. Login to the Single Player version and load 'editworld'. Double-click the campfire to interact with it and you should be teleported to Zone One. (Note: You'll notice that the dialog.title set up above is used in the dialog window.)
If you do not have enough money, type /imm gimme MONEY and hit the <enter> key, and then retry.
Return to Tutorials

