Summoners occasionaly get stuck with summoner as target
Posted: Thu Sep 30, 2010 3:54 pm
Many summoners have died to bring us this information....
Following my discussion in the general thread I went ahead and dug into the code. I still have no idea why this was more prevalent in the Sand Worm Lair than anywhere else that I've been. When a summoned creature doesn't find a target it sets its target to the summoner in order to follow it. Now when a new target comes along there is some small chance that the summoned creature can ditch its target, otherwise it keeps the same target. When the target is the summoner this causes a problem because the summoned creature will then just follow you around instead of attacking. It could be that the line of sight craziness in the sand lair just highlights the problem more than other places. I'm not sure if this is the best way to fix since I don't know all the code but I added one line the following to game/modules/tome/ai/summon.lua:
The first actual line of code is the one I added (sorry, I don't have it checked out so I can submit a patch, just the files that I have for playing the game) which sets the target to nothing if the summoned creature has me as a target, forcing "target_simple" to choose a new hostile target if available.
Following my discussion in the general thread I went ahead and dug into the code. I still have no idea why this was more prevalent in the Sand Worm Lair than anywhere else that I've been. When a summoned creature doesn't find a target it sets its target to the summoner in order to follow it. Now when a new target comes along there is some small chance that the summoned creature can ditch its target, otherwise it keeps the same target. When the target is the summoner this causes a problem because the summoned creature will then just follow you around instead of attacking. It could be that the line of sight craziness in the sand lair just highlights the problem more than other places. I'm not sure if this is the best way to fix since I don't know all the code but I added one line the following to game/modules/tome/ai/summon.lua:
Code: Select all
-- Do the normal AI, otherwise follows summoner
if self.ai_target.actor == self.summoner then self.ai_target.actor = nil end
if self:runAI("target_simple") then
return self:runAI(self.ai_real)
else
self.ai_target.actor = self.summoner
local ret = self:runAI(self.ai_real)
self.ai_target.actor = nil
return ret
end