Stackable instances for a unit of this spell

Stated above.

JASS:
scope Overseermight initializer Init

globals
    private constant integer DMGAURA = 'A00F'
    private constant integer SPELLBOOK = 'A00V'
    private constant integer SPELL = 'A00U'
    private constant string EFFECT = "Abilities\\Spells\\Items\\AIco\\CrownOfCmndTarget.mdl"
    private constant string BLINK = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
endglobals

private struct data
    implement AutoData
    static group Done = CreateGroup()
    unit target
    integer instances
    integer agi
    integer atkspeed
    integer life
    
static method create takes unit target returns data
    local data d = data.allocate()
    set d.instances = 0
    set d.agi = 0
    set d.atkspeed = 0
    set d.life = 0
    set data[target] = d
    return d     
endmethod
endstruct

private function LConditions takes nothing returns boolean
    return GetLearnedSkill() == SPELL
endfunction

private function LActions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer i = GetUnitAbilityLevel(u,SPELL)
    if GetLearnedSkill() > 0 then
        call UnitAddAbility(u,SPELLBOOK)
    endif
    call SetUnitAbilityLevel(u,DMGAURA,i)
    set u = null
endfunction

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

private function Actions takes nothing returns nothing  
    local unit u = GetTriggerUnit()
    local data d = data<u>
    local unit t = GetSpellTargetUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real tx = GetUnitX(t)
    local real ty = GetUnitY(t)
    if d == 0 then
        set d = data.create(u)
    endif
    call SetUnitX(t,x)
    call SetUnitY(t,y)
    call DestroyEffect(AddSpecialEffect(BLINK,x,y))
    call SetUnitX(u,tx)
    call SetUnitY(u,ty)
    call DestroyEffect(AddSpecialEffect(BLINK,tx,ty))
    call AddTimedEffectTarget(EFFECT,u,&quot;overhead&quot;,5)
    set d.agi = DelayedAgi(u,15,5) // d.agi is the struct instance of the agi struct and same goes for the rest
    set d.life = DelayedMaxLife(u,200,5)
    set d.atkspeed = DelayedAttackSpeed(u,40,5)
    set d.instances = d.instances + 1 // what am I doing with this and not using a boolean? Well I don't know, i am currently thinking of how to make it stackable
    set u = null
    set t = null
endfunction

private function ConditionDeath takes nothing returns boolean
    local unit u = GetKillingUnit()
    local unit a = GetTriggerUnit()
    local integer i = GetUnitAbilityLevel(u,SPELL)
    local data d = data<u>
    if IsUnitEnemy(a,GetOwningPlayer(u)) and i &gt; 0 and d.instances &gt; 0 then
        call BJDebugMsg(&quot;Adding&quot;) 
        call AddAgiDuration(d.agi,1) // increase duration of the instance by 1
        call AddMaxLifeDuration(d.life,1) // same thing..
        call AddAttackSpeedDuration(d.atkspeed,1)
       // auto data overwrites the existing struct so it isn't multiple unit instances for a specific unit 2 times and more
     endif
     set u = null
     set a = null
    return false
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer i = 0
    loop
        exitwhen i &gt; 12
        call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
        set i = i + 1
    endloop
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_HERO_SKILL)
    call TriggerAddAction(t, function LActions )
    call TriggerAddCondition(t,Condition(function LConditions))
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(t, function Actions)
    call TriggerAddCondition(t,Condition(function Conditions))
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(t,Condition(function ConditionDeath))
endfunction
endscope</u></u>



I wrote the problems in the comments but to sum it up. Right now it's not stackable and how do I make it so? Making huge arrays in the struct make less instances possible.

EDIT: Would using table for a struct instance work well or is there any other good alternatives?

EDIT2:
JASS:
scope Overseermight initializer Init

globals
    private constant integer DMGAURA = 'A00F'
    private constant integer SPELLBOOK = 'A00V'
    private constant integer SPELL = 'A00U'
    private constant string EFFECT = &quot;Abilities\\Spells\\Items\\AIco\\CrownOfCmndTarget.mdl&quot;
    private constant string BLINK = &quot;Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl&quot;
endglobals

private struct data
    implement AutoData
    static group Done = CreateGroup()
    Table Agi
    Table AttackSpeed
    Table MaxLife
    unit target
    integer Count = 0
    
static method create takes unit target returns data
    local data d = data.allocate()
    set d.target = target
    set d.Agi = Table.create()
    set d.MaxLife = Table.create()
    set d.AttackSpeed = Table.create()
    set data[target] = d
    return d     
endmethod
endstruct

private function LConditions takes nothing returns boolean
    return GetLearnedSkill() == SPELL
endfunction

private function LActions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer i = GetUnitAbilityLevel(u,SPELL)
    if GetLearnedSkill() &gt; 0 then
        call UnitAddAbility(u,SPELLBOOK)
    endif
    call SetUnitAbilityLevel(u,DMGAURA,i)
    set u = null
endfunction

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

private function Actions takes nothing returns nothing  
    local unit u = GetTriggerUnit()
    local data d = data<u>
    local unit t = GetSpellTargetUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real tx = GetUnitX(t)
    local real ty = GetUnitY(t)
    if d == 0 then
        set d = data.create(u)
    endif
    call SetUnitX(t,x)
    call SetUnitY(t,y)
    call DestroyEffect(AddSpecialEffect(BLINK,x,y))
    call SetUnitX(u,tx)
    call SetUnitY(u,ty)
    call DestroyEffect(AddSpecialEffect(BLINK,tx,ty))
    call AddTimedEffectTarget(EFFECT,u,&quot;overhead&quot;,5)
    set d.Agi[d.Count] = DelayedAgi(u,15,5)
    set d.MaxLife[d.Count] = DelayedMaxLife(u,200,5)
    set d.AttackSpeed[d.Count] = DelayedAttackSpeed(u,40,5)
    set d.Count = d.Count + 1
    set u = null
    set t = null
endfunction

private function ConditionDeath takes nothing returns boolean
    local unit u = GetKillingUnit()
    local unit a = GetTriggerUnit()
    local integer i = GetUnitAbilityLevel(u,SPELL)
    local integer j = 0
    local data d = data<u>
    if IsUnitEnemy(a,GetOwningPlayer(u)) and i &gt; 0 and d.instances &gt; 0 then
        loop
            exitwhen j &gt;= d.Count
            call AddAgiDuration(d.agi,1)
            call AddMaxLifeDuration(d.life,1)
            call AddAttackSpeedDuration(d.atkspeed,1)
            set j = j + 1
        endloop
     endif
     set u = null
     set a = null
    return false
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer i = 0
    loop
        exitwhen i &gt; 12
        call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
        set i = i + 1
    endloop
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_HERO_SKILL)
    call TriggerAddAction(t, function LActions )
    call TriggerAddCondition(t,Condition(function LConditions))
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(t, function Actions)
    call TriggerAddCondition(t,Condition(function Conditions))
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(t,Condition(function ConditionDeath))
endfunction

endscope
</u></u>


Tried a Table verison but I got confused and it wouldn't work, when would I set d.Count to d.Count - 1, I don't want to modify the UP Delayed Script.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • C Cherry.Grove:
    So what's the whole reforged situation? Do we have to run the classic version bootleg now?
  • C Cherry.Grove:
    My boyfriend is super into Bethesda modding so I'm probably going to join him in that for a bit, then move on to making mobile/browser games.
  • C Cherry.Grove:
    I mostly just want to look at my old projects because I know I posted uploads on here somewhere.
  • C Cherry.Grove:
    My one game was basically Among Us but you sabotaged an entire medieval city simulated drastically inefficiently with dynamic NPCs :S
  • C Cherry.Grove:
    of course I never finished it x D
  • jonas jonas:
    xD
  • jonas jonas:
    I think you can still run the original game, just there's a chance your map won't work with the newer patches
  • jonas jonas:
    what development framework have you been looking at for mobile development?
  • jonas jonas:
    I'm currently creating (as a hobby) a space invaders like game for mobile using Xamarin, after starting a few larger projects that I also may not have finished :rolleyes::p
  • The Helper The Helper:
    Awesome! you should look at the Atari VCS platform it does not have a huge user base but the one it has is super active at around 11k and they have no games in there store
  • The Helper The Helper:
    basically it is linux
  • The Helper The Helper:
    OMG it is BanLord as Blackveiled on the forum
  • The Helper The Helper:
    what is up buddy
  • jonas jonas:
    thanks for the tip, that sounds cool. Never heard about the VCS before but seems like it should be a good match
  • tom_mai78101 tom_mai78101:
    The winter vacation left a toll on me. I missed staying up late and sleeping in late.
  • C Cherry.Grove:
    i haven't looked into it yet
  • C Cherry.Grove:
    If I could use something Python compatible it would save me some learning
  • C Cherry.Grove:
    But Unity might be easiest
  • C Cherry.Grove:
    looking at old posts here makes me happy. Makes me be all like "wow I was pretty smart in 2009"
  • C Cherry.Grove:
    mostly failing at life through adulthood really demotivated me for a while
  • C Cherry.Grove:
    ....what I don't get is why the fuck they would force us to permanently convert to a version of the game everyone fucking hated : \
  • C Cherry.Grove:
    Raid Shadow Legends texture pack smh
  • jonas jonas:
    Most people fail at life throughout their adulthood. Sometimes we get to learn from it. Usually it just feels like crap.
  • The Helper The Helper:
    What does not kill you makes you stronger is what they say

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top