Retrieving a struct using PUI outside scope?

cleeezzz

The Undead Ranger.
Reaction score
268
all the examples of PUI and in the tutorial uses PUI within the scope to tell if the struct is created or not, and then do some more stuff with the old struct.

heres my code (read the comments in it)

JASS:
scope GS initializer Init

private struct Data
    timer t
    unit d
    real x
    real y
    integer i
    group g = CreateGroup()
    
    private method onDestroy takes nothing returns nothing
        call ReleaseTimer(.t)
        call RemoveUnit(.d)
        call DestroyGroup(.g)
        set .g = null
        set .d = null
    endmethod
endstruct               

private function Shift takes nothing returns nothing
    local Data d = GetCSData(GetExpiredTimer())
    local unit u
    local real a
    local real dist
    local real x2
    local real y2
    local real f
    local real f2
    local group g = CreateGroup()
    local Data e
    set d.x = GetUnitX(d.d)
    set d.y = GetUnitY(d.d)
    call GroupAddGroupAdv(Arrows,g)
    
    if GetUnitState(d.d,UNIT_STATE_LIFE)<.405 then
        call d.destroy()
        set u = null
        call DestroyGroup(g)
        set g = null
        return
    endif

    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        set e = Data<u>  //heres where i want to retrieve a struct and set it as e
        set x2 = GetUnitX(u)
        set y2 = GetUnitY(u)
        set f = GetUnitFacing(u)
        set f2 = f + 180
        set dist = DistanceXY(d.x,d.y,x2,y2)
            if dist &lt;= d.i then
                set a = Rad2Deg(AngleXY(x2,y2,d.x,d.y))
                    if a &lt; 0 then
                        set a = a + 360
                    endif
                    if f &gt; 180 then
                        if a &lt;= f and a &gt;= f2 - 360 then
                            call SetUnitFacing(u, GetUnitFacing(u) - (e.moved/11)) //takes some data from the struct e and uses it (this gives an error though moved is not a member of GS_Data which i know its not a member, but i want it to take moved from the struct in data e.)
                        else
                            call SetUnitFacing(u, GetUnitFacing(u) + (e.moved/11))
                        endif 
                    else
                        if a &gt;= f and a &lt;= f2 then
                            call SetUnitFacing(u, GetUnitFacing(u) + 3)
                        else
                            call SetUnitFacing(u, GetUnitFacing(u) - 3)
                        endif 
                    endif
            endif
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    set g = null
    set u = null   
endfunction
    
//=======================================================================
private function Actions takes nothing returns nothing
    local Data d = Data.create()
    local unit u = GetTriggerUnit()
    local location l = GetSpellTargetLoc()
    call RemoveUnit(GF[GetPlayerId(GetOwningPlayer(u))])
    set GF[GetPlayerId(GetOwningPlayer(u))] = null
    set d.t = NewTimer()
    set d.x = GetLocationX(l)
    set d.y = GetLocationY(l)
    set d.d = CreateUnit(GetOwningPlayer(u), &#039;h00L&#039;, d.x, d.y, 0)
    set GF[GetPlayerId(GetOwningPlayer(u))] = d.d
    set d.i = (200 + (100 * GetUnitAbilityLevel( u, &#039;A01W&#039;)))
    
    call TimerStart(d.t, 0.03, true, function Shift)
    call SetCSData(d.t, d)
    call RemoveLocation(l)
    set u = null
    set l = null
endfunction

//=======================================================================
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == &#039;A01W&#039;
endfunction


//=======================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()   
    call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trig,Condition(function Conditions))
    call TriggerAddAction(trig,function Actions)
endfunction

endscope

</u>
 

Sooda

Diversity enchants
Reaction score
318
Don't destroy groups, recycle them instead. Name your variables descriptive, name "h" doesn't tell nothing in the long run. You can't use something which doesn't exist. You first have to declare struct member named "moved" (I guess "moved" is real type.):
JASS:
private struct Data
    timer t
    unit d
    real x
    real y
    real moved // You need this real declared before you can use it.
    integer i
    group g = CreateGroup()
    
    private method onDestroy takes nothing returns nothing
        call ReleaseTimer(.t)
        call RemoveUnit(.d)
        call DestroyGroup(.g)
        set .g = null
        set .d = null
    endmethod
endstruct
 

cleeezzz

The Undead Ranger.
Reaction score
268
i did, moved is in a struct thats outside this scope. im trying to retrieve a struct data from outside this actual code and use 2 structs in 1 scope.
 
Reaction score
333
i did, moved is in a struct thats outside this scope. im trying to retrieve a struct data from outside this actual code and use 2 structs in 1 scope.

If you really need to use that struct in two different scopes then you should put it into a library and make it public.
 

cleeezzz

The Undead Ranger.
Reaction score
268
what if it already is o_O

JASS:
library CAS requires CSData,CSSafety,HandyFunctions

globals
    private constant real Start = 50.00   
    private constant real Scale = 1.00            
    private constant real Fly_height = 60.00   
    private constant attacktype A = ATTACK_TYPE_CHAOS
    private constant damagetype D = DAMAGE_TYPE_UNIVERSAL
    private unit Caster = null
endglobals

private function FilterIsEnemyAlive takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(Caster)) and GetWidgetLife(GetFilterUnit())&gt;0.405
endfunction  

               
//=======================================================================
private struct Data
    unit u
    unit d
    unit a
    real moved
    real cd
    real maxd
    real dmg
    real angle
    real r
    real plx
    real ply
    real bases
    group g = CreateGroup()
    timer t
    integer aid
    integer lvl
    real int
    real next
    boolean spell
    string sfx
    string as
    integer func
    real slow
    real csd
       
    static method create takes integer ut, unit u, real cx, real cy, real tx, real ty, real period, real r, real moved, real maxd, real dmg, integer aid, string as, integer lvl, real int, string sfx, integer func returns Data
        local integer index
        local item    indexItem
        local integer i
        local Data d = Data.allocate()
        set d.t = NewTimer()
        set d.u = u
        set d.cd = Start
        set d.csd = 0
        set d.maxd = maxd
        set d.angle = AngleXY(cx,cy,tx,ty)
        set d.dmg = dmg
        set d.r = r
        set d.d = CreateUnit(GetOwningPlayer(u),ut, PolarProjectionX (cx, Start, d.angle), PolarProjectionY (cy, Start, d.angle) , Rad2Deg(d.angle))
        set d.plx = GetUnitX(d.d)
        set d.ply = GetUnitY(d.d)
        call GroupAddUnit(Arrows,d.d)
        call SetUnitMoveSpeed(d.d, moved)
        set d.bases = moved
        set index = 0
            loop
                exitwhen index &gt; 5
                set indexItem = UnitItemInSlot(u, index)
                    if indexItem != null then
                        if GetItemTypeId(indexItem) == &#039;I00G&#039; or GetItemTypeId(indexItem) == &#039;I00M&#039; then
                            set i = GetRandomInt(1, 100)
                                if i &lt;= 15 then
                                    call UnitAddItemById(d.d,&#039;I00V&#039;)
                                endif
                        endif
                        if GetItemTypeId(indexItem) == &#039;I00J&#039; or GetItemTypeId(indexItem) == &#039;I00M&#039; then
                            set i = GetRandomInt(1 , 100)
                                if i &lt;= 15 then
                                    call UnitAddItemById(d.d,&#039;I00X&#039;)
                                endif
                        endif
                        if GetItemTypeId(indexItem) == &#039;I00F&#039; or GetItemTypeId(indexItem) == &#039;I00M&#039; then
                            set i = GetRandomInt(1 , 100)
                                if i &lt;= 17 then
                                    call UnitAddItemById(d.d, &#039;I00W&#039;)
                                endif
                        endif
                        if GetItemTypeId(indexItem) == &#039;I007&#039; then
                            set i = GetRandomInt(1 , 100)
                                if i &lt;= 10 then
                                    call UnitAddItemById(d.d, &#039;I007&#039;)
                                endif
                        endif
                        if GetItemTypeId(indexItem) == &#039;I006&#039; then
                            set i = GetRandomInt(1 , 100)
                                if i &lt;= 15 then
                                    call UnitAddItemById(d.d, &#039;I006&#039;)
                                endif
                        endif
                        if GetItemTypeId(indexItem) == &#039;I008&#039; then
                            set i = GetRandomInt(1 , 100)
                                if i &lt;= 20 then
                                    call UnitAddItemById(d.d, &#039;I008&#039;)
                                endif
                        endif
                    endif
                set index = index + 1
            endloop
        set indexItem = null
        set d.moved = moved
        set Caster = u
            if aid != 0 and sfx != null then
                set d.spell = true
                    if aid != 0 then
                        set d.aid = aid
                        set d.as = as
                        set d.int = int
                        set d.next = int
                        set d.a = CreateUnit(GetOwningPlayer(u),&#039;h000&#039;,cx,cy,0)
                        call UnitAddAbility(d.a,aid)
                        call SetUnitAbilityLevel(d.a,aid,lvl)
                        call UnitApplyTimedLife(d.a,&#039;BTLF&#039;,60)
                    else
                        set d.aid = 0
                    endif
                    if sfx != null then
                        set d.sfx = sfx
                    else
                        set d.sfx = null
                    endif
            else
                set d.spell = false
            endif
                if func == 1 then
                    if GetUnitState( u, UNIT_STATE_MANA) &gt;= 1 then
                        call SetUnitState( u, UNIT_STATE_MANA, GetUnitState( u, UNIT_STATE_MANA) - 1)
                        call SetUnitMoveSpeed(d.d, moved - 7)
                        set d.bases = moved - 7
                        set d.func = func
                    else
                        set d.func = 0
                    endif
                else 
                    set d.func = 0
                endif
        call SetUnitPathing(d.d,false)
        call SetUnitScale(d.d,Scale,Scale,Scale)
        call SetUnitFlyHeight(d.d,Fly_height,0.00)
        call TimerStart(d.t,period,true,function Data.Execute)
        call SetCSData(d.t,d)
        
        return d
    endmethod
    
    static method Execute takes nothing returns nothing
        local real x
        local real y
        local real x2
        local real y2
        local real a
        local unit u
        local group g = CreateGroup()
        local real dist
        local real rdist
        local Data d = GetCSData(GetExpiredTimer())
        
        set x = GetUnitX(d.d)
        set y = GetUnitY(d.d)
        
        set rdist = DistanceXY( x, y, d.plx, d.ply)

        set d.moved = GetUnitMoveSpeed(d.d)
            if GetUnitMoveSpeed(d.d) &lt; d.bases then
                call SetUnitMoveSpeed(d.d, GetUnitMoveSpeed(d.d) + 0.3)
            endif
        set d.cd = d.cd + rdist
        set d.plx = x
        set d.ply = y
        
            if d.cd &gt;= d.maxd or d.d == null then
                call d.destroy()
                set u = null
                call DestroyGroup(g)
                set g = null
                return
            endif

  
        
        set d.angle =  Deg2Rad(GetUnitFacing(d.d))
        set x = PolarProjectionX(x, d.moved, d.angle)
        set y = PolarProjectionY(y, d.moved, d.angle)
        
            if x &gt; GMaxX or x &lt; GMinX or y &gt; GMaxY or y &lt; GMinY then
                call RemoveUnit(d.d)
                set u = null
                call DestroyGroup(g)
                set g = null
                call d.destroy()
                return
            endif
            
        call SetUnitX(d.d, x)
        call SetUnitY(d.d, y)
        call GroupEnumUnitsInRange(g,x,y,d.r,Condition(function FilterIsEnemyAlive))
            
            loop
                set u = FirstOfGroup(g)
                exitwhen u == null
                    if not(IsUnitInGroup(u,d.g)) then
                        call GroupAddUnit(d.g,u)
                        call UnitDamageTarget(d.d,u,d.dmg,false,false,A,D,null)
                        
                    endif 
                call GroupRemoveUnit(g,u)                
            endloop
        call DestroyGroup(g)
        set g = null

            if GetUnitState(d.d, UNIT_STATE_LIFE) &gt; .405 then
                if d.spell == true then
                    set d.csd = d.csd + rdist
                        if d.csd &gt;= d.int then
                            set d.csd = 0
                                if d.aid != 0 then
                                    call IssuePointOrder(d.a, d.as, x, y)
                                endif
                                if d.sfx != null then
                                    call DestroyEffect(AddSpecialEffect( d.sfx, x, y ))
                                endif
                        endif
                endif
            endif
            if d.func == 1 then
                set g = CreateGroup()
                call GroupEnumUnitsInRange(g,x,y,600,Condition(function FilterIsEnemyAlive))
                call GroupAddGroupAdv(Arrows, g)
                loop
                    set u = FirstOfGroup(g)
                    if u == d.d then
                        call GroupRemoveUnit(g,u)
                        set u = FirstOfGroup(g)
                    endif
                    exitwhen u == null
                    set x2 = GetUnitX(u)
                    set y2 = GetUnitY(u)
                    set dist = DistanceXY(x,y,x2,y2)
                        if dist &lt;= 600 then
                            set a = AngleXY(x2,y2,x,y)
                                if 400/dist &lt;= dist then
                                    set x2 = SafeX(PolarProjectionX(x2,(400/dist),a))
                                    set y2 = SafeY(PolarProjectionY(y2,(400/dist),a))
                                endif
                            call SetUnitX(u,x2)
                            call SetUnitY(u,y2)
                        endif
                    call GroupRemoveUnit(g,u)
                endloop
                call DestroyGroup(g)
                set g = null
            endif                                   
    endmethod
    
    private method onDestroy takes nothing returns nothing
        call RemoveUnit(.d)
        call RemoveUnit(.a)
        set .u = null
        set .d = null
        set .a = null
        call GroupRemoveUnit(Arrows,.d)
        call GroupClear(.g)
        call DestroyGroup(.g)
        set .g = null
        call ReleaseTimer(.t)
        set .spell = false
        set .func = 0

    endmethod
endstruct

public function SA takes integer ut, unit u, real cx, real cy, real tx, real ty, real period, real r, real moved, real maxd, real dmg, integer aid, string as, integer lvl, real int, string sfx, integer func returns nothing    
    call Data.create(ut,u,cx,cy,tx,ty,period,r,moved,maxd,dmg,aid,as,lvl,int,sfx,func)
endfunction  

endlibrary

as you can see, the member "moved" is in here
JASS:
scope GS initializer Init

private struct Data
    timer t
    unit d
    real x
    real y
    integer i
    group g = CreateGroup()
    
    private method onDestroy takes nothing returns nothing
        call ReleaseTimer(.t)
        call RemoveUnit(.d)
        call DestroyGroup(.g)
        set .g = null
        set .d = null
    endmethod
endstruct               

private function Shift takes nothing returns nothing
    local Data d = GetCSData(GetExpiredTimer())
    local unit u
    local real a
    local real dist
    local real x2
    local real y2
    local real f
    local real f2
    local group g = CreateGroup()
    set d.x = GetUnitX(d.d)
    set d.y = GetUnitY(d.d)
    call GroupAddGroupAdv(Arrows,g)
    
    if GetUnitState(d.d,UNIT_STATE_LIFE)&lt;.405 then
        call d.destroy()
        set u = null
        call DestroyGroup(g)
        set g = null
        return
    endif

    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        set x2 = GetUnitX(u)
        set y2 = GetUnitY(u)
        set f = GetUnitFacing(u)
        set f2 = f + 180
        set dist = DistanceXY(d.x,d.y,x2,y2)
            if dist &lt;= d.i then
                set a = Rad2Deg(AngleXY(x2,y2,d.x,d.y))
                    if a &lt; 0 then
                        set a = a + 360
                    endif
                    if f &gt; 180 then
                        if a &lt;= f and a &gt;= f2 - 360 then
                            call SetUnitFacing(u, GetUnitFacing(u) - 3)
                        else
                            call SetUnitFacing(u, GetUnitFacing(u) + 3)
                        endif 
                    else
                        if a &gt;= f and a &lt;= f2 then
                            call SetUnitFacing(u, GetUnitFacing(u) + 3)
                        else
                            call SetUnitFacing(u, GetUnitFacing(u) - 3)
                        endif 
                    endif
            endif
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    set g = null
    set u = null   
endfunction
    
//=======================================================================
private function Actions takes nothing returns nothing
    local Data d = Data.create()
    local unit u = GetTriggerUnit()
    local location l = GetSpellTargetLoc()
    call RemoveUnit(GF[GetPlayerId(GetOwningPlayer(u))])
    set GF[GetPlayerId(GetOwningPlayer(u))] = null
    set d.t = NewTimer()
    set d.x = GetLocationX(l)
    set d.y = GetLocationY(l)
    set d.d = CreateUnit(GetOwningPlayer(u), &#039;h00L&#039;, d.x, d.y, 0)
    set GF[GetPlayerId(GetOwningPlayer(u))] = d.d
    set d.i = (200 + (100 * GetUnitAbilityLevel( u, &#039;A01W&#039;)))
    
    call TimerStart(d.t, 0.03, true, function Shift)
    call SetCSData(d.t, d)
    call RemoveLocation(l)
    set u = null
    set l = null
endfunction

//=======================================================================
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == &#039;A01W&#039;
endfunction


//=======================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()   
    call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trig,Condition(function Conditions))
    call TriggerAddAction(trig,function Actions)
endfunction

endscope


you obviously dont have to read all of it. im just saying that its in a library (wait i dont know if its public, do i change it to public struct Data, and will doing this affect mui?)
 

saw792

Is known to say things. That is all.
Reaction score
280
If it's private in the first library you cannot retrieve it outside that library. You have to change it to public and then refer to it with the library name as the prefix, eg: CAS_Data
 

cleeezzz

The Undead Ranger.
Reaction score
268
how do i refernce the right "instance" of the library. right now, CAS is mui, so if i had 2 instances going on at once, how would i know its using the right struct from the right instance lol
 
Reaction score
333
Libraries do not have instances. You should read up on them in the manual because at the moment you seem to be experiencing some confusion.
 

cleeezzz

The Undead Ranger.
Reaction score
268
hm i just read the library + public/private structs section and ... im still confused lol (well i read it and i didn't see anything about instances) could you copy and paste the line where is says that?
 
Reaction score
333
hm i just read the library + public/private structs section and ... im still confused lol (well i read it and i didn't see anything about instances) could you copy and paste the line where is says that?

That is because libraries do not have instances. Libraries and scopes are there to allow you to organize your code, how can they have instances?
 

cleeezzz

The Undead Ranger.
Reaction score
268
>That is because libraries do not have instances. Libraries and scopes are there to allow you to organize your code, how can they have instances?

so a scope that takes a library is basically copy and pasting the function from the library into the scope?

(i think i need an example, could you show me how to reference the struct that is inside a library from outside the scope that uses the library?)

>READ IT FOR REAL.

i did, but when i set the data to the unit in one scope, i cant find a way to load it in another scope.
 
Reaction score
333
so a scope that takes a library is basically copy and pasting the function from the library into the scope?

Scopes can't take libraries. When library B takes library A it means that library A is placed above library B in the map script (so that B can access the functions, etc, in A).

(i think i need an example, could you show me how to reference the struct that is inside a library from outside the scope that uses the library?)

JASS:
library A
    public struct Foo
        real x
        real y
    endstruct
    
    globals
        public Foo F
    endglobals
endlibrary

scope B
    private function peaches takes nothing returns nothing
        set A_F = A_Foo.create()
    endfunction
endscope

scope C
    private function pears takes nothing returns nothing
        set A_F.x = 42.
        set A_F.y = 0.
    endfunction
endscope
 

cleeezzz

The Undead Ranger.
Reaction score
268
wait lemme get this straight, if libraries do not have instances, how is my CAS library creating multiple arrows each with its own struct? (i can tell each arrow has its own struct because i put a BJDebugMsg to show everytime the struct is destroyed and its destroyed for each arrow

(also if i put a debug msg to show the current range of each arrow that is stored by the struct member d.cd, all arrows will return a different range. how could this be possible if its using only one struct)
 
Reaction score
333
What has this got to do with multiple instances of the library? It is the structs and the arrows that are multiply instanced, not the library.
 

cleeezzz

The Undead Ranger.
Reaction score
268
oh okay. i thought you meant the whole library and everything in it wasnt multi instanceable.


(the beginning of the library)

JASS:
library CAS requires CSData,CSSafety,HandyFunctions

globals
    private constant real Start = 50.00   
    private constant real Scale = 1.00            
    private constant real Fly_height = 60.00   
    private constant attacktype A = ATTACK_TYPE_CHAOS
    private constant damagetype D = DAMAGE_TYPE_UNIVERSAL
    private unit Caster = null
    public Data e  //do i have to set this to something? your example didn&#039;t set it though. so i dont know.
endglobals

private function FilterIsEnemyAlive takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(Caster)) and GetWidgetLife(GetFilterUnit())&gt;0.405
endfunction  

               
//=======================================================================
public struct Data
    unit u
    unit d
    unit a
    real moved
    real cd
    real maxd
    real dmg
    real angle
    real r
    real plx
    real ply
    real bases
    group g = CreateGroup()
    timer t
    integer aid
    integer lvl
    real int
    real next
    boolean spell
    string sfx
    string as
    integer func
    real slow
    real csd


the scope outside the library (theres a comment in it)

JASS:
scope GS initializer Init

private struct Data
    timer t
    unit d
    real x
    real y
    integer i
    group g = CreateGroup()
    
    private method onDestroy takes nothing returns nothing
        call ReleaseTimer(.t)
        call RemoveUnit(.d)
        call DestroyGroup(.g)
        set .g = null
        set .d = null
    endmethod
endstruct               

private function Shift takes nothing returns nothing
    local Data d = GetCSData(GetExpiredTimer())
    local unit u
    local real a
    local real dist
    local real x2
    local real y2
    local real f
    local real f2
    local group g = CreateGroup()
    set d.x = GetUnitX(d.d)
    set d.y = GetUnitY(d.d)
    call GroupAddGroupAdv(Arrows,g)
    
    if GetUnitState(d.d,UNIT_STATE_LIFE)&lt;.405 then
        call d.destroy()
        set u = null
        call DestroyGroup(g)
        set g = null
        return
    endif

    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        set x2 = GetUnitX(u)
        set y2 = GetUnitY(u)
        set f = GetUnitFacing(u)
        set f2 = f + 180
        set dist = DistanceXY(d.x,d.y,x2,y2)
            if dist &lt;= d.i then
                set a = Rad2Deg(AngleXY(x2,y2,d.x,d.y))
                    if a &lt; 0 then
                        set a = a + 360
                    endif
                    if f &gt; 180 then
                        if a &lt;= f and a &gt;= f2 - 360 then
                            call SetUnitFacing(u, GetUnitFacing(u) - (CAS_e.moved/11))  //CAS_e is not the type that allows . syntax
                        else
                            call SetUnitFacing(u, GetUnitFacing(u) + 3)
                        endif 
                    else
                        if a &gt;= f and a &lt;= f2 then
                            call SetUnitFacing(u, GetUnitFacing(u) + 3)
                        else
                            call SetUnitFacing(u, GetUnitFacing(u) - 3)
                        endif 
                    endif
            endif
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    set g = null
    set u = null   
endfunction
    
//=======================================================================
private function Actions takes nothing returns nothing
    local Data d = Data.create()
    local unit u = GetTriggerUnit()
    local location l = GetSpellTargetLoc()
    call RemoveUnit(GF[GetPlayerId(GetOwningPlayer(u))])
    set GF[GetPlayerId(GetOwningPlayer(u))] = null
    set d.t = NewTimer()
    set d.x = GetLocationX(l)
    set d.y = GetLocationY(l)
    set d.d = CreateUnit(GetOwningPlayer(u), &#039;h00L&#039;, d.x, d.y, 0)
    set GF[GetPlayerId(GetOwningPlayer(u))] = d.d
    set d.i = (200 + (100 * GetUnitAbilityLevel( u, &#039;A01W&#039;)))
    
    call TimerStart(d.t, 0.03, true, function Shift)
    call SetCSData(d.t, d)
    call RemoveLocation(l)
    set u = null
    set l = null
endfunction

//=======================================================================
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == &#039;A01W&#039;
endfunction


//=======================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()   
    call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trig,Condition(function Conditions))
    call TriggerAddAction(trig,function Actions)
endfunction

endscope
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top