Archer npcs

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Shoob
Reaper
Posts: 1535
Joined: Mon Jan 22, 2007 6:31 pm
Location: East of the sun, west of the moon

Archer npcs

#1 Post 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
Oliphant am I, and I never lie.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Archer npcs

#2 Post 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
<DarkGod> lets say it's intended

Post Reply