Spell Timed Barrage

Immolation

Member
Reaction score
20
Timed Barrage​
Allows shooting of several arrows with a single attack for a short amount of time.

GUI/vJASS= vJASS
Leakless?= Yes(I hope).
Lagless= Yes(for me).
MUI/MPI?= MUI

Changelog:
v1.1
-Spell is now MUI. Thanks to Tom Kazansky for concept!
-Fixed a bug with Barrage shooting too many arrows.

v1.00a
-Updated code.

v1.00
-Public release.

Code:
JASS:
scope Barrage initializer Initialization
//-------------------------------------------------------------
//                Timed Barrage by Immolation                
//-------------------------------------------------------------

// Description:
//---------------------------
// Allows shooting of several arrows with a single attack for a short amount of time.

// What do I need to import it in my map?
//---------------------------
// You need to download JASS NewGen, available at the following links:

// -http://www.thehelper.net/forums/showthread.php?t=73936-
// -http://www.wc3c.net/showthread.php?t=90999-

//Install it and then read the following paragraph.

// How do I put it in my map?
//---------------------------
// 1. Copy:
//  a. The "Barrage" ability.
//  b. The "Barrage(Buff)" ability.
//  c. The "Barrage(Passive)" ability.
//  d. The "Passive Book (Disabled)" ability.
//  e. The "Barrage" buff.
//  f. Export the "dummy.mdx" file and import it back into your map. (Export the icons if you wish too, be sure to set the right path though).
//  g. Copy the "Dummy Unit" into your map.
//  h. Copy this trigger.
// 2. Press CTRL + D while in the Object Editor to find out the rawcode of:
//  a. The "Barrage" ability. Change the SPELL_ID to the rawcode that you find(it's 'A000' in this map).
//  b. The "Barrage(Passive)" ability. Change the BARRAGE_ID to the rawcode that you find(it's 'A002' in this map).
//  c. The "Barrage(Buff)" ability. Change the BUFFSPELL_ID to the rawcode that you find(it's 'A001' in this map).
//  d. The "Passive Book (Disabled)" ability. Change the SPELLBOOK_ID to the rawcode that you find(it's 'A003' in this map).
//  e. The "Barrage" buff. Change the BUFF_ID to the rawcode that you find(it's 'B000' in this map).
//  f. The "Dummy Unit" unit. Change the DUMMY_ID to the rawcode that you find(it's 'n000' in this map).
// 3. Be sure that the "Passive Book (Disabled)" has the "Barrage (Passive)" ability.
// 4. Give the Barrage ability to your hero.
// 5. You have succesfully imported the spell <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />

// Changelog:
//---------------------------
// v1.1
// -Spell is now MUI. (Thanks Tom Kazansky!)
//
// v1.00a:
// -Updated code.
//
// v1.00:
// -Public release.
//---------------------------
// TheHelper.net

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//                                    RAWCODES
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//About Configurables:
// The configurables can be found in the Object Editor.
// Modify the duration of the &quot;Barrage (Buff)&quot; ability to set the duration of the spell.
// Modify the cooldown&amp;manacost of &quot;Barrage&quot; ability to set the desired cooldown&amp;manacost.
// Check the &quot;Barrage (Passive)&quot; for the rest.

    globals
        private constant integer SPELL_ID = &#039;A000&#039;
        private constant integer BARRAGE_ID = &#039;A002&#039; 
        private constant integer BUFFSPELL_ID = &#039;A001&#039;
        private constant string  BUFFSPELL_ORDER = &quot;rejuvination&quot;
        private constant integer BUFF_ID = &#039;B000&#039;
        private constant integer DUMMY_ID = &#039;n000&#039;
        private constant integer SPELLBOOK_ID = &#039;A003&#039;
        private constant real TIMEOUT = 0.2 // Used to check if the spell is active or not after casting every second.
                                            // I suggest a number between 0.1-0.5. Default: 0.2
    endglobals

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction

    private function Actions takes nothing returns nothing
    local unit TriggeringUnit = GetTriggerUnit()
    local real x = GetUnitX(TriggeringUnit)
    local real y = GetUnitY(TriggeringUnit)
    local player TriggeringPlayer = GetOwningPlayer(TriggeringUnit)
    local integer SpellLevel = GetUnitAbilityLevel(TriggeringUnit, SPELL_ID)
    local unit Dummy = CreateUnit(TriggeringPlayer, DUMMY_ID, x, y, 0.00)
    call UnitAddAbility(Dummy, BUFFSPELL_ID)
    call SetUnitAbilityLevel(Dummy, BUFFSPELL_ID, SpellLevel)
    call UnitApplyTimedLife(Dummy, &#039;BTLF&#039;, 3.00)
    call IssueTargetOrder(Dummy, BUFFSPELL_ORDER, TriggeringUnit)
    call UnitAddAbility(TriggeringUnit, SPELLBOOK_ID)
    call SetUnitAbilityLevel(TriggeringUnit, BARRAGE_ID, SpellLevel)
    call TriggerSleepAction(0.0)
    loop
        exitwhen GetUnitAbilityLevel(TriggeringUnit, BUFF_ID) == 0
        call TriggerSleepAction(TIMEOUT)
    endloop
    call UnitRemoveAbility(TriggeringUnit, SPELLBOOK_ID)
    endfunction

//=============================================================================================
    private function Initialization takes nothing returns nothing
        local trigger Trigger = CreateTrigger()
        local integer Loop = 0
        call TriggerRegisterAnyUnitEventBJ(Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition(Trigger, Condition(function Conditions))
        call TriggerAddAction(Trigger, function Actions)

        loop
            exitwhen Loop == 12
            call SetPlayerAbilityAvailable(Player(Loop), SPELLBOOK_ID, false)
            set Loop = Loop + 1
        endloop
    endfunction
endscope



P.S.: I know it's simple, but many people ask for it.

Lags a bit on the first cast, preload if needed.
 

Attachments

  • Timed Barrage v1.1.w3x
    74.1 KB · Views: 239

Immolation

Member
Reaction score
20
1) I would never, ever submit a non-working spell -.-

2) The order string of Rejuvenation is "rejuvination".
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
Here is the MUI version:
JASS:
scope Barrage initializer Initialization
//-------------------------------------------------------------
//                Timed Barrage by Immolation                
//-------------------------------------------------------------

// Description:
//---------------------------
// Allows shooting of several arrows with a single attack for a short amount of time.

// What do I need to import it in my map?
//---------------------------
// You need to download JASS NewGen, available at the following links:

// <a href="http://www.thehelper.net/forums/showthread.php?t=73936" class="link link--internal">http://www.thehelper.net/forums/showthread.php?t=73936</a>
// <a href="http://www.wc3c.net/showthread.php?t=90999" target="_blank" class="link link--external" rel="nofollow ugc noopener">http://www.wc3c.net/showthread.php?t=90999</a>

//Install it and then read the following paragraph.

// How do I put it in my map?
//---------------------------
// 1. Copy:
//  a. The &quot;Barrage&quot; ability.
//  b. The &quot;Barrage(Buff)&quot; ability.
//  c. The &quot;Barrage(Passive)&quot; ability.
//  d. The &quot;Passive Book (Disabled)&quot; ability.
//  e. The &quot;Barrage&quot; buff.
//  f. Export the &quot;dummy.mdx&quot; file and import it back into your map. (Export the icons if you wish too, be sure to set the right path though).
//  g. Copy the &quot;Dummy Unit&quot; into your map.
//  h. Copy this trigger.
// 2. Press CTRL + D while in the Object Editor to find out the rawcode of:
//  a. The &quot;Barrage&quot; ability. Change the SPELL_ID to the rawcode that you find(it&#039;s &#039;A000&#039; in this map).
//  b. The &quot;Barrage(Passive)&quot; ability. Change the BARRAGE_ID to the rawcode that you find(it&#039;s &#039;A002&#039; in this map).
//  c. The &quot;Barrage(Buff)&quot; ability. Change the BUFFSPELL_ID to the rawcode that you find(it&#039;s &#039;A001&#039; in this map).
//  d. The &quot;Passive Book (Disabled)&quot; ability. Change the SPELLBOOK_ID to the rawcode that you find(it&#039;s &#039;A003&#039; in this map).
//  e. The &quot;Barrage&quot; buff. Change the BUFF_ID to the rawcode that you find(it&#039;s &#039;B000&#039; in this map).
//  f. The &quot;Dummy Unit&quot; unit. Change the DUMMY_ID to the rawcode that you find(it&#039;s &#039;n000&#039; in this map).
// 3. Be sure that the &quot;Passive Book (Disabled)&quot; has the &quot;Barrage (Passive)&quot; ability.
// 4. Add the &quot;Passive Book (Disabled)&quot; and the &quot;Barrage&quot; ability to the hero.
// 5. You have succesfully imported the spell <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />

// Changelog:
//---------------------------
// v1.00a:
// -Updated code.
//
// v1.00:
// -Public release.
//---------------------------
// TheHelper.net

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//                                    RAWCODES
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//About Configurables:
// The configurables can be found in the Object Editor.
// Modify the duration of the &quot;Barrage (Buff)&quot; ability to set the duration of the spell.
// Modify the cooldown&amp;manacost of &quot;Barrage&quot; ability to set the desired cooldown&amp;manacost.
// Check the &quot;Barrage (Passive)&quot; for the rest.

    globals
        private constant integer SPELL_ID = &#039;A000&#039;
        private constant integer BARRAGE_ID = &#039;A002&#039; 
        private constant integer BUFFSPELL_ID = &#039;A001&#039;
        private constant string  BUFFSPELL_ORDER = &quot;rejuvination&quot;
        private constant integer BUFF_ID = &#039;B000&#039;
        private constant integer DUMMY_ID = &#039;n000&#039;
        private constant integer SPELLBOOK_ID = &#039;A003&#039;
    endglobals

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    globals
        private group UnitsWhoHasBuff = CreateGroup()
    endglobals
    
    private function GroupCallback takes nothing returns nothing
        local unit Pick = GetEnumUnit()
        if GetUnitAbilityLevel( Pick, BUFF_ID ) == 0 then
            call UnitRemoveAbility( Pick, SPELLBOOK_ID )
            call GroupRemoveUnit( UnitsWhoHasBuff, Pick )
        endif
        set Pick = null
    endfunction
    
    private function TimerCallback takes nothing returns nothing
        call ForGroup( UnitsWhoHasBuff ,  function GroupCallback )
    endfunction

    private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction

    private function Actions takes nothing returns nothing
        local unit TriggeringUnit = GetTriggerUnit()
        local real x = GetUnitX(TriggeringUnit)
        local real y = GetUnitY(TriggeringUnit)
        local integer SpellLevel = GetUnitAbilityLevel(TriggeringUnit, SPELL_ID)
        local player TriggeringPlayer = GetOwningPlayer(TriggeringUnit)
        local unit Dummy = CreateUnit(TriggeringPlayer, DUMMY_ID, x, y, 0.00)
        call UnitAddAbility(Dummy, BUFFSPELL_ID)
        call SetUnitAbilityLevel(Dummy, BUFFSPELL_ID, SpellLevel)
        call UnitApplyTimedLife(Dummy, &#039;BTLF&#039;, 3.00)
        call IssueTargetOrder(Dummy, BUFFSPELL_ORDER, TriggeringUnit)
        
        call UnitAddAbility( TriggeringUnit, SPELLBOOK_ID )
        call SetUnitAbilityLevel( TriggeringUnit, BARRAGE_ID, SpellLevel )
        call TriggerSleepAction(0.0)  //sometimes, the dummy&#039;s cast isn&#039;t fast enough, so add a wait should be fine <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile    :)" loading="lazy" data-shortname=":)" />
        call GroupAddUnit( UnitsWhoHasBuff, TriggeringUnit )
        
        set TriggeringUnit = null
        set Dummy = null
    endfunction

//=============================================================================================
    private function Initialization takes nothing returns nothing
        local trigger Trigger = CreateTrigger()
        local integer Loop = 0
        call TriggerRegisterAnyUnitEventBJ(Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition(Trigger, Condition(function Conditions))
        call TriggerAddAction(Trigger, function Actions)
        
        call TimerStart( CreateTimer(), 0.1, true, function TimerCallback )
        
        loop
            exitwhen Loop == 12
            call SetPlayerAbilityAvailable(Player(Loop), SPELLBOOK_ID, false)
            set Loop = Loop + 1
        endloop
    endfunction
endscope


and the demo map attached below
 

Attachments

  • [Spell] Timed Barrage (MUI).w3x
    74.4 KB · Views: 371

Immolation

Member
Reaction score
20
@Wolfie: WC3 doesn't have a good enough multishot icon(actually, it doesn't have any of that kind of icon)

@Tom: I'm now adding the spellbook like you, so spell is now MUI.

@Jesus4Lyf: Spell was MPI before :p BTW, what do you mean for attack speed?

Update: v1.1
-Spell is now MUI(Thanks to Tom Kazansky for concept!)
-Fixed a bug regarding Barrage shooting too many arrows.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top