#Override ability special on items

1 messages · Page 1 of 1 (latest)

cold bluff
#

Any way I can replace ability special value on a passive item when applying a modifier to a hero? Because I tested GetModifierOverrideAbilitySpecial and it only triggers when a hero buys an item or puts it in their inventory I think. After the modifier wears off the ability special would return to normal value.

outer crane
#

you can refresh value manually with item:RefreshIntrinsicModifier()

#

but as i know items didn't update value in tooltip

cold bluff
#

That's fine

#

I'll try that, thanks

#

Yea idk where to call it

autumn stone
#

i believe you need to call OnUnequip and OnEquip (unintuitive naming, these are not events)
to simulate dropping the item and picking it back up to refresh the values.

if you just refresh the modifier it does not guarantee any value gets updated because the modifier would have to handle that in its OnRefresh function.

modest mauveBOT
cold bluff
#

oh I forgot about that yeah

#

do I have to set it back manually to normal value though?

#

or do I just call onequip after modifier wears off?

autumn stone
#

unequip and onequip whenever you want the values to be run through GetModifierOverrideAbilitySpecial

#

or when you want your modified value to be reset

cold bluff
#

Thanks

cold bluff
#

Where do I call onunequip and onequip to make this work though

#

i'm applying the modifier to attacker onattacklanded to modify crit value

#

oncreated doesnt work for first hit

autumn stone
#

crits are determined before the attack is launched, so you would have to modify it before the attack

cold bluff
#

damn

#

that's not gonna work for this

#

i want to recreate this item in dota

#

that's the problematic part

autumn stone
#

you may be able to do that from something like ontakedamage or similar functions. let me take a look

#

actually nvm, you wouldnt be able to do it accurately since there are some items that add damage directly to your attack (not as a separate instance of damage)

cold bluff
#

Yeah that's why I can't do it with math

autumn stone
#

if you rewrote every crit you could make it work :)

cold bluff
#

Wanted to give the attacker a modifier for 0.01 sec that would replace crit multiplier on all items by -30% but ig thats not gonna work

autumn stone
cold bluff
#

passive

autumn stone
#

you could have the modifier active all the time, and only reduce when the target owns that item

cold bluff
#

oh

autumn stone
#

but. im not sure if that would work, due to onunequip onequip probably not being instant

#

probably takes 1 frame

cold bluff
#

Nah it works

#

Ty

cold bluff
#

In case of abilities (like PA's ulti) how do I update them?

autumn stone
#

depends on the ability.
for pa crit, most likely you'd need to refresh the abilities intrinsic modifier.

usually for an active ability it will call GetSpecialValueFor every cast, in which case you would have nothing to "update". it would call it on its own.
for abilities that apply modifiers, most of them will have have OnRefresh functions set up to re-get the special values (for instances like leveling up the ability).
and im sure there are some cases that dont store the value and re-get it every single time its needed.

desert flare
#

I remember about a discussion to detect critical strike somewhere
maybe you can use that, and when it procs, give the crit unit a 30% outgoing damage reduction

autumn stone
#

That would affect proc's other than crits too i think.

Also that crit detection method supposedly has an issue where all fake attacks are considered crits.

desert flare
#

what kind of things would also procs other than actual crits and the fake attack issue?
as for fake attack, in this use case you can just filter attacks with >0 damage, then do the reduction

autumn stone
hushed fjord
#

crits are pre-damage => damage is always 0

autumn stone
#

and by other procs, i mean you could for example have something like javelin.
if you reduced the incoming damage when a crit is detected, and javelin also proc'd on that attack the javelin damage would be reduced too

hushed fjord
#

heres another potential big brain idea

#

target_criticalstrike might override the crit

#

replace the crit entirely by a different, smaller crit

autumn stone
#

is that like bloodthorn? i thought that stacked with crit damage.

#

or what item am i thinking of, where the target takes bonus damage from damage

desert flare
desert flare
autumn stone
#

javelin directly adds damage to your attack

#

not a separate instance of damage

desert flare
#

yes, but it is not a crit
because crit is when the red number appeared in doto

autumn stone
#

or what part of the damage is from other items like javelin

desert flare
# autumn stone but you dont know when its a crit

I thought the crit detection relies on the check if Crit Damage rolls in.
So you can know if an attack is gonna crit or not based from that, and get the attack record from it
from that attack record, you filter it after it lands

autumn stone
hushed fjord
#

javelin pierce, feast and similar damage is added to the damage

#

post-crit

desert flare
#
  1. OnAttackStart
  2. Check if the attack crit based on OnCritDamage and/or GetPreAttackCriticalStrike
  3. Store the attack_record number
  4. OnAttack
  5. OnAttackLanded
  6. ModifierOutgoingDamage
  7. check if attack_record is in the stored table and damage>0
  8. if they pass, return -30
hushed fjord
#

crit occurs, you register the attack record => javelin also procs dealing 80 flat damage
damage post crit is lets say 200, javelin adds 80 for 280 total; if we use outgoingdamage then you're reducing 280 to 196 instead of 220 with 30% crit reduction

#

its all one instance of attack damage

autumn stone
#

and if its a fake attack the crit detection modifier will say its a crit regardless of if it really is or not, resulting in all fake attacks also having reduced damage

hushed fjord
#

well thel atter isn't an issue with elfansoer's solution

#

and if the former is acceptable behavior its an ok solution

#

its probably a 'good enough' solution tbh

autumn stone
desert flare
hushed fjord
#

again the problem is these procs aren't separate instances

autumn stone
#

except they arent all separate instances.

hushed fjord
#

procattack is part of the attack damage calc

desert flare
#

does Crit damage included in original_damage key in ProcAttackFeedback/Magical/Physical?

hushed fjord
#

hmm, i'm not sure, depends where in the stack its called i guess

#

in theory yes? it triggers after all damage calcs

#

but idk if dota stores the calculated damage so far