Need help to make this spell

zero9x

Active Member
Reaction score
1
Hi guys, i got a idea for my next spell, but i can only think about it cuz i dont know how to make it, please help me :(

Bloody Strike

Passive

When your Hero attack an object, he gains 10% critical strike for each attack (limit 20/30/40/50% chance). When your Hero dont attack any objects in 1s, the critical chance will become 0%.
 

keychup

Active Member
Reaction score
34
you know how to use a spellbook? put the crit in that and disable the book.
11 levels, 0%+5% chance each.

When you attack a foe add your unit to a unit group.
Increase the level of the crit by 1 (and dont forget to cap it depending on the level: cap is level 5/7/9/11 which is 20/30/40/50%)
You will also need to give the unit a buff. the buff will be applied over and over again whenever you attack.
The buff should expire to signify that you have not attacked for a duration.

Every 0.5 seconds check all units in the unit group check if it has the buff. if it no longer has the buff it means he hasn't attacked for a while so now you can lower the level of crit by 1 every. You can keep lowering the crit by 1 until the unit has the buff again. If crit is at level 1 remove that unit from the group.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
This is something i worked up, it works by increasing the level of a spellbook (which is disabled) each attack, this spellbook should have the crit ability for that rank that you want it to have
Negatives: Attack-Spam glitch affects this ability, not a ranked ability (could be added but would take some more time), ie: only one rank of the core ability works, but the crit should have multiple ranks
JASS:
scope BloodyStrikeScope/*
    requires
        RegisterUnitEvent by Magtheridon96 (http://www.thehelper.net/forums/showthread.php/168601-RegisterPlayerUnitEvent)
        UnitIndexer by Nestharus (http://www.thehelper.net/forums/showthread.php/153034-Unit-Indexer?highlight=Unit+Indexer+Nestharus)
        OR AIDS by J4L (http://www.thehelper.net/forums/showthread.php/130752-Advanced-Indexing-Data-Storage)*/
    
    globals
        private constant integer BOOK_ID     =    'A000' //ID of the book holding the crit ability
        private constant integer UNIT_ID     =    'hfoo' //ID of the unit-type the ability is for
        private constant integer MAX_INC     =         5 //Maximum increase to the book (book should have a max rank equal to this)
        private constant real TIME_OUT       =         3 //How long they have to not attack for to lose a rank (in seconds)
        private constant boolean USE_AIDS    =      true //This is if you have AIDS and UnitIndexer (idk why you would but i have seen it before)
    endglobals
    
    private struct BS extends array
        unit u
        timer t
        integer rank
        thistype next
        thistype prev
        
        static if USE_AIDS and LIBRARY_AIDS then
            private method AIDS_onCreate takes nothing returns nothing
                local unit u = GetIndexUnit(this)
        else if not USE_AIDS and LIBRARY_AutoIndex then
            private method index takes nothing returns nothing
                local unit u = GetUnitById(this)
        endif
            if GetUnitTypeId(u) == UNIT_ID then
                set this.u = u
                set this.t = CreateTimer()
                set this.rank = 0
                set this.next = this
                set this.prev = this
            endif
        endmethod
        
        static if USE_AIDS and LIBRARY_AIDS then
            private method AIDS_onDestroy takes nothing returns nothing
        else if not USE_AIDS and LIBRARY_AutoIndex then
            private method deindex takes nothing returns nothing
        endif
            call DestroyTimer(this.t)
        endmethod
        
        static if USE_AIDS and LIBRARY_AIDS then
            //! runtextmacro optional AIDS()
        else if not USE_AIDS and LIBRARY_UnitIndexer then
            implement optional UnitIndexStruct
        endif
        
        private static method onTimer takes nothing returns nothing
            local thistype this = thistype[0].next
            call DecUnitAbilityLevel(this.u, BOOK_ID)
            set this.rank = this.rank - 1
            set thistype[0].next = this.next
            set this.next.prev = 0
            if 0 < this.rank then
                set this.next = 0
                set this.prev = thistype[0].prev
                set this.prev.next = this
                set thistype[0].prev = this
            else
                call PauseTimer(this.t)
                set this.next = this
                set this.prev = this
            endif
        endmethod
        
        private static method onAttack takes nothing returns nothing
            local thistype this = GetUnitId(GetAttacker())
            if GetUnitTypeId(this.u) == UNIT_ID then
                call IncUnitAbilityLevel(this.u, BOOK_ID)
                set this.rank = this.rank + 1
                call ResumeTimer(this.t)
                call TimerStart(this.t, TIME_OUT, true, function thistype.onTimer)
                set this.next.prev = this.prev
                set this.prev.next = this.next
                set this.next = 0
                set this.prev = thistype[0].prev
                set this.prev.next = this
                set thistype[0].prev = this
            endif
        endmethod
        
        private static method onInit takes nothing returns nothing
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_ATTACKED, function thistype.onAttack)
            set thistype[0].next = 0
            set thistype[0].prev = 0
        endmethod
        
    endstruct
endscope
 

zero9x

Active Member
Reaction score
1
Sorry but when i copied all Systems and Death Strike, its have an error like this picture, how can i fix this problem?
8db2935e97d0b5ef9a4eb7c6e2b78493_40653503.error.jpg
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top