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 30316f6 132/237: ADDED init


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 30316f6 132/237: ADDED initial dialogue with Talan to get into the inn
Date: Mon, 25 Jul 2016 18:15:06 +0000 (UTC)

tag: Release_0-3-1
commit 30316f6e7f92abd429e5249ed8d6d468f4c9d0e0
Author: adondev <adondev>
Commit: adondev <adondev>

    ADDED initial dialogue with Talan to get into the inn
---
 scripts/dialogues/Makefile.am            |    2 +-
 scripts/dialogues/demo_intro_1.py        |  202 ++++++++++++++++++++++++++++++
 scripts/init.py                          |   11 +-
 scripts/schedules/mapcharacters/intro.py |   90 +++++++++++++
 4 files changed, 301 insertions(+), 4 deletions(-)

diff --git a/scripts/dialogues/Makefile.am b/scripts/dialogues/Makefile.am
index da196c2..5fae582 100755
--- a/scripts/dialogues/Makefile.am
+++ b/scripts/dialogues/Makefile.am
@@ -3,7 +3,7 @@ pkgdatadir = $(gamedatadir)/scripts/dialogues
 pkgdata_DATA = orloth_start.py lucia_start.py sarin_start.py \
     janesta_start.py erek_start.py oliver_start.py bjarn_start.py \
     frostbloom_start.py talan_start.py alek_start.py jelom_start.py \
-    tristan_start.py jelom_2nd.py
+    tristan_start.py jelom_2nd.py demo_intro_1.py
 
 EXTRA_DIST = $(pkgdata_DATA)
 
diff --git a/scripts/dialogues/demo_intro_1.py 
b/scripts/dialogues/demo_intro_1.py
new file mode 100644
index 0000000..42a7baf
--- /dev/null
+++ b/scripts/dialogues/demo_intro_1.py
@@ -0,0 +1,202 @@
+import adonthell
+
+class demo_intro_1:
+       loop = []
+       strings = ["Your employer, eh?  Who might that be?", "The Lady 
Silverhair, and she must have great need of me, so let me pass!", "Nay, if you 
are Silverhair's man, then I shall not let you pass.  That one is the source of 
all this mess, and I'll be switched if I let her accomplice in to free her.  Be 
on your way!", "What sort of mess, man?  My Lady is in trouble, I must know!", 
"I do not know what nonsense you think is going on here.  But if my Lady needs 
me, then I shall come to her ai [...]
+
+       def set_name (self, new_name):
+               pass
+
+       def set_npc (self, new_npc):
+               pass
+
+       def set_portrait (self, new_portrait):
+               pass
+
+       def __init__(self, p, n):
+               self.the_player = p
+               self.the_npc = n
+
+               self.dialogue = [self.start, self.answer1, self.answer3, 
self.answer4, self.answer6, self.answer8, self.answer9, self.answer10, 
self.answer11, self.answer13, self.answer14, self.answer16, self.answer19, 
self.answer23, self.answer25, self.answer28, self.answer29, self.answer31, None]
+
+       def clear (self):
+               del self.dialogue
+
+       def get_right_npc (self):
+               return "Master Orloth"
+
+
+       def __getattr__ (self, name):
+               return 0
+
+       def run (self, answer):
+               self.npc = []
+               self.player = []
+               self.cont = []
+               self.dialogue[answer]()
+
+       def start (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (0)
+               self.cont.append (-1)
+               self.player.append (1)
+               self.cont.append (1)
+               self.player.append (11)
+               self.cont.append (8)
+               self.player.append (-1)
+
+       def answer11 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (12)
+               self.cont.append (-1)
+               self.player.append (13)
+               self.cont.append (9)
+               self.player.append (14)
+               self.cont.append (10)
+               self.player.append (-1)
+
+       def answer14 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (15)
+               self.cont.append (-1)
+               self.player.append (16)
+               self.cont.append (11)
+               self.player.append (-1)
+
+       def answer16 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (17)
+               self.cont.append (-1)
+               self.player.append (4)
+               self.cont.append (3)
+               self.player.append (3)
+               self.cont.append (2)
+               self.player.append (-1)
+
+       def answer3 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (7)
+               self.cont.append (-1)
+               self.player.append (8)
+               self.cont.append (5)
+               self.player.append (9)
+               self.cont.append (6)
+               self.player.append (-1)
+
+       def answer9 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (20)
+               self.cont.append (-1)
+               self.player.append (19)
+               self.cont.append (12)
+               self.player.append (-1)
+
+       def answer19 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (21)
+               self.cont.append (-1)
+               self.player.append (10)
+               self.cont.append (7)
+               self.player.append (-1)
+
+       def answer10 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (27)
+               self.cont.append (-1)
+               self.player.append (28)
+               self.cont.append (15)
+               self.player.append (29)
+               self.cont.append (16)
+               self.player.append (6)
+               self.cont.append (4)
+               self.player.append (-1)
+
+       def answer6 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (22)
+               self.cont.append (-1)
+               self.player.append (23)
+               self.cont.append (13)
+               self.player.append (-1)
+
+       def answer23 (self):
+               self.color = 0
+               self.npc.append (24)
+               self.cont.append (-1)
+               self.player.append (25)
+               self.cont.append (14)
+               self.player.append (-1)
+
+       def answer25 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (26)
+               self.cont.append (-1)
+               self.the_npc.set_dialogue ("dialogues/talan_start")
+
+               self.player.append (-1)
+
+       def answer29 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (30)
+               self.cont.append (-1)
+               self.player.append (31)
+               self.cont.append (17)
+               self.player.append (6)
+               self.cont.append (4)
+               self.player.append (-1)
+
+       def answer31 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (32)
+               self.cont.append (-1)
+               self.player.append (6)
+               self.cont.append (4)
+               self.player.append (-1)
+
+       def answer28 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (30)
+               self.cont.append (-1)
+               self.player.append (31)
+               self.cont.append (17)
+               self.player.append (6)
+               self.cont.append (4)
+               self.player.append (-1)
+
+       def answer8 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (18)
+               self.cont.append (-1)
+               self.player.append (19)
+               self.cont.append (12)
+               self.player.append (-1)
+
+       def answer4 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (5)
+               self.cont.append (-1)
+               self.player.append (6)
+               self.cont.append (4)
+               self.player.append (10)
+               self.cont.append (7)
+               self.player.append (-1)
+
+       def answer13 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (2)
+               self.cont.append (-1)
+               self.player.append (3)
+               self.cont.append (2)
+               self.player.append (4)
+               self.cont.append (3)
+               self.player.append (-1)
+
+       def answer1 (self):
+               self.color = self.the_npc.get_color()
+               self.npc.append (2)
+               self.cont.append (-1)
+               self.player.append (3)
+               self.cont.append (2)
+               self.player.append (4)
+               self.cont.append (3)
+               self.player.append (-1)
diff --git a/scripts/init.py b/scripts/init.py
index 975946a..650cfac 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -790,6 +790,11 @@ class title_screen:
         lm.add_event (ev)
 
         # Now setup the characters
+        player = gamedata_player ()
+        player.jump_to (0, 4, 18)
+        player.stand_east ()
+        player.set_schedule ("intro")
+
         lucia = gamedata_get_character ("Lucia Redwyne")
         lucia.set_dialogue ("dialogues/lucia_start")
         lucia.load ("lucia.mchar")
@@ -822,12 +827,12 @@ class title_screen:
         erek.set_portrait ("erek.pnm")
 
         talan = gamedata_get_character ("Talan Wendth")
-        talan.set_dialogue ("dialogues/talan_start")
+        talan.set_dialogue ("dialogues/demo_intro_1")
         talan.load ("talan.mchar")
         talan.set_map (gamedata_map_engine ().get_landmap ())
-        talan.jump_to (0, 11, 19)
+        talan.jump_to (0, 7, 17)
         talan.set_action ("talk")
-        talan.stand_north ()
+        talan.stand_west ()
         talan.set_schedule ("talan")
         talan.set_portrait ("talan.pnm")
 
diff --git a/scripts/schedules/mapcharacters/intro.py 
b/scripts/schedules/mapcharacters/intro.py
new file mode 100644
index 0000000..1bc82fb
--- /dev/null
+++ b/scripts/schedules/mapcharacters/intro.py
@@ -0,0 +1,90 @@
+#
+#  (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
+#
+
+# -- Schedule for the player to get into the Inn after the intro
+
+import adonthell
+
+class intro:
+
+    def __init__ (self, mapcharacterinstance):
+        self.myself = mapcharacterinstance
+
+        self.myself.set_val ("talk_to_talan", 1)
+
+
+    def run (self):
+        myself = self.myself
+        talk = myself.get_val ("talk_to_talan")
+
+        # -- first talk to talan to get into the inn
+        if talk == 1:
+            talan = adonthell.gamedata_get_character ("Talan Wendth")
+            talan.launch_action (myself)
+
+            myself.set_val ("talk_to_talan", 2)
+
+        # -- open the gate
+        elif talk == 2:
+            self.open_gate ()
+
+            myself.set_val ("talk_to_talan", 0)
+            myself.set_goal (10, 18, adonthell.STAND_EAST)
+
+        # -- move in and finally enable keyboard control
+        else:
+            if myself.follow_path () == 1:
+                myself.set_schedule ("keyboard_control")
+                self.close_gate ()
+                myself.go_east ()
+
+
+    # -- Opens the gate
+    def open_gate (self):
+        # Get the mapobjects
+        gate_fore = adonthell.gamedata_map_engine ().get_landmap 
().get_mapobject (90)
+        gate_back = adonthell.gamedata_map_engine ().get_landmap 
().get_mapobject (89)
+
+        # Only open the gate if it's closed...
+        if (gate_fore.get_animation (0).currentframe () == 0):
+            # Plays the gate back animation
+            gate_back.get_animation (0).next_frame ()
+            # Plays the gate fore animation
+            gate_fore.get_animation (0).next_frame ()
+
+            # Update squares walkability
+            sm = adonthell.gamedata_map_engine ().get_landmap ().get_submap (0)
+            sm.get_square (6, 17).set_walkable_south (0)
+            sm.get_square (7, 17).set_walkable_south (0)
+            sm.get_square (6, 18).set_walkable_west (1)
+            sm.get_square (6, 19).set_walkable_west (1)
+
+    # Close the gate
+    def close_gate (self):
+        # Get the mapobjects
+        gate_fore = adonthell.gamedata_map_engine ().get_landmap 
().get_mapobject (90)
+        gate_back = adonthell.gamedata_map_engine ().get_landmap 
().get_mapobject (89)
+
+        # Only close the gate if it's opened
+        if (gate_fore.get_animation (0).currentframe () == 4):
+            # Plays the gate back animation
+            gate_back.get_animation (0).next_frame ()
+            # Plays the gate fore animation
+            gate_fore.get_animation (0).next_frame ()
+
+            # Update squares walkability
+            sm = adonthell.gamedata_map_engine ().get_landmap ().get_submap (0)
+            sm.get_square (6, 17).set_walkable_south (1)
+            sm.get_square (7, 17).set_walkable_south (1)
+            sm.get_square (6, 18).set_walkable_west (0)
+            sm.get_square (6, 19).set_walkable_west (0)
+            sm.get_square (6, 20).set_walkable_west (0)



reply via email to

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