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

[GUI] Multi Cast Ability System 1.2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
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.

JASS:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  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
21:48, 23rd Apr 2015 IcemanBo: I don't like that all units by player x will be influenced by enable/disable ability.

Moderator

M

Moderator

21:48, 23rd Apr 2015
IcemanBo: I don't like that all units by player x will be influenced by enable/disable ability.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
  • 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.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
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.

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

This system does not support the percentage chance for MC
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.
 
Level 10
Joined
Aug 21, 2010
Messages
316
Never seen that one before... neither do I play games with luck-factor like that.

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:
Level 24
Joined
Aug 1, 2013
Messages
4,657
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

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.
 
Level 10
Joined
Aug 21, 2010
Messages
316
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.



"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
 
Level 3
Joined
Jan 24, 2015
Messages
26
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.
 
Level 10
Joined
Aug 21, 2010
Messages
316
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.

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
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Btw, Update all of your resources. There is a rule that says ALL resources must have an adequate screenshot, if necessary
So... how do you want me to make a screenshot for this system?
I mean what does the screenshot has to show?

(the exception applies to systems, tho some needs it like Projectile Systems etc.)
So... you tell me to update my resources... and then you say "but all of your resources are an exception"
Seems fair :p
 
Level 33
Joined
Apr 24, 2012
Messages
5,113
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

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
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
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.
 
So, yes now it works. ^_°

It would make it more complex, but you could think of the possibility to allow user to define some sort of a list ofwhich the new ability can be chosen.
So it would be possible to add a random ability out of a list instead of pre-defined one, for example.
So then you would only define one "CastAbility" and then only one corresponding list of "NextAbilites". (not more, or a chain)
If the list only has one element it will be like now, that the next ability is pre-defined, but else it may be random as said before.
So, for example the API could look like this:
  • Set CastAbility = Ability_0
  • Set NextAbility[1] = Ability_1
  • Set NextAbility[2] = Ability_2
  • [/stable]
->
  • Set CastAbility = Ability_0
  • Set List[1] = Ability_1
  • -------- --------
  • -------- --------
  • Set CastAbility = Ability_1
  • Set List[1] = Ability_2
  • -------- --------
  • -------- --------
  • Set CastAbility = Ability_2
  • Set List[1] = Ability_0
  • [/stable]
So with this always one-element lists it will end up the same as the chain above but splitted into autonomous parts.
Hope I could explain it more or less what I meant. :D
I came up with it because I saw you use something like "Chance", so I thought it might be an additional feature to allow randomness.

  • Set MCA_Amount = 2
^It's okay, but this variable is not necessatily neeed. Internal check can be done something like exitwhen (ability[index] == 0).
Thoug then it's needed to '0' the variable after storage in table.

Duration 0 may be used if the next instance should not have a time limit. It still may be part of a chain, though.

Reset_Chain doesn't need a trigger.

GetRandomReal(0, 99.99) < chance
->
GetRandomReal(0, 100) <= chance

With a bit different structure your example was maybe kind of more readable:

Ability_Name_1
Next_Ability_Chance_1
Duration_1
Ability_Name_2
Next_Ability_Chance_2
Duration_2
Ability_Name_3
Next_Ability_Chance_3
Duration_3
->
Ability_Name_1
Ability_Name_2
Ability_Name_3
Next_Ability_Chance_1
Next_Ability_Chance_2
Next_Ability_Chance_3
Duration_1
Duration_2
Duration_3

^Just a personal suggestion, lol. :D

It's good concept. I might imagine it to be useful for some minigame.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
So, yes now it works. ^_°
Yay approved... uhm... nvm :)

It would make it more complex, but you could think of the possibility to allow user to define some sort of a list ofwhich the new ability can be chosen.
So it would be possible to add a random ability out of a list instead of pre-defined one, for example.
So then you would only define one "CastAbility" and then only one corresponding list of "NextAbilites". (not more, or a chain)
If the list only has one element it will be like now, that the next ability is pre-defined, but else it may be random as said before.
So, for example the API could look like this:
  • Set CastAbility = Ability_0
  • Set NextAbility[1] = Ability_1
  • Set NextAbility[2] = Ability_2
  • [/stable]
->
  • Set CastAbility = Ability_0
  • Set List[1] = Ability_1
  • -------- --------
  • -------- --------
  • Set CastAbility = Ability_1
  • Set List[1] = Ability_2
  • -------- --------
  • -------- --------
  • Set CastAbility = Ability_2
  • Set List[1] = Ability_0
  • [/stable]
So with this always one-element lists it will end up the same as the chain above but splitted into autonomous parts.
Hope I could explain it more or less what I meant. :D
I came up with it because I saw you use something like "Chance", so I thought it might be an additional feature to allow randomness.

I do understand... but as far as the system concept works... this is impossible.
For example, you cast ability 0 (you gain ability1) then you cast ability1 (you gain ability2) then you cast ability2 (you gain ability0).
Works fine.
Now, you cast 0 then 1 then 2... and then you wait until the duration expires.
Right now, the system is pretty much unable to know what the original ability was.
That is why it won't work like that.
I do have a new concept that would work better (requires you to manually activate the second cast when the spell has started the effect but allows you to use something else as event as well) but even there it is as far as I know impossible to do this how you intent to do it.

  • Set MCA_Amount = 2
^It's okay, but this variable is not necessatily neeed. Internal check can be done something like exitwhen (ability[index] == 0).
Thoug then it's needed to '0' the variable after storage in table.
Yea I kinda was like... or set the number, or set everything back to 0.
But I didn't thought about setting to 0 inside the registry but only in the configuration.
Kind of me being shortsighted :D

Duration 0 may be used if the next instance should not have a time limit. It still may be part of a chain, though.
Yea... kinda.
I see how you would want it.

Reset_Chain doesn't need a trigger.
Same as for every other system that I make for GUI users, yes it does.
I want to prevent most stuff from being placed in the header file and I dont want to use vJASS and I dont want to force people to rewrite the triggers that they had before importing the system.

JASS:
function f1 takes nothing returns nothing
    call f2()
endfunction
function f2 takes nothing returns nothing
endfunction
Creating a trigger is the best solution for this problem IMO.

GetRandomReal(0, 99.99) < chance
->
GetRandomReal(0, 100) <= chance
0% chance... WOOOW I CAN DOUBLE CAST!!!
I haven't really tested the GetRandomReal() or actually searched for anything that would be like it but I think that 0 is included in it so it will be like:
GetRandomReal(0.01, 100) <= chance

With a bit different structure your example was maybe kind of more readable:

Ability_Name_1
Next_Ability_Chance_1
Duration_1
Ability_Name_2
Next_Ability_Chance_2
Duration_2
Ability_Name_3
Next_Ability_Chance_3
Duration_3
->
Ability_Name_1
Ability_Name_2
Ability_Name_3
Next_Ability_Chance_1
Next_Ability_Chance_2
Next_Ability_Chance_3
Duration_1
Duration_2
Duration_3
I guess so.

It's good concept. I might imagine it to be useful for some minigame.
I don't really know if I can take that as a compliment or insult...
At least my map is not a minigame and I will use this system in it... not in the current state but the idea at least.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Trigger 1 (created by user)
call reset spell chain

Trigger 2 (MCA System)
function reset spell chain

=

function f1
call reset spell chain()
endfunction

function reset spell chain
endfunction

I don't want to force everyone to recreate his triggers so I make the trigger to have as action.
 
Top