• 🏆 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!

Spirit Link Does Not Work With Modern DDS

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
The problem lies here

JASS:
                    /*
                    *   Calculate spell resistance
                    */
                    call DisableTrigger(RefreshTrigger(targetId_p).parent.trigger)
                    
                        set life = GetWidgetLife(u)
                        set scale = GetUnitState(u, UNIT_STATE_MAX_LIFE)
                        call SetWidgetLife(u, scale)
                        call UnitDamageTarget(killUnit, u, -scale/2, false, false, null, DAMAGE_TYPE_UNIVERSAL, null)
                        set scale = 2*(scale - GetWidgetLife(u))/scale
                        if (scale > 1) then
                            set damageOriginal = -damageOriginal*scale
                        else
                            set damageOriginal = -damageOriginal
                        endif
                        call SetWidgetLife(u, life)
                    
                    call EnableTrigger(RefreshTrigger(targetId_p).parent.trigger)

This may seem innocent, but damage applied to a unit will mess with every other unit that is linked to it with spirit link. In this case, it means that every unit gets healed. This also causes all units to immediately die when a given unit dies.

Coke's, LFH's, and my DDS use this code to calculate what the damage actually is. This means that if you want life link, it must be vJASS. Either that, or we must find a better way to detect spell damage.

edit
Another bad thing happens. When you do that damage calculation and you use something like Trigger Refresh, you only disable the primary trigger partially. If the units are spread across several triggers, then some are going to fire DDS.

There is a way to detect this, but I don't know how you'd set up the triggers correctly.

Primary Trigger: enabled
Secondary Trigger: disabled

When calculating resistance, disable primary and enable secondary. Disable secondary for the target unit. When the damage is applied, block that damage for every unit it fires for. These are units that are spirit linked with the target. This sucks because it makes every piece of damage on a spirit link an n^2 calculation...

We just need to use a vJASS spirit link. You can't use vanilla one.
 
Status
Not open for further replies.
Top