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

[vJASS] Walk through units for 5s

Status
Not open for further replies.
Level 13
Joined
Mar 19, 2010
Messages
870
Hey guys,

is there an ability that i can use to let an hero run through units for 5s? No invisibilty or other things.. just able to run through units and not more!

I have this trigger right here but i can not really find an ability. If there is no ability, any idea how to implement it?


vJASS:
scope HerosWill initializer Init
    /*
     * The hero is able to move through all units for 5 seconds.
     * Changelog:
     *         xx.xx.2015: Initial Upload
     *
     */
    globals
        private constant integer SPELL_ID = 'A05E'
        private constant integer GHOST_VISIBLE_ID = 'XXXX'
        private constant real DURATION = 5.0
    endglobals
   
    private struct HerosWill
        private unit caster
        private timer t
       
        method onDestroy takes nothing returns nothing
            set .caster = null
        endmethod
       
        static method onHerosWillEnd takes nothing returns nothing
            local thistype this = GetTimerData(GetExpiredTimer())
           
            call UnitRemoveAbility(this.caster, GHOST_VISIBLE_ID)
            call ReleaseTimer(this.t)
            call this.destroy()
        endmethod
   
        static method create takes unit caster returns thistype
            local thistype this = thistype.allocate()
           
            set .caster = caster
            set .t = NewTimer()
            call SetTimerData(.t, this)
            call UnitAddAbility(.caster, GHOST_VISIBLE_ID)
            call TimerStart(.t, DURATION, false, function thistype.onHerosWillEnd)
           
            return this
        endmethod
    endstruct
   
    private function Actions takes nothing returns nothing
        call HerosWill.create(GetTriggerUnit())
    endfunction
   
    private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction

    private function Init takes nothing returns nothing
        call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_EFFECT, function Conditions, function Actions)
    endfunction
endscope
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
is there an ability that i can use to let an hero run through units for 5s? No invisibilty or other things.. just able to run through units and not more!
Windwalk. You can set it so the fade time is longer than the duration so the unit never becomes invisible. This is how SWAT Aftermath and many maps implement "sprint" abilities that let you bypass unit collision for a short period.
 
Level 13
Joined
Mar 19, 2010
Messages
870
Windwalk. You can set it so the fade time is longer than the duration so the unit never becomes invisible. This is how SWAT Aftermath and many maps implement "sprint" abilities that let you bypass unit collision for a short period.
I tested it some time ago but after some time or because of a reason i don't know the ability does not work anymore. You can click but nothing happens.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
I tested it some time ago but after some time or because of a reason i don't know the ability does not work anymore. You can click but nothing happens.
Check this is the behaviour in a separate test map with only that windwalk based ability and the bare minimum to test it. Other abilities or triggers in your map might be interfering with it.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
i have a big map with 80k line of vJass code ^^ Very hard to find the piece that crashes the ability. That's why i wanted to implement it via code.
Given that such behaviour points towards a bug or something broken I would suggest spending the hour or so tracking it down and fixing it rather than developing a hacky ability to try and imitate native functionality.

I usually use a bisection approach to track down such issues. First I delete all triggers from a copy of the map to confirm it is triggers causing the issue (and not other abilities, such as channel). Then in another copy of the map I delete half the triggers and check if the issue is fixed. If the issue is fixed then it was one of the deleted triggers, otherwise it is one of the not deleted triggers. This can be repeated until eventually the exact system causing the issue is identified.
 
Level 12
Joined
May 16, 2020
Messages
660
Windwalk. You can set it so the fade time is longer than the duration so the unit never becomes invisible. This is how SWAT Aftermath and many maps implement "sprint" abilities that let you bypass unit collision for a short period.
In the newest patch this works to "walk through units". The problem is that casting any ability will stop the effect.
 
Status
Not open for further replies.
Top