Skip to content
Snippets Groups Projects
Commit 1023ad7c authored by dg's avatar dg
Browse files

NPCs will "transfer" their targets to their friends in sight if they do not...

NPCs will "transfer" their targets to their friends in sight if they do not have a target themselves


git-svn-id: http://svn.net-core.org/repos/t-engine4@1046 51575b47-30f0-44d4-a5cc-537603b46e54
parent 5cc32968
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ newAI("move_dmap", function(self)
if self:hasLOS(a.x, a.y) then return self:runAI("move_simple") end
local c = a:distanceMap(self.x, self.y)
if not c then return end
if not c then return self:runAI("move_simple") end
local dir = 5
for i = 1, 9 do
local sx, sy = util.coordAddDir(self.x, self.y, i)
......
......@@ -52,6 +52,16 @@ function _M:act()
if not self.energy.used then self:useEnergy() end
end
--- Give target to others
function _M:seen_by(who)
if self.ai_target.actor then return end
if not who.ai_target then return end
if not who.ai_target.actor then return end
if self:reactionToward(who) < 0 then return end
if not who:canSee(who.ai_target.actor) then return end
self:setTarget(who.ai_target.actor)
end
--- Called by ActorLife interface
-- We use it to pass aggression values to the AIs
function _M:onTakeHit(value, src)
......
......@@ -24,7 +24,7 @@ desc = function(self, who)
desc[#desc+1] = "It is time to explore some new places dark, forgotten and dangerous ones."
desc[#desc+1] = "The Old Forest is just south-west of the town of Bree."
desc[#desc+1] = "The Maze is west of Bree."
desc[#desc+1] = "The Sandworm is to the far west of Bree, near the sea."
desc[#desc+1] = "The Sandworm Lair is to the far west of Bree, near the sea."
desc[#desc+1] = "Carn Dûm is to the north of Amon Sûl."
if self:isCompleted("old-forest") then
desc[#desc+1] = "#LIGHT_GREEN#* You have explored the Old Forest and vanquished the Old Man Willow.#WHITE#"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment