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

[Crash] Stun System based on Flux's Buff System

Status
Not open for further replies.
Level 7
Joined
Feb 9, 2021
Messages
301
Note: I code for 1.26 war3.

I am attempting to make a simple stun system based on Flux's Buff System. However, on usage, it gives me a fatal error (this fatal error does not occur on 1.31 for some reason).

The code below uses a 'thunderbolt' spell ('A001') with the same buff as 'Aura Slow (Tornado)' ('ASTU'). The error happens 1-2 seconds after execution of " call IssueTargetOrder(dummy, "thunderbolt", this.target)". Nevertheless, execution happens.

The idea and execution of this system is not mine but @Laiev.

JASS:
scope StunBuff
    /* -------------------------------------------------------------------------- */
    /*                                    Stun                                    */
    /* -------------------------------------------------------------------------- */
    globals
        // The raw code of the ability used to stun an unit
        private constant integer STUN    = 'A001'
    endglobals
    
    struct StunBuff extends Buff
        private static constant integer RAWCODE = 'ASTU'
        private static constant integer DISPEL_TYPE = BUFF_NEGATIVE
        private static constant integer STACK_TYPE =  BUFF_STACK_FULL
      
        method onRemove takes nothing returns nothing
            //
        endmethod
      
        method onApply takes nothing returns nothing
            local unit dummy = CreateUnit (Player(PLAYER_NEUTRAL_PASSIVE),'eRez', GetUnitX(this.target), GetUnitY(this.target), 270)
           
            call GetRecycledDummyAnyAngle(GetUnitX(this.target), GetUnitY(this.target), GetUnitFlyHeight(this.target))
            
            
            call PauseUnit(dummy, false)
            call UnitAddAbility(dummy, STUN)
            call IssueTargetOrder(dummy, "thunderbolt", this.target)
            call DummyAddRecycleTimer(dummy, 1.)

            set dummy = null

        endmethod
      
        implement BuffApply
    endstruct
endscope
 
Level 14
Joined
Nov 17, 2010
Messages
1,265
My guess is you are using one of the new natives available in 1.31 that isn’t available in 1.26, but I don’t know enough about that to be sure.
 
Level 7
Joined
Feb 9, 2021
Messages
301
My guess is you are using one of the new natives available in 1.31 that isn’t available in 1.26, but I don’t know enough about that to be sure.
Not really. I use the Buff System and the Dummy Recycler, which both work fine on 1.26. Otherwise, there is only code from the above, and the fatal error is only from one line.
 
Level 11
Joined
May 29, 2008
Messages
132
Given your description of the error, I would take a close look at the line call DummyAddRecycleTimer(dummy, 1.). The time this timer gets called lines up with the described "1-2 seconds after execution". Possibly a problem occurs in the recycling?
 
Level 7
Joined
Feb 9, 2021
Messages
301
Given your description of the error, I would take a close look at the line call DummyAddRecycleTimer(dummy, 1.). The time this timer gets called lines up with the described "1-2 seconds after execution". Possibly a problem occurs in the recycling?
It wasn't, as I checked for this. However, it does not matter. I found a better way to do the stun system. I will close this topic.
 
Status
Not open for further replies.
Top