2 This script is part of the Witherspoon quest, that starts in /scorn/mansion/witherspoon_manor_attic.
3 Check the README file in the same directory as this file for more details.
5 Script for the ghost in Witherspoon manor (south-east of Scorn).
10 from CFDialog
import DialogRule, Dialog
12 key_angry =
'ghost_angry'
13 key_disappear =
'ghost_disappear'
16 '''Ghost is about to become angry, warn the player so she can flee before it's too late!'''
17 if player.Level < ghost.Level:
18 player.Write(
'You feel a very powerful force gather around the %s! Your instinct tell you you\'d rather feel fast!'%ghost.Name)
20 player.Write(
'You feel a really powerful force gather around the %s! Time to start fleeing, maybe?'%ghost.Name)
22 drop = ghost.Map.CreateObject(
'reeking_urine', player.X, player.Y)
23 player.Write(
'You feel so frightened you can\'t control your bladder!')
26 '''Did the player already dig?'''
27 if player.ReadKey(
'witherspoon_tomb') !=
'dig':
33 '''ghost should disappear, called for 2 endings.'''
34 ghost.WriteKey(key_disappear,
'1', 1)
35 ghost.CreateTimer(5, 1)
36 ghost.StandStill =
True
37 player.Write(
'The %s starts fading...'%ghost.Name)
38 if player.QuestGetState(
"scorn/Witherspoon-ghost") <= 50:
39 player.QuestSetState(
"scorn/Witherspoon-ghost", 60)
42 '''Does the player have the body?'''
43 if player.ReadKey(
'witherspoon_tomb') !=
'dig':
46 player.WriteKey(
'witherspoon_tomb',
'', 1)
48 player.WriteKey(
'dialog_witherspoon_ghost',
'', 1)
51 body = player.CheckInventory(
'tortured body')
53 ghost = Crossfire.WhoAmI()
62 ghost.WriteKey(key_angry,
'1', 1)
63 ghost.CreateTimer(10, 1)
64 ghost.Say(
'You fool! You lost my body!\nPrepare to feel my wrath!')
66 if player.QuestGetState(
"scorn/Witherspoon-ghost") <= 60:
67 player.QuestSetState(
"scorn/Witherspoon-ghost", 70)
72 '''Is the ghost angry or disappearing?
73 Used for the final catch all rule so the ghost doesn't talk when angry or disappearing.
75 return Crossfire.WhoAmI().ReadKey(key_angry) ==
'' and Crossfire.WhoAmI().ReadKey(key_disappear) ==
''
78 '''Main dialog routine.'''
82 whoami = Crossfire.WhoAmI()
83 pl = Crossfire.WhoIsActivator()
84 if pl.ReadKey(
'witherspoon_know_all') ==
'1':
86 pl.WriteKey(
'witherspoon_know_all',
'')
87 pl.WriteKey(
'witherspoon_know_dagger',
'')
88 pl.WriteKey(
'witherspoon_ghost',
'')
90 whoami.Map.Print(
'The %s manages to blush.'%whoami.Name)
91 whoami.Say(
'Now I remember. I\'m so stupid. Poor Rolanda, will she ever forgive me...')
92 whoami.Say(
'Well, I guess I can go now. Many thanks for your help!')
93 whoami.WriteKey(
'bonus',
'1', 1)
97 if pl.ReadKey(
'witherspoon_know_dagger') ==
'1':
99 whoami.Say(
'Oh, please find who could be as cruel as to use such a horrible spell on me!')
105 speech =
Dialog(Crossfire.WhoIsActivator(), Crossfire.WhoAmI(),
"witherspoon_ghost")
107 prer = [[
"token",
"witherspoon_ghost",
"0"]]
108 postr = [[
"settoken",
"witherspoon_ghost",
"explain"]]
109 rmsg = [
"I was killed by surprise, and ever since I'm stuck here.\n\n"
110 "If I could see my body, I could really understand I'm dead and I could rest in peace.\n\n"
111 "Could you find my body, please?"
113 speech.addRule(
DialogRule([
"help",
"yes",
"how"], prer, rmsg, postr),0)
115 prer = [[
"token",
"witherspoon_ghost",
"explain"]]
116 postr = [[
"settoken",
"witherspoon_ghost",
"wait"], [
"quest",
"scorn/Witherspoon-ghost", 10]]
117 rmsg = [
"I was walking near a lake west of Scorn, so maybe my body is buried here."]
118 speech.addRule(
DialogRule([
"where",
"location"], prer, rmsg, postr),1)
120 prer = [[
"token",
"witherspoon_ghost",
"explain"]]
121 postr = [[
"settoken",
"witherspoon_ghost",
"*"]]
122 rmsg = [
"Please, go find my body...",
"Please, I need my body to rest in peace..."]
123 speech.addRule(
DialogRule([
"*"], prer, rmsg, postr),2)
125 prer = [[
"token",
"witherspoon_ghost",
"wait"]]
126 postr = [[
"settoken",
"witherspoon_ghost",
"*"]]
127 rmsg = [
"Please, go find my body.\n\nIt should be near the lake west of Scorn...",
"Did you find my body yet? No?\n\nThen please, go search for it, west of Scorn there is a lake..."]
129 rule.setPreFunction(check_body)
130 speech.addRule(rule,3)
132 prer = [[
"token",
"witherspoon_ghost",
"wait"]]
133 postr = [[
"settoken",
"witherspoon_ghost",
"0"]]
134 rmsg = [
"Thanks, you found my body!"]
136 rule.setPreFunction(found_body)
137 speech.addRule(rule,4)
139 prer = [[
"token",
"witherspoon_ghost",
"*"]]
140 postr = [[
"settoken",
"witherspoon_ghost",
"*"]]
141 rmsg = [
"Please help me....",
"Heeeeeeeelp...",
"Pleaseeeee..."]
143 rule.setPreFunction(can_talk)
144 speech.addRule(rule,5)
146 speech.speak(Crossfire.WhatIsMessage())
150 ghost.Say(
'Feel my wrath!')
151 ghost.WriteKey(key_angry,
'', 1)
152 ghost.Unaggressive = 0
154 ghost.RandomMovement = 0
155 ghost.Speed = ghost.Speed * 2
158 '''Got a timer, what for?'''
159 ghost = Crossfire.WhoAmI()
160 if ghost.ReadKey(key_angry) !=
'':
162 elif ghost.ReadKey(key_disappear) !=
'':
167 '''Ghost is happy, all is fine.'''
168 ghost = Crossfire.WhoAmI()
169 if ghost.ReadKey(key_disappear) !=
'1':
170 '''Hu? Not supposed to come here in this case...'''
173 ghost.Say(
'Thanks a lot! Please take those small presents as a token of my gratitude.')
176 if ghost.ReadKey(
'bonus') ==
'1':
179 presents = [
'gem',
'ruby',
'emerald',
'pearl',
'sapphire']
180 got = ghost.Map.CreateObject(presents[random.randint(0, len(presents) - 1)], ghost.X, ghost.Y)
181 got.Quantity = random.randint(3 + bonus, 7 + bonus)
185 if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.SAY:
186 Crossfire.SetReturnValue(1)
188 elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.TIMER: