Adding a bit more info to the Escort Quest description

All new ideas for the upcoming releases of ToME 4.x.x should be discussed here

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Adding a bit more info to the Escort Quest description

#1 Post by yufra »

I thought it would be fun to have a more detailed record of the escort quest outcomes that show up in-game and in character dumps, so here is a patch. :D The failed quests now show the name of the NPC that struck the killing blow, and success also shows the reward that was chosen.

Code: Select all

Index: data/quests/escort-duty.lua
===================================================================
--- data/quests/escort-duty.lua	(revision 1164)
+++ data/quests/escort-duty.lua	(working copy)
@@ -241,7 +241,16 @@
 name = ""
 desc = function(self, who)
 	local desc = {}
-	desc[#desc+1] = "Escort the "..self.kind.name.." to the recall portal on level "..self.level_name.."."
+	if self:isStatus(engine.Quest.DONE) then
+		desc[#desc+1] = "You successfully escorted the "..self.kind.name.." to the recall portal on level "..self.level_name.."."
+		if self.reward_message then
+			desc[#desc+1] = ("As a reward you %s."):format(self.reward_message)
+		end
+	elseif self:isStatus(engine.Quest.FAILED) then
+		desc[#desc+1] = "You failed to protect the "..self.kind.name.." from death by "..self.killing_npc.."."
+	else
+		desc[#desc+1] = "Escort the "..self.kind.name.." to the recall portal on level "..self.level_name.."."
+	end
 	return table.concat(desc, "\n")
 end
 
@@ -291,6 +300,7 @@
 	self.kind.actor.on_die = function(self, who)
 		game.logPlayer(game.player, "#LIGHT_RED#%s is dead, quest failed!", self.name:capitalize())
 		game.player:setQuestStatus(self.quest_id, engine.Quest.FAILED)
+		game.player:hasQuest(self.quest_id).killing_npc = who.name
 	end
 
 	-- Spawn actor
Index: data/chats/escort-quest.lua
===================================================================
--- data/chats/escort-quest.lua	(revision 1164)
+++ data/chats/escort-quest.lua	(working copy)
@@ -130,7 +130,11 @@
 	local answers = {}
 	if reward.stats then
 		for i = 1, #npc.stats_def do if reward.stats[i] then
-			local doit = function(npc, player) player.inc_stats[i] = (player.inc_stats[i] or 0) + reward.stats[i]; player.changed = true end
+			local doit = function(npc, player)
+				player.inc_stats[i] = (player.inc_stats[i] or 0) + reward.stats[i]
+				player.changed = true
+				player:hasQuest(npc.quest_id).reward_message = ("improved %s by +%d"):format(npc.stats_def[i].name, reward.stats[i])
+			end
 			answers[#answers+1] = {("[Improve %s by +%d]"):format(npc.stats_def[i].name, reward.stats[i]), jump="done", action=doit}
 		end end
 	end
@@ -142,6 +146,7 @@
 				local doit = function(npc, player)
 					player:learnTalent(tid, true, level)
 					if t.hide then player.__show_special_talents[tid] = true end
+					player:hasQuest(npc.quest_id).reward_message = ("%s talent %s (+%d level(s))"):format(game.player:knowTalent(tid) and "improved" or "learnt", t.name, level)
 				end
 				answers[#answers+1] = {("[%s talent %s (+%d level(s))]"):format(game.player:knowTalent(tid) and "Improve" or "Learn", t.name, level), jump="done", action=doit}
 			end
@@ -153,6 +158,7 @@
 			local doit = function(npc, player)
 				player:learnTalentType(tt, false)
 				player:setTalentTypeMastery(tt, mastery)
+				player:hasQuest(npc.quest_id).reward_message = ("gained talent category %s (at mastery %0.2f)"):format(cat:capitalize().." / "..tt_def.name:capitalize(), mastery)
 			end
 			local cat = tt_def.type:gsub("/.*", "")
 			answers[#answers+1] = {("[Allow training of talent category %s (at mastery %0.2f)]"):format(cat:capitalize().." / "..tt_def.name:capitalize(), mastery), jump="done", action=doit}

<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Adding a bit more info to the Escort Quest description

#2 Post by darkgod »

Good idea thanks (BTW post your patches as attachement, copy/pasting them destroys them)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply