• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Hero switch - issues with auras still here 1-2s after teleport

Status
Not open for further replies.
Level 12
Joined
Feb 27, 2019
Messages
399
Hello,

In my map (Hero Defense type) there is a mod where each player has 2 heroes but can only play once at a time. All the second heroes are paused & teleported to an out-of-range area. Whenever he want, the player can switch between heroes by selecting the 2nd one (click on portrait or F2) : the 2nd hero is unpaused & teleported at the current position, and the 1st hero is paused and teleported in the out-of-range area.

My issue is that just after hero switch, the hero still have auras during 1-2s from when it was paused in the out-of-rang area (due to the other heroes around). So for ex if there is a +200% damage aura, it can be exploited by switching permanently of hero.

I want to remove those auras on switching heroes, or find a way so they don't get it at all in the out-of-range area where they are paused.

My constraints are:
- I've ~25 aura buffs in my map so I'd like to avoid to try to remove them all 1 by 1.
- I'd like to keep the paused 2nd hero alive & visible (so his portrait is visible too).
- I'd like not to loose all other buffs (morphing, regeneration, frozen armor, etc...)
 
Level 6
Joined
Mar 7, 2011
Messages
124
the best part of GUI is that you can explore similar options very easily. the documentation is built in

  • Actions
    • Unit - Remove All buffs from (Triggering unit)
    • Unit - Remove All buffs considered Magic or physical from (Triggering unit) (Include expiration timers, Include auras)
    • Unit - Remove Aerial Shackles buff from (Triggering unit)
Uncle's suggestion is better, unless you actively want the auras to show up, because it prevents the auras from ever being active on the unit in the first place. its better to prevent an invalid state from occurring than to fix it after it becomes problematic
 
Level 12
Joined
Feb 27, 2019
Messages
399
the best part of GUI is that you can explore similar options very easily. the documentation is built in

  • Actions
    • Unit - Remove All buffs from (Triggering unit)
    • Unit - Remove All buffs considered Magic or physical from (Triggering unit) (Include expiration timers, Include auras)
    • Unit - Remove Aerial Shackles buff from (Triggering unit)
Uncle's suggestion is better, unless you actively want the auras to show up, because it prevents the auras from ever being active on the unit in the first place. its better to prevent an invalid state from occurring than to fix it after it becomes problematic

Unfortunately none of those functions allow to remove only aura buffs. Or I don't know what setting is necessary. Ofc I've already seen them before asking on hive. I don't want them to remove buffs like (Frozen Armor, Bloodlust, ...).

Also if I remove all aura buffs I notice there will be an issue : they will need 1-2s to pop again if the unit is the aura source. It's an issue because if the unit looses its +100armor from devotion aura during 2s it dies^^

So the best would be able to stop the stop the aura skills from affecting others in the out-of-range area. However, i don't see any other solution than:
- Make it polymorphed, burrowed, invisible, illusion, animate deads, flying hero (since those don't bestow aura if game constants are untouched)
 
Level 6
Joined
Mar 7, 2011
Messages
124
the documentation goes past GUI. did you already check their JASS equivalents?

this is what the GUI function relies on
JASS:
function UnitRemoveBuffsBJ takes integer buffType, unit whichUnit returns nothing
    if (buffType == bj_REMOVEBUFFS_POSITIVE) then
        call UnitRemoveBuffs(whichUnit, true, false)
    elseif (buffType == bj_REMOVEBUFFS_NEGATIVE) then
        call UnitRemoveBuffs(whichUnit, false, true)
    elseif (buffType == bj_REMOVEBUFFS_ALL) then
        call UnitRemoveBuffs(whichUnit, true, true)
    elseif (buffType == bj_REMOVEBUFFS_NONTLIFE) then
        call UnitRemoveBuffsEx(whichUnit, true, true, false, false, false, true, false)
    else
       // Unrecognized dispel type - ignore the request.
    endif
endfunction

UnitRemoveBuffsEx seems like what you want?
native UnitRemoveBuffsEx takes unit whichUnit, boolean removePositive, boolean removeNegative, boolean magic, boolean physical, boolean timedLife, boolean aura, boolean autoDispel returns nothing
 
Level 12
Joined
Feb 27, 2019
Messages
399
the documentation goes past GUI. did you already check their JASS equivalents?

this is what the GUI function relies on
JASS:
function UnitRemoveBuffsBJ takes integer buffType, unit whichUnit returns nothing
    if (buffType == bj_REMOVEBUFFS_POSITIVE) then
        call UnitRemoveBuffs(whichUnit, true, false)
    elseif (buffType == bj_REMOVEBUFFS_NEGATIVE) then
        call UnitRemoveBuffs(whichUnit, false, true)
    elseif (buffType == bj_REMOVEBUFFS_ALL) then
        call UnitRemoveBuffs(whichUnit, true, true)
    elseif (buffType == bj_REMOVEBUFFS_NONTLIFE) then
        call UnitRemoveBuffsEx(whichUnit, true, true, false, false, false, true, false)
    else
       // Unrecognized dispel type - ignore the request.
    endif
endfunction

UnitRemoveBuffsEx seems like what you want?
native UnitRemoveBuffsEx takes unit whichUnit, boolean removePositive, boolean removeNegative, boolean magic, boolean physical, boolean timedLife, boolean aura, boolean autoDispel returns nothing

I tested it. It removes all buffs by default (and you can filter out positive, negative, physical, magical, aura, timed life). You cannot do the opposite : just remove aura buffs.
 
Level 6
Joined
Mar 7, 2011
Messages
124
when you remove an aura buff specifically (
unit.gif
Unit - Remove specific buff from Your_Hero) does it stay off?

i feel like this might be weirdly hard to do, because technically the auras are working as they should, it's just not lining up with our needs. here's a few questions that might help us force this direction

1. even if we remove the aura buff, can we have control over it being reapplied?
2. at what point is the aura being shared? we don't really know the state that caused the aura to be shared in the first place. we've been assuming that it's shared in the out-of-range area, but it could be that the aura lingers behind the unit's position and its actually being shared in the fight area

i think you should get some more info if you want to try to keep pushing on the current implementation exactly how you want it now

for the first topic, try printing the number of buffs on a unit affected by another unit's aura before and after call UnitRemoveBuffsEx(yourUnit, false, false, false, false, false, true, false). even if it doesn't ever look like it was removed, it may have been removed but immediately reapplied
for the second topic, try moving one of the units to a totally different temporary location so that the two units are never in the same location at the same line of execution. i think auras are applied on their own clock, but it could be calling SetUnitPosition immediately applies auras based on the new location

alternatively, what do you think about either giving the swapped out hero to a neutral player for 3-5 seconds after the swap? then you give the hero back to the original player allowing them to swap again. this might be enough buffer to deal with any aura lingering. id guess that the aura will only ever be applied to allies of its owner, no matter when/where it runs. if giving the hero to another player doesnt work id try hiding the hero just in case
 
Level 12
Joined
Feb 27, 2019
Messages
399
Indeed the discrimination between desired & undesired buff is complicated. Indeed I'm not clear if I should remove some buffs when a hero is swapped (stun, poison, auras...) or not.

And it seems one cannot customize the aura refresh times.

In my case, hero swap is instantate so it's complicated to give it to another player for a shorttime.

Well I don't think there is a clean solution. I'll try to find a workaround just to avoid the exploit of those auras in my map..
 
Status
Not open for further replies.
Top