Developer Store
Support
Member Forums

Screenshots
FAQ
Documentation
License
Known Issues
Downloads

MMOWorkshop.com Store Opened!
Torque MMO Kit - Open Sourced!
Torque MMO Kit - 1.5.2 Port Alpha Test
Torque MMO Kit - OSX Status

GarageGames.com irc.prairiegames.com
#mmoworkshop

PyTorque
TGB Web Browser


Boaal

mpratt - MMO Game
xapken - nice
foodstamp - Another Day Another Step Accomplished
hallsofvalhalla - After a long epiphany
Leathel - FoHO pre-Alpha 2.42
OldRod - More Musings on the MMO Industry
J.C. Smith - 0.0.4.1 Build Notes
Wolf Dreamer - Pointless blog of pointless things
... MORE BLOGS!

ZoneLink
cant compile world
UPDATE: renamed to server errors
The Repopulation (J.C-Xerves)
Floating Text..
ITEM VARIANTS ERADICATED... (for...
AFX Projectile Bug
Tips/Warnings on Organizing UI A...
Wont receive passwords
Mega Terrain Functionality?

Quest Deletion After Completion

///////
Nov 17, 2008: Note - this page is outdated. As of this date, this function can be performed by using the "choice.hideOnMaxBump = True" command.
eg:
choice.maxTimes = 1
choice.maxBump = True
choice.hideOnMaxBump = True

///////

This tutorial will talk you through how to add a flag for if a quest gets removed from dialog after completion

First change is the following, which you may have already changed,

Dialog.py

In the very beginning, after the line:

import traceback

add:

from collections import defaultdict

It should read:

from sqlobject import *
from mud.common.persistent import Persistent

import item
from defines import *
from core import *
import traceback
from collections import defaultdict

In class "DialogAction?", after the full definition def checkGiveItems(self,player), add:

    def checkHideOnMaxTimes(self, player, choice):
            # Only process if this dialog actually hides on max times and the choice has a mamimum number of times it can be taken.
            if not choice.hideOnMaxTimes or not choice.identifier or not choice.maxTimes:
                return False
                
            charDialogChoice = None
            
            # pull in the CharacterDialogChoice data
            from character import CharacterDialogChoice
            # create a list
            dcs = list(CharacterDialogChoice.select(AND(CharacterDialogChoice.q.identifier==choice.identifier,CharacterDialogChoice.q.characterID==player.curChar.id)))
            try:
                # extract the choice data
                charDialogChoice = dcs[0]
                # Has the player selected the choice for maxTimes?
                if charDialogChoice.count >= choice.maxTimes:
                    return True
            except:
                pass
            return False

In Class "DialogChoice?", after:

    identifier = StringCol(default="")
    maxTimes = IntCol(default=0)
    maxBump = BoolCol(default=False)

add:

    #Used with maxTimes. If hideOnMaxTimes is true and maxTimes has been reached, then the dialog choice affected by maxTimes will not be displayed to the player.
    hideOnMaxTimes = BoolCol(default=False)

Entirety Should read:

    identifier = StringCol(default="")
    maxTimes = IntCol(default=0)
    maxBump = BoolCol(default=False)

    #Used with maxTimes. If hideOnMaxTimes is true and maxTimes has been reached, then the dialog choice affected by maxBump will not be displayed to the player.
    hideOnMaxTimes = BoolCol(default=False)

Then, in def handleLine(self,pane,player,newline)

add " or a.checkHideOnMaxTimes(player,choice)" to then end of both lines:

                        if not a.checkCheckItems(player,True) or not a.checkTakeItems(player,True) or not a.checkCheckSkills(player,True):

Entirety should read:

    def handleLine(self,pane,player,newline):
        from mob import Mob
        interacting = player.interacting #snapshot, it may go away
        
        dialogTrigger = not isinstance(interacting,Mob)
        
        end = False
        for a in newline.actions:
            if a.attack or a.endInteraction or a.despawn:
                end = True
            end |= a.do(player)
        
        if not end:
            self.curChoices = []
            choices = []
            player.curDialogLine = newline
            for c in newline.choices:
                add = True
                if c.successLine and not dialogTrigger:
                    for a in c.successLine.actions:
                        if not a.checkCheckItems(player,True) or not a.checkTakeItems(player,True) or not a.checkCheckSkills(player,True):
                            add = False
                            break
                if add:
                    self.curChoices.append(c)
                    choices.append(c.text)
            if not len(choices):
                #wrap around
                player.curDialogLine = self.greeting
                for choice in self.greeting.choices:
                    add = True
                    if choice.successLine and not dialogTrigger:
                        for a in choice.successLine.actions:
                            if not a.checkCheckItems(player,True) or not a.checkTakeItems(player,True) or not a.checkCheckSkills(player,True) or a.checkHideOnMaxTimes(player,choice):
                                add = False
                                break
                    if add:
                        self.curChoices.append(choice)
                        choices.append(choice.text)

Finally, in def setLine(self,player,line,name): add " or a.checkHideOnMaxTimes(player,choice)" to the end of the line:

if not a.checkCheckItems(player,True) or not a.checkTakeItems(player,True) or not a.checkCheckSkills(player,True):

Entirety should read:

    def setLine(self,player,line,name):
        player.curDialogLine = line
        
        #todo, format choices, and text
        dialog = line.dialog
        dialog.curChoices =[]
        choices = []
        for choice in line.choices:
            add = True
            if choice.successLine:
                for a in choice.successLine.actions:
                    if not a.checkCheckItems(player,True) or not a.checkTakeItems(player,True) or not a.checkCheckSkills(player,True) or a.checkHideOnMaxTimes(player,choice):
                        add = False
                        break
            if add:
                dialog.curChoices.append(choice)
                choices.append(choice.text)
                
        if len(choices):
            player.dialog = dialog
            player.mind.callRemote("setInitialInteraction",line.text,choices,line.journalEntryID,name)
        else:
            player.mind.callRemote("setInitialInteraction",None,None)

To implement in game, add the following in a choice: (in quests.py for example)

choice.identifier = "Whatever Name"
choice.maxTimes = 1
choice.maxBump = True
choice.hideOnMaxTimes = True

The key here is "choice.hideOnMaxTimes = True" this simply tells it, that if true (default is false) then don't display the associated choice when maxTimes is hit.

Hopefully that helps someone out there, I know it helped us!