[1.0] autocast doesn't work properly for slingers

Where bugs go to lie down and rest

Moderator: Moderator

Message
Author
jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

[1.0] autocast doesn't work properly for slingers

#1 Post by jenx »

I have Shoot, Steady Shot, Pinning Shot, and Blind Shot on autocast when enemies are visible. Only Pinning Shot and Shoot ever fire. Steady shot and Blind Shot never fire.

On the screen you see

X uses Eye Shot
X uses Steady Shot
X uses Pinning Shot
X shoots!

Clearly, only one of these is working.
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#2 Post by jenx »

will this be fixed for the next release?
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#3 Post by jenx »

What's worse, under certain circumstances, even steady shot plus regular shoot doesn't work, with only regular shoot being activated. I suspect this might be with steady slings, but I"m not entirely sure.

I hope this can be fixed soon.
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#4 Post by jenx »

The log says this:

[LOG] Criat uses Steady Shot.
[ARCHERY ACQUIRE TARGETS WITH] steady cured leather sling of power high-capacity pouch of dwarven-steel shots of annihilation
[PROJECTILE SPEED] :: 12
[LOG] Criat shoots!
[ARCHERY ACQUIRE TARGETS WITH] steady cured leather sling of power high-capacity pouch of dwarven-steel shots of annihilation
[PROJECTILE SPEED] :: 12

This makes me think, based on Archery.lua, that Steady Shoot fails here because it can't find a target. Why this sometimes happens, though, is beyond me.

Code: Select all

	print("[PROJECTILE SPEED] ::", tg.speed)
	local x, y = self:getTarget(tg)
	if not x or not y then return nil end
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#5 Post by jenx »

jenx wrote:What's worse, under certain circumstances, even steady shot plus regular shoot doesn't work, with only regular shoot being activated. I suspect this might be with steady slings, but I"m not entirely sure.

I hope this can be fixed soon.
This is happening again for my latest character. It is a real pain. I have tried debugging it but I can't figure it out. Any help DG?
MADNESS rocks

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: [1.0] autocast doesn't work properly for slingers

#6 Post by aardvark »

The automaticTalents() function looks like it just fires the first currently usable auto-use talent that pairs() returns.

Code: Select all

function _M:automaticTalents()
	for tid, c in pairs(self.talents_auto) do
		local t = self.talents_def[tid]
		local spotted = spotHostiles(self)
		if (t.mode ~= "sustained" or not self.sustain_talents[tid]) and not self.talents_cd[tid] and self:preUseTalent(t, true, true) and (not t.auto_use_check or t.auto_use_check(self, t)) then
...
The unordered pairs() iterator is likely returning Pinning Shot, then Shoot, then would return whatever comes next except that Shoot has no cooldown. It's effectively blocking the other talents in the table from ever firing. The simple (probably undesirable) solution would be taking Shoot off of auto-use and using it manually when your other auto-use talents are cooling down. A longer term solution might be talent prioritization for the auto-use feature.

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#7 Post by jenx »

aardvark wrote:The automaticTalents() function looks like it just fires the first currently usable auto-use talent that pairs() returns.

Code: Select all

function _M:automaticTalents()
	for tid, c in pairs(self.talents_auto) do
		local t = self.talents_def[tid]
		local spotted = spotHostiles(self)
		if (t.mode ~= "sustained" or not self.sustain_talents[tid]) and not self.talents_cd[tid] and self:preUseTalent(t, true, true) and (not t.auto_use_check or t.auto_use_check(self, t)) then
...
The unordered pairs() iterator is likely returning Pinning Shot, then Shoot, then would return whatever comes next except that Shoot has no cooldown. It's effectively blocking the other talents in the table from ever firing. The simple (probably undesirable) solution would be taking Shoot off of auto-use and using it manually when your other auto-use talents are cooling down. A longer term solution might be talent prioritization for the auto-use feature.

This sounds like we're getting closer to the problem/solution. Would this explain though why the screen says X uses Steady Shot. X Uses Pinning Shot. X shoots!, even though only Shoot actually occurs. That is, the talent is being called with self:useTalent(tid) but then returning without activating.

This makes me think that the error might instead be in:

--- Make the actor use the talent
function _M:useTalent(id, who, force_level, ignore_cd, force_target, silent) ...

Or am I barking up the wrong tree?
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#8 Post by jenx »

Ok, I was right about useTalent() being the problem, in ActorTalents()

I added this to the code:

Code: Select all

--- Make the actor use the talent
function _M:useTalent(id, who, force_level, ignore_cd, force_target, silent)
	who = who or self
	local ab = _M.talents_def[id]
	assert(ab, "trying to cast talent "..tostring(id).." but it is not defined")

	print("[jenx TEST]", id, who, force_level, ignore_cd, force_target, silent )

	if ab.mode == "activated" and ab.action then
		if self:isTalentCoolingDown(ab) and not ignore_cd then
			game.logPlayer(who, "%s is still on cooldown for %d turns.", ab.name:capitalize(), self.talents_cd[ab.id])
			return
		end
And then added eye shot, steady shot, crippling shot, and shoot to auto talents.

Eye shot is called, but aborts before completion. here is the log:

[jenx TEST] T_EYE_SHOT table: 0x0aad4478 nil nil nil nil
[ARCHERY ACQUIRE TARGETS WITH] rough leather sling pouch of iron shots
[PROJECTILE SPEED] :: 10
[jenx TEST] T_SHOOT table: 0x0aad4478 nil nil nil nil
[LOG] Arityawn shoots!
[ARCHERY ACQUIRE TARGETS WITH] rough leather sling pouch of iron shots
[PROJECTILE SPEED] :: 10
[jenx TEST] T_STEADY_SHOT table: 0x0aad4478 nil nil nil nil
[LOG] Arityawn uses Steady Shot.
[ARCHERY ACQUIRE TARGETS WITH] rough leather sling pouch of iron shots
[PROJECTILE SPEED] :: 10
[LOG]


Notice that it stops at [PROJECTILE SPEED].

If we then check Archery.lua, we see these lines there:

Code: Select all

	print("[PROJECTILE SPEED] ::", tg.speed)
local x, y = self:getTarget(tg)
if not x or not y then return nil end
Could it be then that the problem is in the getTarget(tg) code at this point? It somehow doesn't send back x or y?
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#9 Post by jenx »

jenx wrote:...

If we then check Archery.lua, we see these lines there:

Code: Select all

	print("[PROJECTILE SPEED] ::", tg.speed)
local x, y = self:getTarget(tg)
if not x or not y then return nil end
Could it be then that the problem is in the getTarget(tg) code at this point? It somehow doesn't send back x or y?
Now that's weird.

I added a line above AFTER local x,y =... that simply logs x,y, tg to the log, but when a talent is skipped, it never prints.

Which means the problems possibly lies within getTarget(), which in turn calls (when not in ice) targetGetForPlayer(typ). This is located in GameTargeting.lua. I shall now investigate this routine to see if i can get to the bottom of this.
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#10 Post by jenx »

ok, I think I have found the problem, but I have no idea how to solve it. I hope this investigative work helps DG or someone else.

getTarget calls targetGetForPlayer, in GameTargeting.lua
I added a log line:

Code: Select all

--- Player requests a target
-- This method should be called by your Player:getTarget() method, it will handle everything
-- @param typ the targeting parameters
function _M:targetGetForPlayer(typ)
	print("[jenx TEST targetGetForPlayer]",typ,self.target.target.x, self.target.target.y, self.target.target.entity)
	if self.target.forced then return unpack(self.target.forced) end
	if coroutine.running() and typ then
		local msg
		self.target_no_star_scan = nil
		if type(typ) == "string" then msg, typ = typ, nil
		elseif type(typ) == "table" then
			if typ.default_target then
				self.target.target.entity = typ.default_target
				self.target_no_star_scan = true
			end
			msg = typ.msg
		end
		self:targetMode("exclusive", msg, coroutine.running(), typ)
		if typ.immediate_keys then self.target_style = "immediate" end
		if typ.nolock then self.target_style = "free" end
		if typ.nowarning then self.target_warning = false end
		return coroutine.yield()
	end
	return self.target.target.x, self.target.target.y, self.target.target.entity
end
I did some simple logging showed that for the talents that don't fire, this is returning nil for these three values. This somehow causes the routine that called it to jump out of where it is and to the next automatic talent.

Here is the log, trying to use Eye, Steday, Pinning Shots on auto:

[LOG] Arityawn uses Eye Shot.
[ARCHERY ACQUIRE TARGETS WITH] rough leather sling pouch of iron shots
[PROJECTILE SPEED] :: 10
[jenx TEST targetGetForPlayer] table: 0x0c77d098 nil nil false
[jenx TEST useTalent function data] T_SHOOT table: 0x0a8065a0 nil nil nil nil
[jenx TEST useTalent ab data] activated function: 0x08c3c118 nil nil
[jenx TEST targetGetForPlayer] nil 22 11 table: 0x0a9c6b38
[LOG] Arityawn shoots!
[ARCHERY ACQUIRE TARGETS WITH] rough leather sling pouch of iron shots
[PROJECTILE SPEED] :: 10
[jenx TEST targetGetForPlayer] table: 0x0c7581d0 22 11 table: 0x0a9c6b38
[jenx TEST useTalent function data] T_STEADY_SHOT table: 0x0a8065a0 nil nil nil nil
[jenx TEST useTalent ab data] activated function: 0x08c3fc48 nil nil
[LOG] Arityawn uses Steady Shot.
[ARCHERY ACQUIRE TARGETS WITH] rough leather sling pouch of iron shots
[PROJECTILE SPEED] :: 10
[jenx TEST targetGetForPlayer] table: 0x0c7b53f8 22 11 table: 0x0a9c6b38
[LOG]
[LOG] #UID:1521:0#Dire wolf hits Arityawn for #aaaaaa#8 physical#LAST# damage.
MADNESS rocks

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: [1.0] autocast doesn't work properly for slingers

#11 Post by aardvark »

The reason it doesn't say you're shooting when talents other than Shoot are triggered is because "@Source@ shoots!" is the message text for Shoot. It's a Shoot talent specific message. The other talents are working but not logging specific messages. Try adding

Code: Select all

	message = "@Source@ steady shoots!",
etc. lines into the other archery talents (data/talents/techniques/archery.lua) to test this.

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#12 Post by jenx »

But the other talents never go on cooldown and the log clearly shows that they are not completing. I haven't edited the log, it literally drops out of the archery projectile function at the line when it calls get Target.
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#13 Post by jenx »

Any progress anyone?
MADNESS rocks

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: [1.0] autocast doesn't work properly for slingers

#14 Post by aardvark »

It would help if you included a blow by blow account of what you did to generate the log you've posted. Your claim that, for example, Shoot works fine is hard to verify when the log is missing the line that begins

Code: Select all

[SHOOT] speed
It's line produced by archeryAcquireTargets() (on Archery.lua line 105 in v1.0) and is added when any archery talent successfully finds a target. Your Eye Shot and Shoot talents, which you claim work, aren't producing the line that says they do. Are you hitting escape to cancel them when they go into targeting mode?

Additionally, your log includes some "jenx TEST" lines without the source to demonstrate where they're being called. It's impossible to follow the program's control flow without such information. You assert that the log "clearly shows that they are not completing," but that's not clear to me at all. The "jenx TEST" line you've inserted into targetGetForPlayer(), for example, is at the top of the function call rather than near any return statement. It's impossible to determine that the function isn't finishing, let alone why it wouldn't.

Replicating the problem is just not possible without information on exactly what you're doing to trigger it and you've not provided enough information to help troubleshoot your problem remotely.

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0] autocast doesn't work properly for slingers

#15 Post by jenx »

aardvark wrote:It would help if you included a blow by blow account of what you did to generate the log you've posted. Your claim that, for example, Shoot works fine is hard to verify when the log is missing the line that begins

Code: Select all

[SHOOT] speed
It's line produced by archeryAcquireTargets() (on Archery.lua line 105 in v1.0) and is added when any archery talent successfully finds a target. Your Eye Shot and Shoot talents, which you claim work, aren't producing the line that says they do. Are you hitting escape to cancel them when they go into targeting mode?

Additionally, your log includes some "jenx TEST" lines without the source to demonstrate where they're being called. It's impossible to follow the program's control flow without such information. You assert that the log "clearly shows that they are not completing," but that's not clear to me at all. The "jenx TEST" line you've inserted into targetGetForPlayer(), for example, is at the top of the function call rather than near any return statement. It's impossible to determine that the function isn't finishing, let alone why it wouldn't.

Replicating the problem is just not possible without information on exactly what you're doing to trigger it and you've not provided enough information to help troubleshoot your problem remotely.
I'm not hitting escape. I tried adding as much info as I could in my snippets above, but I don't understand lua enough, or how tome works enough to provide any more info.

I'll try to explain it again in summary form:

The problem happens when you set more TWO OR MORE archery talents OTHER THAN Shoot (e.g. Steady Shot, Eye Shot), AND you set plain Shoot, AND all of these talents (e.g. Steady, Eye, Shoot) to the setting "Auto-use when enemies are visible". With many characters, but not all, this results in one or more of the non Shoot talents not triggering. Yet they appear on screen "X uses STeday Shot" "X uses Eye Shot", but the talent is not actually used, as is clear from the cooldown NEVER triggering, and the talent effects never occuring.

By examining the log file, it seems to me that the problem is in the targetting somehow.

I'm sorry I can't be of more help.
MADNESS rocks

Post Reply