Jump to content

Some area attacks can originate from the target instead of the attacker


hoxi
  • Pending

Due to the aoe search coordinates being based on whatever gets sent as target (which the search will also omit from dealing damage):

function Combat:DoAreaAttack(target, range, weapon, validfn, stimuli, excludetags)
    local hitcount = 0
    local x, y, z = target.Transform:GetWorldPosition()
    local ents = TheSim:FindEntities(x, y, z, range, AREAATTACK_MUST_TAGS, excludetags)

 

Anything calling DoAreaAttack externally is fine, those always use the attacking entity. This only happens when doing standard attacks with Combat:DoAttack, with area attacks enabled, and not missing the standard attack:

if self.areahitrange ~= nil and not self.areahitdisabled then
    self:DoAreaAttack(targ, self.areahitrange, weapon, self.areahitcheck, stimuli, AREA_EXCLUDE_TAGS)
end

targ in the bit above should be projectile or self.inst to match the behavior of when an attack misses the current target (if the intention is to support projectiles that use Combat:DoAttack to project the area hit from their position), as shown below:

if not self:CanHitTarget(targ, weapon) or self.AOEarc then
    self.inst:PushEvent("onmissother", { target = targ, weapon = weapon })
    if self.areahitrange ~= nil and not self.areahitdisabled then
        self:DoAreaAttack(projectile or self.inst, self.areahitrange, weapon, self.areahitcheck, stimuli, AREA_EXCLUDE_TAGS)
    end
    self:ClearAttackTemps()
    return
end

 

The problem though is that whatever gets sent as target does get omitted by the search, and this needs to carry over to prevent a double hit on the target. You might want to send a target as usual (change the parameter name to origin_inst or something to avoid confusion), but also send an ignore_targets parameter (could be a lookup table), or you could use hacky temporary variables like self.temppos or so.


Steps to Reproduce

Here's an example to test it and reproduce the issue:

Fuelweaver is supposed to have a rather small aoe around him, and longer range against whoever's he's focusing. However, due to this bug, if he lands a hit, the aoe will originate from the target hit, which is unintuitive and weird and can lead to someone further away (even further than the standard hit range he has) to get hit.

Note: this example applies to the basic skull attack, not the snare or bone spike summoning, those use area attacks properly by calling DoAreaAttack externally, instead of DoAttack.

  • Like 3



User Feedback


Oh I think it's simple, a good chunk of the playerbase plays on their own, and if not, it could've been chalked up to latency, which is already a major issue in this game. Plus there's not that many entities that make use of this, and in the case of Fuelweaver, you don't wanna use followers since they'll get scared every 3 seconds (plus a few bosses like to focus players more even if attacked by npcs sometimes, so if anything, they'll be the ones to suffer).

Edited by hoxi
  • Like 1

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...