[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[adonthell-wastesedge-commits] Release_0-3-1 66f584b 036/237: Implemente
From: |
Kai Sterker |
Subject: |
[adonthell-wastesedge-commits] Release_0-3-1 66f584b 036/237: Implemented 'Open Bjarn's Door' puzzle |
Date: |
Mon, 25 Jul 2016 18:14:55 +0000 (UTC) |
tag: Release_0-3-1
commit 66f584b65c32ef3cbc364e38506fecbf509feeff
Author: adondev <adondev>
Commit: adondev <adondev>
Implemented 'Open Bjarn's Door' puzzle
FIXED a little bug in 'switch_submap' function
---
scripts/dialogues/bjarn_start.py | 12 ++--
scripts/dialogues/erek_start.py | 92 +++++++++++++++++------------
scripts/events/cellar_to_dwarfs.py | 11 +++-
scripts/modules/events.py | 11 +++-
scripts/modules/schedules.py | 10 +++-
scripts/schedules/erek.py | 113 ++++++++++++++++++++++--------------
6 files changed, 152 insertions(+), 97 deletions(-)
diff --git a/scripts/dialogues/bjarn_start.py b/scripts/dialogues/bjarn_start.py
index e88bb07..ac8eeb8 100755
--- a/scripts/dialogues/bjarn_start.py
+++ b/scripts/dialogues/bjarn_start.py
@@ -17,13 +17,6 @@ class bjarn_start:
def clear (self):
del self.dialogue
- quests["demo"].set_val( "bjarn_door_open", 2 );
- quests["demo"].set_val( "ask_packed_gems", 1 );
- quests["demo"].set_val( "know_alek_eavesdrop", 1 );
- quests["demo"].set_val( "know_bjarns_insult", 1 );
-
-
-
def __getattr__ (self, name):
return 0
@@ -48,7 +41,7 @@ class bjarn_start:
quests["demo"].set_val( "bjarn_door_open", 3 )
self.player.append (-1)
- if quests["demo"].get_val("bjarn_door_open") == 0:
+ if quests["demo"].get_val ("bjarn_door_open") == 0 or
quests["demo"].get_val ("bjarn_door_open") == 1:
self.color = 0
self.npc.append (0)
@@ -99,6 +92,9 @@ class bjarn_start:
self.color = the_npc.get_color()
self.npc.append (9)
self.cont.append (-1)
+ characters["Erek Stonebreaker"].set_val ("leave_bjarn" , 1)
+ characters["Erek Stonebreaker"].set_schedule_active (1)
+
self.player.append (10)
self.cont.append (7)
self.player.append (-1)
diff --git a/scripts/dialogues/erek_start.py b/scripts/dialogues/erek_start.py
index 1e713d6..3e8578e 100755
--- a/scripts/dialogues/erek_start.py
+++ b/scripts/dialogues/erek_start.py
@@ -19,7 +19,6 @@ class erek_start:
# Returns whom the Player told about his connection
# with Lady Silverhair
-
def get_right_npc (self):
if quests["demo"].get_val ("work_4_shair") & 1 == 1:
return "Master Orloth"
@@ -29,6 +28,15 @@ class erek_start:
else:
return "Tristan the merchant"
+
+ # -- 'teleport' to Bjarn's room
+ def __del__ (self):
+ if quests["demo"].get_val ("bjarn_door_open") == 2:
+ erek = characters["Erek Stonebreaker"]
+ from events import switch_submap
+ switch_submap (the_player, 7, 1, 6, 3)
+ switch_submap (erek, 7, 2, 7, 0)
+
def __getattr__ (self, name):
@@ -76,30 +84,63 @@ class erek_start:
self.cont.append (-1)
self.player.append (73)
self.cont.append (-1)
- self.player.append (49)
- self.cont.append (33)
self.player.append (48)
self.cont.append (32)
if quests["demo"].get_val ("bjarn_door_open") == 1:
self.player.append (84)
self.cont.append (53)
+ if quests["demo"].get_val ("know_bjarns_insult") == 1:
+
+ self.player.append (49)
+ self.cont.append (33)
self.player.append (-1)
self.color = the_npc.get_color()
self.npc.append (47)
self.cont.append (-1)
self.player.append (73)
self.cont.append (-1)
- self.player.append (49)
- self.cont.append (33)
self.player.append (48)
self.cont.append (32)
if quests["demo"].get_val ("bjarn_door_open") == 1:
self.player.append (84)
self.cont.append (53)
+ if quests["demo"].get_val ("know_bjarns_insult") == 1:
+
+ self.player.append (49)
+ self.cont.append (33)
+ self.player.append (-1)
+
+ def answer49 (self):
+ self.color = the_npc.get_color()
+ self.npc.append (75)
+ self.cont.append (49)
+ self.player.append (-1)
+
+ def answer75 (self):
+ self.color = the_npc.get_color()
+ self.npc.append (76)
+ self.cont.append (50)
self.player.append (-1)
+ def answer76 (self):
+ self.color = the_npc.get_color()
+ self.npc.append (77)
+ self.cont.append (-1)
+ self.player.append (78)
+ self.cont.append (-1)
+ self.player.append (48)
+ self.cont.append (32)
+ if quests["demo"].get_val ("bjarn_door_open") == 1:
+
+ self.player.append (84)
+ self.cont.append (53)
+ self.player.append (-1)
+
+ def answer78 (self):
+ pass
+
def answer84 (self):
self.color = the_npc.get_color()
self.npc.append (85)
@@ -264,35 +305,6 @@ class erek_start:
self.cont.append (51)
self.player.append (-1)
- def answer49 (self):
- self.color = the_npc.get_color()
- self.npc.append (75)
- self.cont.append (49)
- self.player.append (-1)
-
- def answer75 (self):
- self.color = the_npc.get_color()
- self.npc.append (76)
- self.cont.append (50)
- self.player.append (-1)
-
- def answer76 (self):
- self.color = the_npc.get_color()
- self.npc.append (77)
- self.cont.append (-1)
- self.player.append (78)
- self.cont.append (-1)
- self.player.append (48)
- self.cont.append (32)
- if quests["demo"].get_val ("bjarn_door_open") == 1:
-
- self.player.append (84)
- self.cont.append (53)
- self.player.append (-1)
-
- def answer78 (self):
- pass
-
def answer73 (self):
pass
@@ -372,14 +384,16 @@ class erek_start:
self.cont.append (-1)
self.player.append (74)
self.cont.append (-1)
- self.player.append (49)
- self.cont.append (33)
self.player.append (48)
self.cont.append (32)
if quests["demo"].get_val ("bjarn_door_open") == 1:
self.player.append (84)
self.cont.append (53)
+ if quests["demo"].get_val ("know_bjarns_insult") == 1:
+
+ self.player.append (49)
+ self.cont.append (33)
self.player.append (-1)
def answer74 (self):
@@ -399,12 +413,14 @@ class erek_start:
self.cont.append (-1)
self.player.append (48)
self.cont.append (32)
- self.player.append (49)
- self.cont.append (33)
if quests["demo"].get_val ("bjarn_door_open") == 1:
self.player.append (84)
self.cont.append (53)
+ if quests["demo"].get_val ("know_bjarns_insult") == 1:
+
+ self.player.append (49)
+ self.cont.append (33)
self.player.append (-1)
def answer56 (self):
diff --git a/scripts/events/cellar_to_dwarfs.py
b/scripts/events/cellar_to_dwarfs.py
index 323a112..d7adf8e 100755
--- a/scripts/events/cellar_to_dwarfs.py
+++ b/scripts/events/cellar_to_dwarfs.py
@@ -3,7 +3,14 @@ from events import switch_submap
p = characters [name]
if p.submap () == 4:
- switch_submap (p, 7, 1, 6 + (p.posy () - 6), STAND_EAST)
+ # -- bjarn's door closed
+ open = quests["demo"].get_val("bjarn_door_open")
+ if open == 0 or open == 1:
+ if p == the_player:
+ characters["Bjarn Fingolson"].launch_action (p)
+ p.go_west ()
+ else:
+ switch_submap (p, 7, 1, 6 + (p.posy () - 6), STAND_EAST)
else:
- switch_submap (p, 4, 9, 6 + (p.posy () - 6), STAND_WEST)
+ switch_submap (p, 4, 9, 6 + (p.posy () - 6), STAND_WEST)
diff --git a/scripts/modules/events.py b/scripts/modules/events.py
index 9308b22..0c65e1e 100755
--- a/scripts/modules/events.py
+++ b/scripts/modules/events.py
@@ -43,8 +43,12 @@ def fade_in ():
# -- switch submaps (character, new coordinates, new submap,
# direction the character shall face)
def switch_submap (mychar, x, y, submap, dir):
- mychar.set_schedule_active (0)
- mychar.stand ()
+ if mychar.is_schedule_activated ():
+ mychar.set_schedule_active (0)
+ mychar.stand ()
+ schedule_active = 1
+ else:
+ schedule_active = 0
# -- comparing mychar and player directly does not work (???)
if mychar.get_name () == gamedata_player ().get_name ():
@@ -54,4 +58,5 @@ def switch_submap (mychar, x, y, submap, dir):
else:
mychar.jump_to (x, y, submap, dir)
- mychar.set_schedule_active (1)
+ if schedule_active == 1:
+ mychar.set_schedule_active (1)
diff --git a/scripts/modules/schedules.py b/scripts/modules/schedules.py
index 653a842..aa11564 100755
--- a/scripts/modules/schedules.py
+++ b/scripts/modules/schedules.py
@@ -163,9 +163,13 @@ class bubble (win_container):
# -- draws the bubble above the character's head
def on_update (self, mychar):
- x, y = self.get_window_pos (mychar)
- self.move (x, y)
- self.remain = self.remain - 1
+ # -- but only if on the same submap as the player
+ if mychar.submap () == gamedata_player ().submap ():
+ x, y = self.get_window_pos (mychar)
+ self.move (x, y)
+ self.remain = self.remain - 1
+ else:
+ self.remain = 0
# -- center the window above the characters head
def get_window_pos (self, mychar):
diff --git a/scripts/schedules/erek.py b/scripts/schedules/erek.py
index d4f8a1a..33ecb80 100755
--- a/scripts/schedules/erek.py
+++ b/scripts/schedules/erek.py
@@ -13,6 +13,7 @@
# -- Movement schedule for Erek Stonebreaker
#
# Erek will either be in the parlour or the common room.
+# He'll also help the player to get into Bjarn's room.
import schedules
import random
@@ -26,50 +27,76 @@ coords = [(5, 5, STAND_NORTH), \
(5, 3, STAND_NORTH), \
(4, 5, STAND_SOUTH)]
-todo = myself.get_val ("goto_parlour")
-
-# switch places
-if todo == 0:
- # -- in common room -> goto parlour
- if myself.submap () == 1 \
- and schedules.simple_goto_xy (myself, 13, 4) == 1:
- # since simple_goto_xy only returns 1 if the character
- # completely occupies the tile, but the enter event is
- # raised before, we have to do the last step manually.
- myself.go_east ()
- delay = random.randint (50, 150) * -30
- myself.set_val ("goto_parlour", delay)
- myself.set_val ("goal", random.randint (2, 3))
-
- # -- in parlour -> goto common room
- elif schedules.simple_goto_xy (myself, 1, 4) == 1:
- myself.go_west ()
- delay = random.randint (50, 150) * 20
- myself.set_val ("goto_parlour", delay)
+
+# -- lead the player into bjarn's room
+if quests["demo"].get_val ("bjarn_door_open") == 2:
+ myself.set_schedule_active (0)
+ # -- start Bjanr's conversation with the player and Erek
+ characters["Bjarn Fingolson"].launch_action (the_player)
+
+# -- leave cellar again
+elif myself.get_val ("leave_bjarn") == 1:
+ submap = myself.submap ()
+
+ # -- in Bjarn's room
+ if submap == 7:
+ schedules.simple_goto_xy (myself, 0, 7)
+
+ # -- in the Cellar
+ elif submap == 4:
+ schedules.simple_goto_xy (myself, 5, 2)
+
+ # -- hopefully in the common room
+ else:
+ myself.set_val ("leave_bjarn", 0)
myself.set_val ("goal", random.randint (0, 1))
-# -- walk up to the new pos and stay there
+# -- "normal" schedule
else:
- # -- In parlour
- if todo < 0:
- myself.set_val ("goto_parlour", todo + 1)
- # -- In common room
+ todo = myself.get_val ("goto_parlour")
+
+ # switch places
+ if todo == 0:
+ # -- in common room -> goto parlour
+ if myself.submap () == 1 \
+ and schedules.simple_goto_xy (myself, 13, 4) == 1:
+ # since simple_goto_xy only returns 1 if the character
+ # completely occupies the tile, but the enter event is
+ # raised before, we have to do the last step manually.
+ myself.go_east ()
+ delay = random.randint (50, 150) * -30
+ myself.set_val ("goto_parlour", delay)
+ myself.set_val ("goal", random.randint (2, 3))
+
+ # -- in parlour -> goto common room
+ elif schedules.simple_goto_xy (myself, 1, 4) == 1:
+ myself.go_west ()
+ delay = random.randint (50, 150) * 20
+ myself.set_val ("goto_parlour", delay)
+ myself.set_val ("goal", random.randint (0, 1))
+
+ # -- walk up to the new pos and stay there
else:
- myself.set_val ("goto_parlour", todo - 1)
-
- goal = myself.get_val ("goal")
- x, y, dir = coords[goal]
-
- if schedules.simple_goto_xy (myself, x, y) == 1:
- if dir == STAND_NORTH: myself.stand_north ()
- elif dir == STAND_EAST: myself.stand_east ()
- elif dir == STAND_SOUTH: myself.stand_south ()
- else: myself.stand_west ()
-
-# -- do some random babbling
-tmp = myself.get_val ("say_something")
-myself.set_val ("say_something", tmp - 1)
-if tmp == 0:
- schedules.speak (myself, speech[random.randint (0, 2)])
- delay = random.randint (60, 180) * 15
- myself.set_val ("say_something", delay)
+ # -- In parlour
+ if todo < 0:
+ myself.set_val ("goto_parlour", todo + 1)
+ # -- In common room
+ else:
+ myself.set_val ("goto_parlour", todo - 1)
+
+ goal = myself.get_val ("goal")
+ x, y, dir = coords[goal]
+
+ if schedules.simple_goto_xy (myself, x, y) == 1:
+ if dir == STAND_NORTH: myself.stand_north ()
+ elif dir == STAND_EAST: myself.stand_east ()
+ elif dir == STAND_SOUTH: myself.stand_south ()
+ else: myself.stand_west ()
+
+ # -- do some random babbling
+ tmp = myself.get_val ("say_something")
+ myself.set_val ("say_something", tmp - 1)
+ if tmp == 0:
+ schedules.speak (myself, speech[random.randint (0, 2)])
+ delay = random.randint (60, 180) * 15
+ myself.set_val ("say_something", delay)
- [adonthell-wastesedge-commits] Release_0-3-1 f6f7dec 016/237: Added the guards house (Alex), (continued)
- [adonthell-wastesedge-commits] Release_0-3-1 f6f7dec 016/237: Added the guards house (Alex), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 908f59b 029/237: Added orloth's schedule, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 2486015 027/237: Some stairs added, better map initialisation scheme., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 0fbac81 017/237: Fixed last (?) severe bugs!, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 065306d 021/237: Added some rooms to the map (Alex), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 9112207 034/237: Fixed Lucia's dialogue, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 0e77bb6 032/237: ADDED dialogues of Oliver and Bjarn, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 46ff573 008/237: Oooops forgot these ones..., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 9997e40 031/237: Implemented schedules of Silverhair, Frostbloom and Trailfollower, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 eedeab6 040/237: FIXED jerky movement during the first second after the game starts up, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 66f584b 036/237: Implemented 'Open Bjarn's Door' puzzle,
Kai Sterker <=
- [adonthell-wastesedge-commits] Release_0-3-1 1dac4d8 019/237: Those are the most recent versions of those dialogues - the ones on the ftp are a lot older, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 8b0c1e0 042/237: Slight fix to Alek's dialogue, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 d2a86c9 030/237: Added some more characters and dialogues, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 de03633 047/237: Commited my own files again! :/, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 fe87ce5 041/237: Stupid kdevelop!!!, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 56fe2ff 046/237: Fixed Oliver's teleport bug., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 edbcb94 007/237: Added autoconf/automake support., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 89ba59b 024/237: Continued map rooms., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 78ff7bc 049/237: More schedules converted to the new pathfinding code, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 a4f92b4 055/237: Ooppps! Fixed an error of my own, sorry., Kai Sterker, 2016/07/25