Page 1 of 1

Archer npcs

Posted: Thu Aug 26, 2010 6:27 pm
by Shoob
They continue to shoot (nothing) when they are out of ammo, that is, they will try shooting (and it says they shoot), but then because they are out of ammo, they move instead.

(note the following is only somewhat related to this bug, it happened before I saw the bug)

I found this out because I was going against a hill orc archer with a bow of either speed or great speed. In this matrix-style battle he was too far away to effectively hit me, so I was just having fun dodging bullets (errrr.... arrows ;)).

Image

http://www.youtube.com/watch?v=DIJKmvkyYTg

Re: Archer npcs

Posted: Thu Aug 26, 2010 9:46 pm
by yufra
Hmmm, I think the problem is that there is currently no mechanism for a talent to tell Actor:preUseTalent to fail. Maybe we should add a preuse function to talents, and code to check it in Actor:preUseTalent? For example:

Code: Select all

archery.lua
newTalent{
	name = "Shoot",
...
	preuse = function(self, t)
		return self:hasArcheryWeapon()
	end,
...
}

Actor.lua
function _M:preUseTalent(ab, silent, fake)
...
	if ab.preuse then
		ok, message = ab.preuse(self, ab)
		if not ok then
			game.logPlayer(self, message)
			return false
		end
	end
...
end