#!QUESTMAKER_START_SCRIPT Normal Mystery #2
#A 2-Level mystery where players must question existing mobs from your world to
#discover WHO did something, and what their MOTIVE was.
#The witnesses are existing mobs and the suspects are CREATED by you.
#
#!QUESTMAKER_PAGE Quest Name/Criteria
#Enter the unique name and player criteria for your new quest.
#
#Quest ID:
#Enter a unique name/id for your quest:
#$QUEST_ID=$UNIQUE_QUEST_NAME=normal_mystery_2
#
#Quest Name:
#Enter a friendly displayable name for your quest:
#$QUEST_NAME=$STRING=Normal Mystery #2
#
#Quest-Player Criterium:
#You may leave this entry blank, or enter a Zapper Mask to describe what
#kinds of players may participate in this quest. You can use this to set
#race, level, or other requirements.
#$QUEST_CRITERIA=$ZAPPERMASK
#
#!QUESTMAKER_PAGE Specify the Announcer
#The Announcer is the mob who will be announcing the quest initially. This must
#be an existing mob in your world. They will announce the quest to players
#once, and then mark whether the player says they accept the quest.
#
#Announcer Area/Room:
#Specify below the name of the area that your Announcer mob will be located
#in and/or the room in which the mob can be found. You may leave both blank
#to force the quest manager to find the mob somewhere in the world, but this
#will hurt the performance of your mud, so use with care.
#Use double-quotes around multi-word areas and room ids/names.
#
#Announcer Area:
#$ANNOUNCER_AREA=($AREA)
#Announcer Room ID:
#$ANNOUNCER_ROOM=($ROOMID)
#
#Announcer mob name:
#Specify the name of the mob who will act as the Announcer mob.
#Use double-quotes around multi-word names.
#If you specified an area or room above, then the mob must be located there.
#You may optionally have the quest manager select a 'random' mob by entering
#a mob name of ANY MASK= followed by a Zapper Mask (see help on
#ZAPPERMASKS for information on zapper mask syntax).
#Remember, if the quest manager can not find your mob, the quest will not
#be started.
#$ANNOUNCER_NAME=$NAME
#
#!QUESTMAKER_PAGE Announcer greetings/instructions
#Here's where you specify any special text said by the announcer regarding
#your quest
#
#Announcer greeting:
#Specify what the announcer says to people when they enter the room about their
#quest. Use the code ${2 *} to designate the name of the mob to find.
#$QUEST_NOTIFYSTRING=$LONG_STRING=I need someone to find ${2 *} somewhere.
#
#Announcer instructions:
#Specify what the announcer says to people who have accepted the quest. This
#should give some details about what is to be done. You can leave this blank
#if you like. Use the code ${2 *} to designate the name of the mob to find.
#$QUEST_INSTRUCTIONSSTRING=($LONG_STRING)=Find ${2 *} at that one place. Be careful!
#
#!QUESTMAKER_PAGE Specify the Destination Players
#Specify below the name of the area that your witnesses and suspects will be located.
#Use double-quotes around multi-word areas and room ids/names.
#
#Destination Area:
#$DESTINATION_AREA=($AREA)
#
#Witness Mobs:
#Specify the types of mobs that will give clues regarding the mystery.
#See help on ZAPPERMASK for information on zapper mask syntax.
#$WITNESS_MASK=$ZAPPERMASK
#
#The Suspects are the mobs that comprise the list of possible mobs who did the action
#for the motive. One of the suspects will be chosen as the WHO did it mob.
#The Suspects: List here all possible suspects for your mystery. You may create more
#than are actually used in the mystery to mix things up.
#$SUSPECTS_MOBS=$MOBXML_ONEORMORE
#
#Number of Suspects: Specify how many of the above suspects will be chosen for use in the mystery.
#The higher this number, the more complex the mystery will be and more difficult to solve.
#You should never enter a number that might be larger than the number of total mobs above.
#You may, however, use math expressions: For instance, 1 + 1?3 would generate a number of 2-4 mobs.
#$NUM_SUSPECTS=$EXPRESSION=3
#
#!QUESTMAKER_PAGE The Motives
#The motives are a simple list of space-delimited phrases that describe the possible motives for
#the action done by the suspect.
#
#The Motive List: List here the possible motives for the action taken. Each motive should be
#separated by spaces. If a motive includes more than one word, put the motive in "double quotes".
#A valid motive should answer the question: The act was done because of X.
#$MOTIVE_LIST=$LONG_STRING="drunken anger" "jealous love" "insulted honor"
#
#Number of Motives: Specify how many of the above motives will be chosen for use in the mystery.
#The higher this number, the more complex the mystery will be and more difficult to solve.
#You should never enter a number that might be larger than the number of total motives listed above.
#You may, however, use math expressions: For instance, 1 + 1?3 would generate a number of 2-4 motives.
#$NUM_MOTIVES=$EXPRESSION=3
#
#!QUESTMAKER_PAGE Quest Completion
#Select some rewards for completing the mystery:
#
#Announcer congratulations:
#This is what the congratulations says.
#$SOLVED_RESPONSE_TEXT=($LONG_STRING)=$n has solved the mystery! $AGENT did it for $MOTIVE!
#
#Reward items:
#Specify zero or more items to choose from as a reward
#$REWARD_ITEMS=$ITEMXML_ZEROORMORE
#
#Quest Point?
#$QUEST_POINT=$CHOOSE=YES,NO
#Amount of money (an amount, or leave blank):
#$GOLD=($EXPRESSION)
#Amount of experience points, blank for none, or a number% for percent of exp to next level:
#$EXP=($STRING)=10%
#
#Player Faction to give to or take from:
#$FACTION=($FACTION)
#If you selected a faction above, enter a new numeric amount,
#or enter +value to add, or --value to subtract:
#$NUMFACTION=($STRING)
#
#Select whether a player may complete this quest multiple times,
#or 'prev' to require a previous quest, if multiple found.
#$MULTIPLE=$CHOOSE=YES,NO,PREV
#
#!QUESTMAKER_END_SCRIPT Normal Mystery #2
set name $QUEST_ID
set display $QUEST_NAME
set author $#AUTHOR
set wait 1
set interval 1
quiet
set area $ANNOUNCER_AREA
set room $ANNOUNCER_ROOM
set mobgroup
set mob reselect $ANNOUNCER_NAME
give stat keyplayer true
give script LOAD=$QUEST_ID_announcer.script
# Set a motives, will automatically set a motive
set motivegroup $NUM_MOTIVES $MOTIVE_LIST
set mob
set area $DESTINATION_AREA
set roomgroup ALL
import mobs $QUEST_ID_suspects.cmare
load mobgroup $NUM_SUSPECTS any
set agentgroup $NUM_SUSPECTS
set duration 0
<?xml version="1.0"?>
<FILE><NAME>$QUEST_ID_rewarditems.xml</NAME><DATA><ITEMS>$REWARD_ITEMS</ITEMS></DATA></FILE>
<FILE><NAME>$QUEST_ID_suspects.cmare</NAME><DATA><MOBS>$SUSPECTS_MOBS</MOBS></DATA></FILE>
<FILE><NAME>$QUEST_ID_announcer.script</NAME>
<DATA>
ONCE_PROG 100
if EVAL('$QUEST_ANNOUNCECHANNEL' != '')
$QUEST_ANNOUNCECHANNEL $QUEST_NOTIFYSTRING -- Come see me for more information.
endif
~
GREET_PROG 100
if ISLIKE($n '$QUEST_CRITERIA') and ISPC($n) and ( EVAL('$MULTIPLE' != 'PREV') or QUESTWINNER($n previous) ) and !QUESTSCRIPTED($n *)
if EVAL('$MULTIPLE' == 'YES') OR !QUESTWINNER($n *)
sayto "$n" $QUEST_NOTIFYSTRING -- just say '^yi accept^?' or '^yi accept $QUEST_NAME^?' to take on this quest.
endif
endif
~
SPEECH_PROG p i accept $QUEST_NAME
if ISLIKE($n '$QUEST_CRITERIA') and ISPC($n) and ( EVAL('$MULTIPLE' != 'PREV') or QUESTWINNER($n previous) ) and !QUESTSCRIPTED($n *)
if EVAL('$MULTIPLE' == 'YES') OR !QUESTWINNER($n *)
mpqset * STATISTICS ACCEPTED
sayto "$n" $QUEST_INSTRUCTIONSSTRING
mpscript $n INDIVIDUAL SAVABLE STATIC=LOAD=$QUEST_ID_playertrack.script
endif
endif
~
SPEECH_PROG p i accept
if ISLIKE($n '$QUEST_CRITERIA') and ISPC($n) and ( EVAL('$MULTIPLE' != 'PREV') or QUESTWINNER($n previous) ) and !QUESTSCRIPTED($n *)
if EVAL('$MULTIPLE' == 'YES') OR !QUESTWINNER($n *)
mpqset * STATISTICS ACCEPTED
sayto "$n" $QUEST_INSTRUCTIONSSTRING
mpsetvar $n $QUEST_ID_AGENT ''
mpsetvar $n $QUEST_ID_MOTIVE ''
mpscript $n INDIVIDUAL SAVABLE STATIC=LOAD=$QUEST_ID_playertrack.script
endif
endif
~
SPEECH_PROG all
if STRCONTAINS($g "i accept") OR STRCONTAINS($g "solve") OR EVAL($g == '')
RETURN
endif
if ISLIKE($n '$QUEST_CRITERIA') and ISPC($n) and ( EVAL('$MULTIPLE' != 'PREV') or QUESTWINNER($n previous) ) and QUESTSCRIPTED($n *)
if EVAL('$MULTIPLE' == 'YES') OR !QUESTWINNER($n *)
MPARGSET $9 ''
IF EVAL($9 == '')
MPARGSET $3 $<$n $QUEST_ID_WAGENT>
IF STRCONTAINS($g "$3")
MPARGSET $9 $g
if VAR($n $QUEST_ID_AGENT != '')
sayto $n You've already made a guess that question.
else
MPSETVAR $n $QUEST_ID_AGENT $<$n $QUEST_ID_WAGENT>
sayto $n Ok, so you think $<$n $QUEST_ID_WAGENT>.
MPSETVAR $n $QUEST_ID_CORRECT ++
MPCALLFUNC winner
endif
ELSE
mpargset $0 '$%QVAR(* AGENTGROUP)%'
for $1 = 1 to $0
mpargset $2 'AGENTGROUP#$1'
mpargset $3 '$%QVAR(* $2)%'
IF STRCONTAINS($g "$3") AND EVAL($9 == '')
MPARGSET $9 $g
if VAR($n $QUEST_ID_AGENT != '')
sayto $n You've already made a guess that question.
else
MPSETVAR $n $QUEST_ID_AGENT '$3'
sayto $n Ok, so you think $3.
MPCALLFUNC winner
BREAK
endif
endif
next
ENDIF
ENDIF
IF EVAL($9 == '')
MPARGSET $3 '$<$n $QUEST_ID_WMOTIVE>'
IF STRCONTAINS($g "$3")
MPARGSET $9 $g
if VAR($n $QUEST_ID_MOTIVE != '')
sayto $n You've already made a guess on that question.
else
MPSETVAR $n $QUEST_ID_MOTIVE '$<$n $QUEST_ID_WMOTIVE>'
sayto $n Ok, so you think $<$n $QUEST_ID_WMOTIVE>
MPSETVAR $n $QUEST_ID_CORRECT ++
MPCALLFUNC winner
endif
ELSE
mpargset $0 '$%QVAR(* MOTIVEGROUP)%'
for $1 = 1 to $0
mpargset $2 'MOTIVEGROUP#$1'
mpargset $3 '$%QVAR(* $2)%'
IF STRCONTAINS($g "$3") AND EVAL($9 == '')
MPARGSET $9 $g
if VAR($n $QUEST_ID_MOTIVE != '')
sayto $n You've already made a guess that question.
else
MPSETVAR $n $QUEST_ID_MOTIVE '$3'
sayto $n Ok, so you think $3.
MPCALLFUNC winner
BREAK
endif
endif
next
ENDIF
ENDIF
endif
endif
~
FUNCTION_PROG winner
if ISLIKE($n '$QUEST_CRITERIA') and ISPC($n) and ( EVAL('$MULTIPLE' != 'PREV') or QUESTWINNER($n previous) )
if EVAL('$MULTIPLE' == 'YES') OR !QUESTWINNER($n *)
if VAR($n $QUEST_ID_CORRECT >= 3)
if EVAL('$EXP' != '')
mpexp $n $EXP
endif
if EVAL('$FACTION' != '')
mpfaction $n $FACTION +$NUMFACTION
endif
if EVAL('$QUEST_POINT' == 'YES') AND !QUESTWINNER($n *)
mpoload QuestPoint
give "a quest point" "$n"
endif
if EVAL('$GOLD' != '') AND EVAL('$GOLD' > 0)
mpoload $GOLD
give $GOLD "$n"
endif
mpoload fromfile $QUEST_ID_rewarditems.xml any
if EVAL('$b' != '')
give "$b" "$n"
endif
mpsetvar $i $QUEST_ID_REWARDED $n
mpquestwin $n *
sayto "$n" $SOLVED_RESPONSE_TEXT
mpendquest $n
mpqset * STATISTICS SUCCESS
IF EVAL('$MULTIPLE' == 'PREV')
mptransfer $n $n
ENDIF
else
if VAR($n $QUEST_ID_AGENT != '') AND VAR($n $QUEST_ID_MOTIVE != '')
sayto $n I'm sorry $n, your guess is incorrect. Try again in 10 minutes.
mpalarm 150 MPCALLFUNC ClearPlayerGuess
endif
endif
endif
endif
~
FUNCTION_PROG ClearPlayerGuess
MPSETVAR $n $QUEST_ID_AGENT ''
MPSETVAR $n $QUEST_ID_MOTIVE ''
~
</DATA></FILE>
<FILE><NAME>$QUEST_ID_playertrack.script</NAME>
<DATA>
ONCE_PROG 100
mpsetvar $i INSTRUCTIONS $QUEST_INSTRUCTIONSSTRING
IF !isquestmobalive(1 '$QUEST_ID')
MPENDQUEST '$QUEST_ID'
ENDIF
if EVAL('$<$i $QUEST_ID_WMOTIVE>' == '')
mpsetvar $i $QUEST_ID_WMOTIVE $%QVAR(* MOTIVEGROUP#?)%
ENDIF
if EVAL('$<$i $QUEST_ID_WAGENT>' == '')
mpsetvar $i $QUEST_ID_WAGENT $%QVAR(* AGENTGROUP#?)%
ENDIF
MPSETVAR $i $QUEST_ID_ALREADY_SPOKEN_TO ''
MPSETVAR $i $QUEST_ID_EVIDENCE_ALREADY_GIVEN ' "$<$i $QUEST_ID_WAGENT> $<$i $QUEST_ID_WMOTIVE>" '
MPSETVAR $i
~
RAND_PROG 25
IF !isquestmobalive(1 '$QUEST_ID')
MPENDQUEST '$QUEST_ID'
else
if QVAR(* REMAINING == '')
MPENDQUEST $i
else
mpsetvar $i TIME_REMAINING $%QVAR(* REMAINING)%
endif
ENDIF
~
DELAY_PROG 15 30
MPSETVAR $i $QUEST_ID_ALREADY_SPOKEN_TO
~
DELAY_PROG 150 300
MPSETVAR $i $QUEST_ID_EVIDENCE_ALREADY_GIVEN ' "$<$i $QUEST_ID_WAGENT> $<$i $QUEST_ID_WMOTIVE>" '
~
FUNCTION_PROG AskedAboutAgent
mpargset $9 ''
mpargset $3 $g
mpargset $2 $WITNESS_MASK
for $0 = 1 to '$%NUMMOBSROOM(*)%
MPARGSET $1 $%ROOMMOB($0)%
if ISNPC($1) AND ISLIKE($1 $2) AND CANHEAR($1 $i) AND EVAL($1 != '${1 *}') AND !STRCONTAINS('$<$i $QUEST_ID_ALREADY_SPOKEN_TO>' $@1)
mpargset $9 $1
BREAK
ENDIF
next
if EVAL($9 == '')
return
ENDIF
mpargset $0 '$%QVAR(* MOTIVEGROUP)%'
mpargset $6 ' '
for $1 = 1 to $0
mpargset $2 'MOTIVEGROUP#$1'
mpargset $4 '$%QVAR(* $2)%'
IF !STRCONTAINS('$<$i $QUEST_ID_EVIDENCE_ALREADY_GIVEN>' '$3 $4')
mpargset $6 "$4" $6
endif
next
If EVAL($6 == '') OR EVAL($6 == ' ')
RETURN
ENDIF
mpargset $6 $6.$%RAND0NUM($6.LENGTH#)%
mpsetvar $i $QUEST_ID_EVIDENCE_ALREADY_GIVEN $<$i $QUEST_ID_EVIDENCE_ALREADY_GIVEN> "$3 $6"
mpsetvar $i $QUEST_ID_ALREADY_SPOKEN_TO $<$i $QUEST_ID_ALREADY_SPOKEN_TO> "$@9"
switch $%RAND0NUM(12)%
case 0
mpforce '$9' sayto "$i" $3 is a dork, but $3 would not do anything for $6.
case 1
mpforce '$9' sayto "$i" $3 is not one to be involved with $6.
case 2
mpforce '$9' sayto "$i" I know $3 well enough to know $6 is not a motive.
case 3
mpforce '$9' sayto "$i" $3 thinks $6 is immoral, he wouldn't do anything for that reason.
case 4
mpforce '$9' sayto "$i" $3 never gets involved with $6.
case 5
mpforce '$9' sayto "$i" $3 isn't ever into $6.
case 6
mpforce '$9' sayto "$i" $3 hates $6, and never gets involved in it.
case 7
mpforce '$9' sayto "$i" $3 would never do anything for $6.
case 8
mpforce '$9' sayto "$i" $3 is too proud to do anything for $6.
case 9
mpforce '$9' sayto "$i" $3 doesn't know anything of $6.
case 10
mpforce '$9' sayto "$i" $3 is too dumb for $6.
case 11
mpforce '$9' sayto "$i" $6 is far too silly a motive for $3.
endswitch
~
FUNCTION_PROG AskedAboutMotive
mpargset $9 ''
mpargset $6 $g
mpargset $2 $WITNESS_MASK
for $0 = 1 to '$%NUMMOBSROOM(*)%
MPARGSET $1 $%ROOMMOB($0)%
if ISNPC($1) AND ISLIKE($1 $2) AND CANHEAR($1 $i) AND EVAL($1 != '${1 *}') AND !STRCONTAINS('$<$i $QUEST_ID_ALREADY_SPOKEN_TO>' $@1)
mpargset $9 $1
BREAK
ENDIF
next
if EVAL($9 == '')
return
ENDIF
mpargset $0 '$%QVAR(* AGENTGROUP)%'
mpargset $3 ' '
for $1 = 1 to $0
mpargset $2 'AGENTGROUP#$1'
mpargset $4 '$%QVAR(* $2)%'
IF !STRCONTAINS('$<$i $QUEST_ID_EVIDENCE_ALREADY_GIVEN>' '$4 $6')
mpargset $3 "$4" $3
endif
next
if EVAL($3 == '') OR EVAL($3 == ' ')
# Should we say something here?
RETURN
ENDIF
mpargset $3 $3.$%RAND0NUM($3.LENGTH#)%
mpsetvar $i $QUEST_ID_EVIDENCE_ALREADY_GIVEN $<$i $QUEST_ID_EVIDENCE_ALREADY_GIVEN> "$3 $6"
mpsetvar $i $QUEST_ID_ALREADY_SPOKEN_TO $<$i $QUEST_ID_ALREADY_SPOKEN_TO> "$@9"
switch $%RAND0NUM(12)%
case 0
mpforce '$9' sayto "$i" $3 is a dork, but $3 would not do anything for $6.
case 1
mpforce '$9' sayto "$i" $3 is not one to be involved with $6.
case 2
mpforce '$9' sayto "$i" I know $3 well enough to know $6 is not a motive.
case 3
mpforce '$9' sayto "$i" $3 thinks $6 is immoral, he wouldn't do anything for that reason.
case 4
mpforce '$9' sayto "$i" $3 never gets involved with $6.
case 5
mpforce '$9' sayto "$i" $3 isn't ever into $6.
case 6
mpforce '$9' sayto "$i" $3 hates $6, and never gets involved in it.
case 7
mpforce '$9' sayto "$i" $3 would never do anything for $6.
case 8
mpforce '$9' sayto "$i" $3 is too proud to do anything for $6.
case 9
mpforce '$9' sayto "$i" $3 doesn't know anything of $6.
case 10
mpforce '$9' sayto "$i" $3 is too dumb for $6.
case 11
mpforce '$9' sayto "$i" $6 is far too silly a motive for $3.
endswitch
~
SPEAK_PROG all
if EVAL($i != $n)
RETURN
endif
mpargset $2 $WITNESS_MASK
if nummobsroom('MASK=$2' == 0)
RETURN
endif
if STRCONTAINS($g "i accept") OR STRCONTAINS($g "solve") OR EVAL($g == '')
RETURN
endif
mpsetvar $i $QUEST_ID_FOUND ''
IF VAR($i $QUEST_ID_FOUND == '')
for $1 = 1 to '$%QVAR(* AGENTGROUP)%'
mpargset $2 'AGENTGROUP#$1'
mpargset $3 '$%QVAR(* $2)%'
IF STRCONTAINS($g "$3")
MPCALLFUNC AskedAboutAgent $3
mpsetvar $i $QUEST_ID_FOUND $3
BREAK
endif
next
ENDIF
IF VAR($i $QUEST_ID_FOUND == '')
for $1 = 1 to '$%QVAR(* MOTIVEGROUP)%'
mpargset $2 'MOTIVEGROUP#$1'
mpargset $6 '$%QVAR(* $2)%'
IF STRCONTAINS($g "$6")
MPCALLFUNC AskedAboutMotive $6
mpsetvar $i $QUEST_ID_FOUND $6
BREAK
endif
next
ENDIF
~
QUEST_TIME_PROG * -1
MPECHOAT $i The quest "$QUEST_NAME" has ended.
~
QUEST_TIME_PROG * 1
MPECHOAT $i The quest "$QUEST_NAME" has 1 minute remaining.
~
</DATA></FILE>