adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-wastesedge-commits] Release_0-3-1 9997e40 031/237: Implemente


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 9997e40 031/237: Implemented schedules of Silverhair, Frostbloom and Trailfollower
Date: Mon, 25 Jul 2016 18:14:54 +0000 (UTC)

tag: Release_0-3-1
commit 9997e40342a0ac5e3681ed616548cec52496725b
Author: adondev <adondev>
Commit: adondev <adondev>

    Implemented schedules of Silverhair, Frostbloom and Trailfollower
---
 scripts/init.py                 |    7 ++-
 scripts/modules/schedules.py    |   25 +++++++---
 scripts/schedules/Makefile.am   |    3 +-
 scripts/schedules/frostbloom.py |   55 +++++++++++++++++++++
 scripts/schedules/orloth.py     |   19 ++++++--
 scripts/schedules/sarin.py      |  101 +++++++++++++++++++++++++++++++++++++++
 scripts/schedules/silverhair.py |   71 +++++++++++++++++++++++++++
 7 files changed, 267 insertions(+), 14 deletions(-)

diff --git a/scripts/init.py b/scripts/init.py
index ddb47f0..0b94dde 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -491,6 +491,7 @@ if retval < 5:
         frostbloom.jump_to (0, 18, 22)
         frostbloom.set_action ("action_talk")
         frostbloom.stand_north ()
+        frostbloom.set_schedule ("frostbloom")
 
         bjarn = characters ["Bjarn Fingolson"]
         bjarn.set_dialogue ("dialogues/bjarn_start")
@@ -506,6 +507,7 @@ if retval < 5:
         silverhair.jump_to (13, 4, 6)
         silverhair.set_action ("action_talk")
         silverhair.stand_north ()
+        silverhair.set_schedule ("silverhair")
 
         sarin = characters ["Sarin Trailfollower"]
         sarin.set_dialogue ("dialogues/sarin_start")
@@ -513,7 +515,8 @@ if retval < 5:
         sarin.set_map (map_engine.get_landmap ())
         sarin.jump_to (13, 7, 3)
         sarin.set_action ("action_talk")
-        sarin.stand_east ()
+        sarin.stand_west ()
+        sarin.set_schedule ("sarin")
 
         janesta = characters ["Janesta Skywind"]
         janesta.set_dialogue ("dialogues/janesta_start")
@@ -521,7 +524,7 @@ if retval < 5:
         janesta.set_map (map_engine.get_landmap ())
         janesta.jump_to (13, 1, 4)
         janesta.set_action ("action_talk")
-        janesta.stand_west ()
+        janesta.stand_east ()
 
         # Once we want to generate the data context files,
         # just call gamedata::save (1) and copy the .data files
diff --git a/scripts/modules/schedules.py b/scripts/modules/schedules.py
index 6fcd920..653a842 100755
--- a/scripts/modules/schedules.py
+++ b/scripts/modules/schedules.py
@@ -80,8 +80,9 @@ def go_east_west (mychar, dist_x, dist_y, count):
 
 # -- display a "bubble" with some text above a character
 def speak (mychar, text):
-    # -- but only if he's on the player's submap
+    # -- ... but only if he's on the player's submap
     if mychar.submap () == gamedata_player ().submap ():
+
         b = bubble (mychar, text)
         b.thisown = 0
 
@@ -94,12 +95,20 @@ class bubble (win_container):
     def __init__ (self, mychar, text):
         win_container.__init__(self)
 
-        self.remain = len (text) * 10
+        # -- the time the bubble will remain open
+        self.remain = 75 + len (text) * 4
 
         self.py_signal_connect (self.on_destroy, win_event_DESTROY)
         self.py_signal_connect (self.on_update, win_event_UPDATE, mychar)
 
-        self.font = win_font (WIN_THEME_ORIGINAL)
+        # -- get the font that matches the NPC's text color
+        if mychar.get_color () == 1: self.font = win_font ("yellow/")
+        elif mychar.get_color () == 2: self.font = win_font ("red/")
+        elif mychar.get_color () == 3: self.font = win_font ("violet/")
+        elif mychar.get_color () == 4: self.font = win_font ("blue/")
+        elif mychar.get_color () == 5: self.font = win_font ("green/")
+        else: self.font = win_font( "white/")
+
         self.theme = win_theme (WIN_THEME_ORIGINAL)
 
         # -- if the submap is smaller than the mapview, we have to
@@ -118,12 +127,12 @@ class bubble (win_container):
         # -- get the postion above the character's head
         x, y = self.get_window_pos (mychar)
 
-        self.resize (100, 30)
+        self.resize (120, 55)
         self.move (x, y)       
 
         self.bubble = win_label ()
         self.bubble.set_font (self.font)
-        self.bubble.resize (90, 0)
+        self.bubble.resize (110, 0)
         self.bubble.set_form (label_AUTO_HEIGHT)
         self.bubble.set_text (text)
 
@@ -148,9 +157,11 @@ class bubble (win_container):
         del self.theme
         del self.font
 
+    # -- once this returns 0, the bubble will close
     def on_destroy (self):
         return self.remain
 
+    # -- draws the bubble above the character's head
     def on_update (self, mychar):
         x, y = self.get_window_pos (mychar)
         self.move (x, y)
@@ -160,8 +171,8 @@ class bubble (win_container):
     def get_window_pos (self, mychar):
         view = gamedata_map_engine ().get_mapview ()
         x = (mychar.posx () - view.posx () - mychar.base_x ()) * MAPSQUARE_SIZE
-        x = x + mychar.offx () - view.offx () - 45 + self.offx
+        x = x + mychar.offx () - view.offx () - 55 + self.offx
         y = (mychar.posy () - view.posy () - mychar.base_y ()) * MAPSQUARE_SIZE
-        y = y + mychar.offy () - view.offy () - 25 + self.offy
+        y = y + mychar.offy () - view.offy () - 40 + self.offy
 
         return (x, y)
\ No newline at end of file
diff --git a/scripts/schedules/Makefile.am b/scripts/schedules/Makefile.am
index 1eee574..a4a17bd 100755
--- a/scripts/schedules/Makefile.am
+++ b/scripts/schedules/Makefile.am
@@ -1,5 +1,6 @@
 pkgdatadir = $(gamedatadir)/scripts/schedules
 
-pkgdata_DATA = action_talk.py center_player.py keyboard_control.py orloth.py
+pkgdata_DATA = action_talk.py center_player.py keyboard_control.py orloth.py \
+    sarin.py frostbloom.py silverhair.py
 
 EXTRA_DIST = $(pkgdata_DATA)
diff --git a/scripts/schedules/frostbloom.py b/scripts/schedules/frostbloom.py
new file mode 100755
index 0000000..1551632
--- /dev/null
+++ b/scripts/schedules/frostbloom.py
@@ -0,0 +1,55 @@
+#
+#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+# -- Movement schedule for Rhayne Frostbloom
+#
+#    She just walks around the tree in the yard
+
+import schedules
+import random
+
+# -- Borders of the area she will stay in
+min_x = 16
+max_x = 24
+min_y = 21
+max_y = 28
+
+speech = ["This tree is so inspiring.", \
+          "I wonder why everybody seems so excited.", \
+          "Do you know a creature more lovely than the yeti?"]
+
+todo = character_base.get (myself, "stand_still")
+
+# -- calculate a new position
+if todo == 0:
+    # -- the position we want to reach
+    character_base.set (myself, "goal_x", random.randint (min_x, max_x))
+    character_base.set (myself, "goal_y", random.randint (min_y, max_y))
+
+    delay = random.randint (30, 90) * 30
+    character_base.set (myself, "stand_still", delay)
+
+# -- walk to the new position and wait a while
+else:
+    x = character_base.get (myself, "goal_x")
+    y = character_base.get (myself, "goal_y")
+
+    schedules.simple_goto_xy (myself, x, y)
+    character_base.set (myself, "stand_still", todo - 1)
+
+    # -- utter a random remark
+    tmp = character_base.get (myself, "say_something")
+    character_base.set (myself, "say_something", tmp - 1)
+    if tmp == 0:
+        schedules.speak (myself, speech[random.randint (0, 2)])
+        delay = random.randint (50, 150) * 20
+        character_base.set (myself, "say_something", delay)
diff --git a/scripts/schedules/orloth.py b/scripts/schedules/orloth.py
index 021b285..b7d0611 100755
--- a/scripts/schedules/orloth.py
+++ b/scripts/schedules/orloth.py
@@ -11,15 +11,26 @@
 #
 
 # -- Movement schedule for Orloth Redwyne
+#
+#    He'll walk up to a table occasionally and either set or clean it
+#    From time to time he'll complain about the grandfather clock
+
 import schedules
 import random
 
-speech = ["I gotta clean this mug!", "That barrel is leaking.", "I hope 
they'll find the thief!"]
-coords = [(3, 5, STAND_SOUTH), (7, 6, STAND_EAST), (12, 3, STAND_SOUTH), (7, 
4, STAND_WEST), (10, 3, STAND_NORTH)]
+speech = ["I gotta clean this mug!", \
+          "That barrel is leaking.", \
+          "I hope they'll find the thief!"]
+
+coords = [(3, 5, STAND_SOUTH), \
+          (7, 6, STAND_EAST), \
+          (12, 3, STAND_SOUTH), \
+          (7, 4, STAND_WEST), \
+          (10, 3, STAND_NORTH)]
 
 todo = character_base.get (myself, "wait_behind_bar")
 
-# -- leave the barcharacter_base.get (myself, "wait_behind_bar") == 0
+# -- leave the bar
 if todo == 0:
     # -- get the position we want to reach
     goal = character_base.get (myself, "goal")
@@ -62,4 +73,4 @@ else:
     if tmp == 0:
         schedules.speak (myself, speech[random.randint (0, 2)])
         delay = random.randint (50, 150) * 20
-        character_base.set (myself, "say_something", delay)
\ No newline at end of file
+        character_base.set (myself, "say_something", delay)
diff --git a/scripts/schedules/sarin.py b/scripts/schedules/sarin.py
new file mode 100755
index 0000000..370bfb9
--- /dev/null
+++ b/scripts/schedules/sarin.py
@@ -0,0 +1,101 @@
+#
+#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+# -- Movement schedule for Sarin Trailfollower
+#
+#    He walks from one end of the room to the other. From time to
+#    to time he'll stop and chose another direction
+
+import schedules
+import random
+
+# -- Borders of the area he should stay in
+min_x = 1
+max_x = 7
+min_y = 2
+max_y = 6
+
+speech = ["Ruffinans, the lot of them!", \
+          "How dare they imprison one better than they?", \
+          "This is an insult to all of the High Born.", \
+          "I cannot believe such disrespect. Barbarians!"]
+
+todo = character_base.get (myself, "switch_direction")
+
+# -- calculate a new direction
+if todo == 0:
+    # -- wait until we're completely on the tile
+    if schedules.simple_goto_xy (myself, myself.posx (), myself.posy ()) == 1:
+        # -- get the current direction ...
+        dir = character_base.get (myself, "direction")
+
+        # -- ... and set the new one accordingly
+        if dir == WALK_EAST or dir == WALK_WEST:
+            character_base.set (myself, "direction", random.randint 
(WALK_NORTH, WALK_SOUTH))
+        else:
+            character_base.set (myself, "direction", random.randint 
(WALK_WEST, WALK_EAST))
+
+        # -- wait a little on the current tile
+        delay = random.randint (30, 50) * 10
+        character_base.set (myself, "switch_direction", -delay)
+
+        # -- time until the next direction change
+        delay = random.randint (100, 200) * 15
+        character_base.set (myself, "delay", delay)
+
+# -- wait a moment
+elif todo < 0:
+    character_base.set (myself, "switch_direction", todo + 1)
+    if todo == -1:
+        delay = character_base.get (myself, "delay")
+        character_base.set (myself, "switch_direction", delay)
+
+# -- walk up to the wall, wait a little, then turn around
+else:
+    character_base.set (myself, "switch_direction", todo - 1)
+    dir = character_base.get (myself, "direction")
+
+    if dir == WALK_NORTH:
+        if schedules.simple_goto_xy (myself, myself.posx (), min_y) == 1:
+            character_base.set (myself, "direction", WALK_SOUTH)
+            character_base.set (myself, "switch_direction", random.randint 
(-300, -150))
+            character_base.set (myself, "delay", todo)
+            myself.stand_south ()
+
+    elif dir == WALK_SOUTH:
+        if schedules.simple_goto_xy (myself, myself.posx (), max_y) == 1:
+            character_base.set (myself, "direction", WALK_NORTH)
+            character_base.set (myself, "switch_direction", random.randint 
(-300, -150))
+            character_base.set (myself, "delay", todo)
+            myself.stand_north ()
+
+    elif dir == WALK_WEST:
+        if schedules.simple_goto_xy (myself, min_x, myself.posy ()) == 1:
+            character_base.set (myself, "direction", WALK_EAST)
+            character_base.set (myself, "switch_direction", random.randint 
(-300, -150))
+            character_base.set (myself, "delay", todo)
+            myself.stand_east ()
+
+    else:
+        if schedules.simple_goto_xy (myself, max_x, myself.posy ()) == 1:
+            character_base.set (myself, "direction", WALK_WEST)
+            character_base.set (myself, "switch_direction", random.randint 
(-300, -105))
+            character_base.set (myself, "delay", todo)
+            myself.stand_west ()
+
+    # -- utter a random remark
+    tmp = character_base.get (myself, "say_something")
+    character_base.set (myself, "say_something", tmp - 1)
+    if tmp == 0:
+        schedules.speak (myself, speech[random.randint (0, 3)])
+        delay = random.randint (50, 150) * 10
+        character_base.set (myself, "say_something", delay)
diff --git a/scripts/schedules/silverhair.py b/scripts/schedules/silverhair.py
new file mode 100755
index 0000000..9c5b3d2
--- /dev/null
+++ b/scripts/schedules/silverhair.py
@@ -0,0 +1,71 @@
+#
+#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+# -- Movement schedule for Imoen Silverhair
+#
+#    She will mainly stand still, but occasionally walk up to the
+#    window and make a remark about the weather.
+
+import schedules
+import random
+
+speech = ["In truth, Sarin, it is no bother. I am not offended.", \
+          "Janesta, dear, worry not. I am content here.", \
+          "Janesta, please bring my figurine. I wish to see it more closely.", 
\
+          "It truly is a lovely day. I expect we will have time yet to enjoy 
it."]
+
+todo = character_base.get (myself, "say_something")
+
+# -- utter some remark
+if todo == 0:
+
+    # -- get a random remark
+    index = random.randint (0, 3)
+
+    # -- goto the window
+    if index == 3:
+        delay = random.randint (33, 66) * 10
+        character_base.set (myself, "say_something", -delay)
+
+    else:
+        # -- speak
+        schedules.speak (myself, speech[index])
+
+        # -- wait a while before saying something else
+        delay = random.randint (50, 150) * 20
+        character_base.set (myself, "say_something", delay)
+
+# -- walk up to the window and wait a little
+elif todo < 0:
+    if schedules.simple_goto_xy (myself, 7, 5) == 1:
+        myself.stand_east ()
+
+        # -- speak
+        if todo == -250:
+            myself.stand_east ()
+            schedules.speak (myself, speech[3])
+
+        # -- leave the window
+        if todo == -1:
+            delay = random.randint (50, 150) * 10
+            character_base.set (myself, "say_something", delay)
+        # -- wait
+        else:
+            character_base.set (myself, "say_something", todo + 1)
+
+# -- leave the window
+else:
+    character_base.set (myself, "say_something", todo - 1)
+
+    # -- reached the middle of the room
+    if schedules.simple_goto_xy (myself, 4, 4) == 1:
+        myself.stand_south ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]