1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Fill your cup and take your pick among the maps best suited for this year's Hive Cup. The 6th Melee Mapping Contest Poll is up!
    Dismiss Notice
  3. Shoot to thrill, play to kill. Sate your hunger with the 33rd Modeling Contest!
    Dismiss Notice
  4. Do you hear boss music? It's the 17th Mini Mapping Contest!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[GUI] Multi Cast Ability System 1.2

Submitted by Wietlol
This bundle is marked as substandard. It may contain bugs, not perform optimally or otherwise be in violation of the submission rules.
This is a system that is made for double castable abilities but extends the possibilities to 100 abilities in a chain. (You can increase that amount.)
This is laggless, leakless, flawless, pointless and reckless... uhm... forget that.
This can be used for spellcasting, abilitycasting, typecasting and all other castings.

BE AWARE THAT THIS SYSTEM IS NOT MUI!
THIS IS MPI!

This system can have one unit that can double cast abilities of the same chain per player.
Other units with other chains for the same player work fine.
The same chain on units of other players will also work fine.

Description:
This system will check when you cast an ability. If the ability that you cast belongs to a chain, that ability is replaced by a new one.
After a few seconds of time, the abilities will be reset to the original state.
When you cast the new ability, you either return to the original state or you gain the next ability in the chain.

How to install:
  • Copy or create all variables that are used in the example map into your map.
  • Copy the MCA_System trigger and paste it into your map.

Triggers
Code (vJASS):
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  Wietlol's Multi Cast Ability System 1.2 01/03/2015
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Description:
//      This system is made to create a chain of abilities that can be cast in a specific order.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  How to install:
//      1. Copy or create all variables that are used in this map into your map.
//          1a. If you use vJASS then you can enable the MCA_vJASS_variables trigger and use that one.
//          1b. If you use GUI then you can use the MCA_GUI_variables trigger to automatically import them.
//      2. Copy the MCA_System trigger and paste it into your map.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  How to use:
//      Create a chain:
//      1. Create a trigger for map initialization or use an existing one.
//      2. Set MCA_Original_Ability to the ability that the unit has by default.
//          This one will fire the chain.
//      3. Set MCA_Amount to the number of abilities that the unit can cast after the first one.
//      4. Set all alternative abilities in MCA_Alternative_Ability[] in the correct order.
//      5. Set all durations that you are allowed to cast the alternative spell in MCS_Duration[].
//      6. Run MCA_System to create the chain. (Ignore conditions for performance.)
//      
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Feature list:
//      This system:
//      - allows you to make a chain of abilities that can be cast after each other.
//      - allows you to set a duration for each spell that the unit is allowed to cast it.
//      - allows you to manually reset the chain of spells.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Variable explaination:
//////////////////////////
//      Registration:
//      - MCA_Hashtable                 - hashtable
//          This is the hashtable that is used by the Multi Cast Ability System.
//          
//      - MCA_Amount                    - integer
//          This is the number of alternative abilities that the original ability has in it's chain.
//          
//      - MCA_Original_Ability          - ability (integer in JASS)
//          This is the original ability that the unit has.
//          This ability fires the chain.
//          
//      - MCA_Alternative_Ability       - ability array (integer array in JASS)
//          This is the list of abilities inside the chain.
//          
//      - MCA_Next_Spell_Chance         - real array
//          This is the list of the chance that the unit can cast the next spell.
//          
//      - MCA_Duration                  - real array
//          This is the time in seconds that you can cast the second ability.
//          When this time expires, the ability chain will reset to the original form.
//          
//      - MCA_Caster                    - unit
//          This variable refers to the caster of the spells.
//          This is used to reset the chain for the caster.
//          
//      - MCA_Trigger_Register_Chain    - trigger
//          This trigger registers the spells of a spell chain.
//          
//      - MCA_Trigger_Reset_Chain       - trigger
//          This trigger resets the chain to the original form of the targeted unit.
//          
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Changelog:
//      1.2 - New parameter: "Next Spell Chance".
//          You can now apply a chance to be able to cast the next spell.
//          
//      1.1 - New function: "Reset Chain".
//          You can now reset the chain of a specific ability for a specific unit manually too.
//          
//      1.0 - First official release on the Hive.
//          
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Known bugs:
//      - None
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////





/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  These functions handle the temporary abilities.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This function removes the last spell in the chain that is cast.
function MCA_Remove_Spells takes unit caster, integer lastSpell, integer originalSpell returns nothing
    //It may not remove the original spell.
    if lastSpell != originalSpell then
        call UnitRemoveAbility(caster, lastSpell)
    endif
   
    //Enable the original spell.
    call SetPlayerAbilityAvailable(GetOwningPlayer(caster), originalSpell, true)
endfunction

//This function removes the timer and the references for leak fixes.
function MCA_Reset_Abilities takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer id = GetHandleId(t)
    local unit caster = LoadUnitHandle(udg_MCA_Hashtable, id, 0)
    local integer originalSpell = LoadInteger(udg_MCA_Hashtable, id, 1)
   
    //Reset the abilities to the original form.
    call MCA_Remove_Spells(caster, LoadInteger(udg_MCA_Hashtable, id, 3), originalSpell)
   
    //Remove leaks.
    call DestroyTimer(t)
    call RemoveSavedHandle(udg_MCA_Hashtable, GetHandleId(caster), originalSpell)
    call FlushChildHashtable(udg_MCA_Hashtable, id)
    set caster = null
    set t = null
endfunction

//This function gives the caster the next ability in the chain.
function MCA_Give_Alternative_Ability takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer id = GetHandleId(t)
    local unit caster = LoadUnitHandle(udg_MCA_Hashtable, id, 0)
    local integer originalSpell = LoadInteger(udg_MCA_Hashtable, id, 1)
    local integer lastSpell = LoadInteger(udg_MCA_Hashtable, id, 3)
    local integer level = LoadInteger(udg_MCA_Hashtable, id, 2)
    local integer newSpell = LoadInteger(udg_MCA_Hashtable, lastSpell, 1)
    local real duration = LoadReal(udg_MCA_Hashtable, newSpell, 2)
    local real chance = LoadReal(udg_MCA_Hashtable, lastSpell, 3)
   
    if newSpell > 0 and GetRandomReal(0, 99.99) < chance then
        //There is a next spell and the unit is able to cast it.
       
        //Disable or remove the last cast spell.
        if originalSpell == lastSpell then
            call SetPlayerAbilityAvailable(GetOwningPlayer(caster), originalSpell, false)
        else
            call UnitRemoveAbility(caster, lastSpell)
        endif
       
        //Add the new spell.
        call UnitAddAbility(caster, newSpell)
        call SetUnitAbilityLevel(caster, newSpell, level)
       
        //Update the timer that will reset the abilities.
        call TimerStart(t, duration, false, function MCA_Reset_Abilities)
        call SaveInteger(udg_MCA_Hashtable, id, 3, newSpell)
    else
        //There is no next spell.
       
        //Reset the abilities to the original form.
        call MCA_Remove_Spells(caster, lastSpell, originalSpell)
        call DestroyTimer(t)
        call RemoveSavedHandle(udg_MCA_Hashtable, GetHandleId(caster), originalSpell)
        call FlushChildHashtable(udg_MCA_Hashtable, id)
    endif
   
    //Remove leaks.
    set caster = null
    set t = null
endfunction

//This function calls the next ability to pop up.
//This must be done after 0 seconds to ensure that the casting has ended properly.
function MCA_Multi_Cast_Effect takes nothing returns boolean
    local integer spell = GetSpellAbilityId()
    local unit caster = GetSpellAbilityUnit()
    local integer level = GetUnitAbilityLevel(caster, spell)
    local integer id = LoadInteger(udg_MCA_Hashtable, spell, 0)
    local timer t
   
    if id > 100 then
        //The ability is cast as an alternative ability.
       
        //Reset the timer and call the next ability.
        set t = LoadTimerHandle(udg_MCA_Hashtable, GetHandleId(caster), id)
        call TimerStart(t, 0, false, function MCA_Give_Alternative_Ability)
        call SaveInteger(udg_MCA_Hashtable, GetHandleId(t), 3, spell)
       
        set t = null
    elseif id > 0 then
       
        //Create a new timer that calls the next ability.
        set t = CreateTimer()
        call TimerStart(t, 0, false, function MCA_Give_Alternative_Ability)
        set id = GetHandleId(t)
       
        //Save the data to the timer.
        call SaveUnitHandle(udg_MCA_Hashtable, id, 0, caster)
        call SaveInteger(udg_MCA_Hashtable, id, 1, spell)
        call SaveInteger(udg_MCA_Hashtable, id, 2, level)
        call SaveInteger(udg_MCA_Hashtable, id, 3, spell)
        call SaveTimerHandle(udg_MCA_Hashtable, GetHandleId(caster), spell, t)
       
        set t = null
    endif
   
    //Remove leaks.
    set caster = null
    return false
endfunction

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  These are the functions that can be called manually.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This function resets the chain of abilities.
function MCA_End_Timer takes nothing returns nothing
    //Requires:
    //  - MCA_Original_Ability
    //  - MCA_Caster
   
    call TimerStart(LoadTimerHandle(udg_MCA_Hashtable, GetHandleId(udg_MCA_Caster), udg_MCA_Original_Ability), 0, false, function MCA_Reset_Abilities)
endfunction

//This function registers the ability chain.
function MCA_Register_Multi_Cast_Spell takes nothing returns nothing
    //Requires:
    //  - MCA_Original_Ability
    //  - MCA_Amount
    //  - MCA_Alternative_Ability[]
    //  - MCA_Next_Spell_Chance[]
    //  - MCA_Duration[]
   
    local integer i = 1
    local integer index = 0
   
    //Save the first alternative ability to the chain.
    call SaveInteger(udg_MCA_Hashtable, udg_MCA_Original_Ability, 0, udg_MCA_Amount)
    call SaveInteger(udg_MCA_Hashtable, udg_MCA_Original_Ability, 1, udg_MCA_Alternative_Ability[0])
    call SaveReal(udg_MCA_Hashtable, udg_MCA_Original_Ability, 3, udg_MCA_Next_Spell_Chance[0])
   
    loop
        //Save the duration and original ability to the hashtable.
        call SaveInteger(udg_MCA_Hashtable, udg_MCA_Alternative_Ability[index], 0, udg_MCA_Original_Ability)
        call SaveReal(udg_MCA_Hashtable, udg_MCA_Alternative_Ability[index], 2, udg_MCA_Duration[index])
       
        exitwhen index >= udg_MCA_Amount-1
       
        //Save the next ability in the chain.
        call SaveInteger(udg_MCA_Hashtable, udg_MCA_Alternative_Ability[index], 1, udg_MCA_Alternative_Ability[index+1])
        call SaveReal(udg_MCA_Hashtable, udg_MCA_Alternative_Ability[index], 3, udg_MCA_Next_Spell_Chance[index+1])
       
        set i = i + 2
        set index = index + 1
    endloop
endfunction

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  This code is the initialization of the system.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is the initial function.
function InitTrig_MCA_System takes nothing returns nothing
    //Create a trigger that will handle the multicast abilities.
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Filter(function MCA_Multi_Cast_Effect))
   
    //Create a trigger that registers the ability chains.
    set udg_MCA_Trigger_Register_Chain = CreateTrigger()
    call TriggerAddAction(udg_MCA_Trigger_Register_Chain, function MCA_Register_Multi_Cast_Spell)
   
    //Create a trigger that resets the ability chains.
    set udg_MCA_Trigger_Reset_Chain = CreateTrigger()
    call TriggerAddAction(udg_MCA_Trigger_Reset_Chain, function MCA_End_Timer)
   
    //Create the hashtable that is used.
    set udg_MCA_Hashtable = InitHashtable()
endfunction

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  MCA System end
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  • MCA Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MCA_Original_Ability = Storm Bolt
      • Set MCA_Amount = 2
      • Set MCA_Alternative_Ability[0] = Firebolt (Neutral Hostile)
      • Set MCA_Next_Spell_Chance[0] = 100.00
      • Set MCA_Duration[0] = 4.00
      • Set MCA_Alternative_Ability[1] = Frost Bolt
      • Set MCA_Next_Spell_Chance[1] = 50.00
      • Set MCA_Duration[1] = 4.00
      • Trigger - Run MCA_Trigger_Register_Chain (ignoring conditions)
      • Set MCA_Original_Ability = Thunder Clap
      • Set MCA_Amount = 1
      • Set MCA_Alternative_Ability[0] = War Stomp (Neutral Hostile 1)
      • Set MCA_Next_Spell_Chance[0] = 100.00
      • Set MCA_Duration[0] = 4.00
      • Trigger - Run MCA_Trigger_Register_Chain (ignoring conditions)
      • Set MCA_Original_Ability = Divine Shield
      • Set MCA_Amount = 1
      • Set MCA_Alternative_Ability[0] = Healing Wave (Neutral Hostile)
      • Set MCA_Next_Spell_Chance[0] = 10.00
      • Set MCA_Duration[0] = 4.00
      • Trigger - Run MCA_Trigger_Register_Chain (ignoring conditions)


Changelog:
- 1.2 - New parameter: "Next Spell Chance".
- 1.1 - New function: "Reset Chain".
- 1.0 - Added this system to the hive.

Give credits when used.
Feel free to post any feedback or suggestions.

Keywords:
Wietlol, double cast, double, cast, multi cast, multi, chain, ability, spell, spellchain.
Contents

Just another Warcraft III map (Map)

Reviews
Moderator
21:48, 23rd Apr 2015 IcemanBo: I don't like that all units by player x will be influenced by enable/disable ability.
  1. 21:48, 23rd Apr 2015
    IcemanBo: I don't like that all units by player x will be influenced by enable/disable ability.
     
  2. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Known Bugs

    • None.


    Reviews
    • None, awaits feedback.


    Upcoming release:
    • No current ideas. Feel free to give suggestions.

    (Why MCA? ... well because that's why MCA.)
     
  3. btdonald

    btdonald

    Joined:
    Dec 3, 2011
    Messages:
    346
    Resources:
    8
    Maps:
    1
    Spells:
    7
    Resources:
    8
    Your system must have a function like MCA_Register(Abi, Alt Abi, ....)
    So that it'll be used easily.
     
  4. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    • MCA Example
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set MCA_Original_Ability = Storm Bolt
        • Set MCA_Amount = 2
        • Set MCA_Alternative_Ability[0] = Firebolt (Neutral Hostile)
        • Set MCA_Duration[0] = 4.00
        • Set MCA_Alternative_Ability[1] = Frost Bolt
        • Set MCA_Duration[1] = 4.00
        • Trigger - Run MCA System <gen> (ignoring conditions)

    The function you described is already in it.
    The difference is that it is a GUI function and it has parameters...
    So you set a global variable and you call the function. That is how GUI functions can have parameters...
    Next to that... JASS functions cannot have arrays as parameters. So you have to use that global variable method anyway.
     
  5. zv27

    zv27

    Joined:
    Aug 21, 2010
    Messages:
    293
    Resources:
    0
    Resources:
    0
    This system does not support the percentage chance for MC
     
  6. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Update 1.1

    I just released version 1.1

    Here are the changes:
    • You can now reset the chain of a specific ability for a specific unit manually too.
    • Changed the register from calling the system trigger to a global variable.

    ---------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------

    The... chance?
    Like in you have a 30% chance to be able to cast the next spell?

    Never seen that one before... neither do I play games with luck-factor like that.

    Will be fun.
     
  7. zv27

    zv27

    Joined:
    Aug 21, 2010
    Messages:
    293
    Resources:
    0
    Resources:
    0
    Muhahaha You never saw MC in dota
    I can not believe you've never seen mc with a percentage chance...omg

    In any case, it would be good to make support for % chance
     
    Last edited: Feb 18, 2015
  8. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    As I said, I refuse to play games with large luck factors... People always wonder why I play Poker :D
    I like to play more skill based games... more flashy playz and stuff.
    More calculation than luck.

    I never played the original DotA too to be honest.
     
  9. zv27

    zv27

    Joined:
    Aug 21, 2010
    Messages:
    293
    Resources:
    0
    Resources:
    0


    "Multi Cast" first appeared in DOTA
    I'm not sure but I think it was sometime in 2005 or / 06
    it was a long time ago when I was playing dota

    But it is not so important
    I gave you a suggestion so...you decide
     
  10. Arctangent

    Arctangent

    Joined:
    Jan 24, 2015
    Messages:
    25
    Resources:
    0
    Resources:
    0
    Just from a brief look-over of this, I'm pretty sure this isn't remotely like DOTA's multicast, zv27.

    To explain, Wietlol, multicast in DOTA is an ultimate that basically gives the basic spells something akin to a crit chance, but instead of simply increasing the damage the spells are automatically cast multiple times in quick succession, only expending the mana cost once.

    This, however, looks more like a system to replace an ability with a similar ability so that it can be manually cast several times, but at the cost of mana each time. To make a DOTA comparison, it seems more like the system behind Riki's reworked Blink Strike or Ember Spirit's Flame Remnants.

    I'm not saying the name should be changed, mind, I just think zv27 didn't exactly take that good of a look at this.
     
  11. zv27

    zv27

    Joined:
    Aug 21, 2010
    Messages:
    293
    Resources:
    0
    Resources:
    0
    You're right
    I have not even looked at how the system looks...lolol...muhahahah
    but i still think it would be cool to have a percentage chance
     
  12. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Well... I can see how some people would use chances that one will be able to be cast.
    However, I will never use any other value than 100%.
    Will implement it though (is not hard)

    Anyway, any other suggestions?
     
  13. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,842
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    Btw, Update all of your resources. There is a rule that says ALL resources must have an adequate screenshot, if necessary(the exception applies to systems, tho some needs it like Projectile Systems etc.)
     
  14. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    So... how do you want me to make a screenshot for this system?
    I mean what does the screenshot has to show?

    So... you tell me to update my resources... and then you say "but all of your resources are an exception"
    Seems fair :p
     
  15. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,842
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    Did I say all? Well btw, At least show some screenshot about this. Multi Cast systems demos are enough as screenies.

    I mean, I said "For example". Systems that shows graphics must have one. If a system doesn't show any of it, then use the "code" as the screenie or just a screenshot of debug msgs that shows the system runs successfully.

    Like for example, you can't make a screenshot of Thread library because it doesn't affect the game graphically. So, provide at least a screenshot of a code chunk or a debug test screenshot
     
  16. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Well... I don't add graphical things myself.
    The user however can make buffs, new abilities or special effects through my systems but they are the ones who do it. That is the idea of a system.

    But I will try to make a little story in a few screenshots to explain what it does in pictures.
     
  17. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,915
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    The config is really confusing. But seems like a very useful system indeed.
     
  18. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Update 1.2

    I just released version 1.2

    Here are the changes:
    • New parameter: "Next Spell Chance".
     
  19. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,525
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Test the map. :)