[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[adonthell-wastesedge-commits] Release_0-3-1 9cb9bdd 048/237: Converted
From: |
Kai Sterker |
Subject: |
[adonthell-wastesedge-commits] Release_0-3-1 9cb9bdd 048/237: Converted Orloth to new pathfinding |
Date: |
Mon, 25 Jul 2016 18:14:56 +0000 (UTC) |
tag: Release_0-3-1
commit 9cb9bdd4502fe20eae1706182be5dacc0eaddda5
Author: adondev <adondev>
Commit: adondev <adondev>
Converted Orloth to new pathfinding
Slightly improved Talan
---
scripts/schedules/orloth.py | 92 +++++++++++++++++++++++--------------------
scripts/schedules/talan.py | 24 ++++++-----
2 files changed, 60 insertions(+), 56 deletions(-)
diff --git a/scripts/schedules/orloth.py b/scripts/schedules/orloth.py
index 5546265..95aab5c 100755
--- a/scripts/schedules/orloth.py
+++ b/scripts/schedules/orloth.py
@@ -15,9 +15,6 @@
# 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!"]
@@ -28,49 +25,58 @@ coords = [(3, 5, STAND_SOUTH), \
(7, 4, STAND_WEST), \
(10, 3, STAND_NORTH)]
-todo = myself.get_val ("wait_behind_bar")
+todo = myself.get_val ("todo")
-# -- leave the bar
+# -- waiting
if todo == 0:
- # -- get the position we want to reach
- goal = myself.get_val ("goal")
- x, y, dir = coords[goal]
+ delay = myself.get_val ("delay")
+
+ # -- If standing delay expired, move around next time
+ if delay == 0:
+ myself.set_val ("todo", 1)
+ else:
+ myself.set_val ("delay", delay - 1)
+
+# -- engage a new movement
+elif todo == 1:
+ from random import randint
- if schedules.simple_goto_xy (myself, x, y) == 1:
- # -- wait a little
- myself.set_val ("wait_behind_bar", -150)
+ # -- when we are at the bar, then wait a while before
+ # moving again
+ if myself.posx () == 2:
+ x, y, dir = coords[randint (0, 4)]
+ myself.set_goal (x, y, dir)
+ myself.set_val ("delay", 150)
- 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 ()
+ # -- otherwise only wait a little
+ else:
+ delay = randint (40, 120) * 20
+ myself.set_val ("delay", delay)
+ myself.set_goal (2, 2, STAND_SOUTH)
+ myself.set_val ("todo", 2)
+
+# -- moving
+elif todo == 2:
+ if myself.follow_path () == 1:
# -- standing in front of the clock
- if goal == 4:
- schedules.speak (myself, "That clock is late again!")
-
-
-# -- stand still
-elif todo < 0:
- myself.set_val ("wait_behind_bar", todo + 1)
- if todo == -1:
- # -- calculate the next move
- delay = random.randint (40, 120) * 20
- myself.set_val ("wait_behind_bar", delay)
- myself.set_val ("goal", random.randint (0, 4))
-
-# -- go to/stay behind bar
-else:
- myself.set_val ("wait_behind_bar", todo - 1)
-
- # -- reached the bar
- if schedules.simple_goto_xy (myself, 2, 2) == 1:
- myself.stand_south ()
-
- # -- utter a random remark
- 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 (50, 150) * 20
- myself.set_val ("say_something", delay)
+ if myself.posx () == 10:
+ from schedules import speak
+ speak (myself, "That clock is late again!")
+
+ tmp = myself.get_val ("say_something")
+ myself.set_val ("say_something", tmp + 75)
+
+ myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp == 0:
+ from schedules import speak
+ from random import randint
+
+ speak (myself, speech[randint (0, 2)])
+ delay = randint (50, 150) * 20
+ myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/talan.py b/scripts/schedules/talan.py
index a5d5aa3..de05ee2 100755
--- a/scripts/schedules/talan.py
+++ b/scripts/schedules/talan.py
@@ -29,29 +29,27 @@ if todo == 0:
else:
myself.set_val ("delay", delay - 1)
-# Moving, follow the path until it is reached.
-elif todo == 2:
- # Reached the goal? Wait a while then...
- if myself.follow_path ():
- if myself.posy () == 17: myself.stand_south ()
- else: myself.stand_north ()
- import random
- myself.set_val ("delay", random.randint (25, 50) * 20)
- myself.set_val ("todo", 0)
-
-
# Engage a new movement
elif todo == 1:
# Choose where to move, if destination is already occupied we'll
# fall into the wait state (0) again automatically next time
if myself.posy () == 17:
- myself.set_goal (11, 20)
+ myself.set_goal (11, 20, STAND_NORTH)
else:
- myself.set_goal (11, 17)
+ myself.set_goal (11, 17, STAND_SOUTH)
# Next time we'll actually move!
myself.set_val ("todo", 2)
+# Moving, follow the path until it is reached.
+elif todo == 2:
+ # Reached the goal? Wait a while then...
+ if myself.follow_path ():
+ import random
+ myself.set_val ("delay", random.randint (25, 50) * 20)
+ myself.set_val ("todo", 0)
+
+
# -- utter a random remark
tmp = myself.get_val ("say_something")
myself.set_val ("say_something", tmp - 1)
- [adonthell-wastesedge-commits] Release_0-3-1 8b0c1e0 042/237: Slight fix to Alek's dialogue, (continued)
- [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
- [adonthell-wastesedge-commits] Release_0-3-1 c6dcf69 044/237: Using pathfinding methods for Talan schedule., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 9cb9bdd 048/237: Converted Orloth to new pathfinding,
Kai Sterker <=
- [adonthell-wastesedge-commits] Release_0-3-1 22178ae 058/237: Map gets only updated if the main_menu or data_screen aren't displayed., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 51e5413 051/237: Updated frostbloom and sarin to new pathfinding code, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 d304dc6 069/237: Updated Orloth's and Erek's dialogue, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 842c4b9 076/237: Oops! Forgot this file., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 4bcc0dd 066/237: FIXED bugs in automake, silverhair's room connection script and, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 5719e8c 078/237: Updated Silverhair's bed., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 aad3c95 098/237: Fixed missing installation target, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 feeadbf 099/237: FIXED data installation, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 4330c0d 053/237: Removed in-game imports, which are now done at init time., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 177b48f 060/237: Changed map - it now has a member to prevent NPCs to be accidentally, Kai Sterker, 2016/07/25