Spellpack Strength Requiem, Gold Transmittion, Critical Buff, Lucky Barrier

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
It has been a long long time that I has submitting spells, I'm start it again. :D

~GaLs~ proudly presents the
Passive Spell Pack

This spell pack focus to the aspect of passive spell.
Since I saw in the forum, most of them are active spell, why no people making passive spell? I made it then. xD

All of the spell contains the following characteristic.
  • MUI (Multi Unit Instanceability)
  • Lagless
  • Fast

Now now, lets start the introduction.
*I will spoiler tag up all the spells as it takes time to load, if you are interested, just open it, else, ignore it and post at below. :D

Strength Requiem
Code:
Give chances to increase owns damage but increases the enemy's armor as well.
Level 1 - 5% to increase its enemy's armor by 10 and increases self's damage by 100%.
Level 2 - 10% to increase its enemy's armor by 20 and increases self's damage by 200%.
Level 3 - 15% to increase the enemy's armor by 30 and increases self's damage by 300%.
Duration - 3 seconds.

JASS:
scope StrengthRequiem

//===================================================================================
//                                 Strength Requiem                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Increase Armor [R] [StrengthRequiem]
//  2. Increase Damage [D] [StrengthRequiem]
//  3. Strength Requiem
//
//  [ Buff ]
//  1. Increase Armor [StrengthRequiem]
//  2. Increase Damage [StrengthRequiem]
//  3. Strength Requiem [StrengthRequiem]
//
//  [ Unit ]
//  1. Dummy +Armor/+Damage [StrengthRequiem]
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//--------------------------------------------------------------------------------
//===================================================================================
//  Implementation End                                 
//===================================================================================



//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//&lt;-------------------- Percentage --------------------&gt;//

private constant function GetPercent takes integer level returns integer
    return level*5   //Level * 5
endfunction

//&lt;------------------ Percentage End ------------------&gt;//

globals

//&lt;-------------------- Rawcode --------------------&gt;//
//
    private constant integer SR_Id = &#039;A000&#039;
//Rawcode of Strength Requiem

    private constant integer SR_Dm = &#039;A003&#039;
//Rawcode of Increase Damage [D] [Strength Requiem]

    private constant integer SR_Am = &#039;A001&#039;
//Rawcode of Increase Armor [A] [Strength Requiem]

    private constant integer SR_Dy = &#039;h001&#039;
//Rawcode of +Damage/Armor unit.
//
//&lt;------------------ Rawcode End ------------------&gt;//
//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//

endglobals



private struct StrReq
unit atker
unit trgerunit
integer lvl
integer percent
    
    method PlusArmor takes nothing returns nothing
    local unit u = CreateUnit(GetOwningPlayer(.atker),SR_Dy,GetUnitX(.atker),GetUnitY(.atker),0)
        call UnitAddAbility(u,SR_Am)
        call SetUnitAbilityLevel(u,SR_Am,.lvl)
        call UnitApplyTimedLife(u,&#039;BTLF&#039;,1)
        call IssueTargetOrder(u,&quot;innerfire&quot;,.trgerunit)
    set u = null
    endmethod
    
    method PlusDamage takes nothing returns nothing
    local unit u = CreateUnit(GetOwningPlayer(.atker),SR_Dy,GetUnitX(.atker),GetUnitY(.atker),0)
        call UnitAddAbility(u,SR_Dm)
        call SetUnitAbilityLevel(u,SR_Dm,.lvl)
        call UnitApplyTimedLife(u,&#039;BTLF&#039;,1)
        call IssueTargetOrder(u,&quot;innerfire&quot;,.atker)
    set u = null
    endmethod
    
    static method create takes unit atk, unit trg returns StrReq
        local StrReq SR = StrReq.allocate()
        set SR.atker = atk
        set SR.trgerunit = trg
        set SR.lvl = GetUnitAbilityLevel(SR.atker, SR_Id)
        set SR.percent = GetPercent(SR.lvl)
        
        if GetRandomInt(0,100) &lt;= SR.percent then
            call SR.PlusArmor()
            call SR.PlusDamage()
        endif
        
    call SR.destroy()
    return 0
    endmethod

endstruct

private function SRCond takes nothing returns boolean
if GetUnitAbilityLevel(GetEventDamageSource(),SR_Id) &gt; 0 then
    call StrReq.create(GetEventDamageSource(),GetTriggerUnit())
endif

return false
endfunction

//&lt;-- Damaged Main Engine --&gt;//
globals
    private trigger CALL_BACK = null
    private trigger PERIODIC = CreateTrigger()
endglobals

private function pickedCond takes nothing returns boolean
    return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)&gt;0 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction

private function pickedAct takes nothing returns nothing
    call TriggerRegisterUnitEvent(CALL_BACK,GetEnumUnit(),EVENT_UNIT_DAMAGED)
endfunction

private function PeriodicAct takes nothing returns nothing
local group picked = CreateGroup()

    //Setting Trigger
    if CALL_BACK != null then
        call DestroyTrigger(CALL_BACK)
    endif
    set CALL_BACK = CreateTrigger()
    call TriggerAddCondition(CALL_BACK,Condition(function SRCond))
    //End
    

    call GroupEnumUnitsInRect(picked, bj_mapInitialPlayableArea,Condition(function pickedCond))
    call ForGroup(picked, function pickedAct)
    
call DestroyGroup(picked)
set picked = null
endfunction
//&lt;-- Damaged Main Engine End --&gt;//


//===========================================================================
function InitTrig_Strength_Requiem takes nothing returns nothing
    call TriggerRegisterTimerEvent(PERIODIC,.1,true)
    call TriggerAddAction(PERIODIC,function PeriodicAct)
endfunction

endscope


i1625865_StrengthRequiem.jpg


Gold Transmittion
Code:
This unit has chances to poke a hole in its foe's poket and steals money from it.
Chances - 3 x Level.
Gold - 5 x Level.
JASS:
scope GoldTransmittion

//===================================================================================
//                                 Gold Transmittion                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Gold Transmittion
//  
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//--------------------------------------------------------------------------------
// -Optional
//  1. Import the icon in Import Manager to your map. It is Passive Transmute icon.
//===================================================================================
//  Implementation End                                 
//===================================================================================



//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//
//&lt;-------------------- Percentage --------------------&gt;//
private constant function GetPercent takes integer level returns integer
    return 3 * level    //3 * Level
endfunction
//&lt;------------------ Percentage End ------------------&gt;//

//&lt;-------------------- Gold --------------------&gt;//
private constant function GetGold takes integer level returns integer
    return 5 * level    //Gold stole when ability fired. ( 5 * Level )
endfunction
//&lt;------------------ Gold End ------------------&gt;//

globals
//  &lt;-------------------- Rawcode --------------------&gt;
//
    private constant integer GT_ID = &#039;A004&#039; 
//  Rawcode of Gold Transmittion
//
//  &lt;------------------ Rawcode End ------------------&gt;
//
//
//  &lt;-------------------- Special Effect --------------------&gt;
//
    private constant string  GT_SF = &quot;UI\\Feedback\\GoldCredit\\GoldCredit.mdl&quot;  
//  This is the special effect that will spawn when the ability is fired.      
//
//  &lt;------------------ Special Effect End------------------&gt;
//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
endglobals

globals
    private sound GT_SD
endglobals

private struct GoldT
unit atker
unit atked
integer lvl
integer perc
integer gold
texttag tt
texttag tt2
    
    method PlaySoundOnUnit takes sound soundHandle, real volumePercent, unit whichUnit returns nothing
        call AttachSoundToUnitBJ(soundHandle, whichUnit)
        call SetSoundVolumeBJ(soundHandle, volumePercent)
        call StartSound(soundHandle)
    endmethod
    
    
    method StealGold takes nothing returns nothing
        call SetPlayerState(GetOwningPlayer(.atked),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(.atked),PLAYER_STATE_RESOURCE_GOLD)-.gold)
        call SetPlayerState(GetOwningPlayer(.atker),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(.atker),PLAYER_STATE_RESOURCE_GOLD)+.gold)
        call DestroyEffect(AddSpecialEffectTarget(GT_SF,.atked,&quot;overhead&quot;))
        call DestroyEffect(AddSpecialEffectTarget(GT_SF,.atker,&quot;overhead&quot;))
        call .PlaySoundOnUnit(GT_SD,100, .atked)
    endmethod
    
    method CreateTT takes nothing returns nothing
    set .tt = CreateTextTag()
        call SetTextTagText(.tt,&quot;-&quot;+I2S(.gold),10 * 0.023 / 10)
        call SetTextTagVelocityBJ(.tt, 64,90)
        call SetTextTagPos(.tt, GetUnitX(.atked),GetUnitY(.atked),100)
        call SetTextTagPermanent(.tt,false)
        call SetTextTagFadepoint(.tt,1)
        call SetTextTagColor(.tt,255,255,1,255)
        call SetTextTagLifespan(.tt,2)
        
    set .tt2 = CreateTextTag()
        call SetTextTagText(.tt2,&quot;+&quot;+I2S(.gold),10 * 0.023 / 10)
        call SetTextTagVelocityBJ(.tt2, 64,90)
        call SetTextTagPos(.tt2, GetUnitX(.atker),GetUnitY(.atker),100)
        call SetTextTagPermanent(.tt2,false)
        call SetTextTagFadepoint(.tt2,1)
        call SetTextTagColor(.tt2,255,255,1,255)
        call SetTextTagLifespan(.tt2,2)
    endmethod
    
    static method create takes unit atk, unit atk_ed returns GoldT
    local GoldT GT = GoldT.allocate()
        set GT.atker = atk
        set GT.atked = atk_ed
        set GT.lvl = GetUnitAbilityLevel(atk, GT_ID)
        set GT.perc = GetPercent(GT.lvl)
        set GT.gold = GetGold(GT.lvl)
        
        if GetRandomInt(0,100) &lt;= GT.perc then
            call GT.StealGold()
            call GT.CreateTT()
        endif
        
    call GT.destroy()
    return 0
    endmethod

endstruct

private function GTCond takes nothing returns boolean
if GetUnitAbilityLevel(GetEventDamageSource(),GT_ID)&gt;0 then
    call GoldT.create(GetEventDamageSource(),GetTriggerUnit())
endif

return false
endfunction    

//&lt;-- Damaged Main Engine --&gt;//
globals
    private trigger CALL_BACK = null
    private trigger PERIODIC = CreateTrigger()
endglobals

private function pickedCond takes nothing returns boolean
    return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)&gt;0 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction

private function pickedAct takes nothing returns nothing
    call TriggerRegisterUnitEvent(CALL_BACK,GetEnumUnit(),EVENT_UNIT_DAMAGED)
endfunction

private function PeriodicAct takes nothing returns nothing
local group picked = CreateGroup()

    //Setting Trigger
    if CALL_BACK != null then
        call DestroyTrigger(CALL_BACK)
    endif
    set CALL_BACK = CreateTrigger()
    call TriggerAddCondition(CALL_BACK,Condition(function GTCond))
    //End
    

    call GroupEnumUnitsInRect(picked, bj_mapInitialPlayableArea,Condition(function pickedCond))
    call ForGroup(picked, function pickedAct)
    
call DestroyGroup(picked)
set picked = null
endfunction
//&lt;-- Damaged Main Engine End --&gt;//


//===========================================================================
function InitTrig_Gold_Transmittion takes nothing returns nothing
    call TriggerRegisterTimerEvent(PERIODIC,.1,true)
    call TriggerAddAction(PERIODIC,function PeriodicAct)
    

    set GT_SD = CreateSound( &quot;Abilities\\Spells\\Other\\Transmute\\AlchemistTransmuteDeath1.wav&quot;, false, true, true, 10, 10, &quot;CombatSoundsEAX&quot; )
    call SetSoundParamsFromLabel( GT_SD, &quot;TransmuteMissileImpact&quot; )
    call SetSoundDuration( GT_SD, 1601 )
endfunction

endscope

i1625864_GoldTransmittion.jpg


Critical Buff
Code:
This unit buffs nearby ally unit and gives them chances to deal critical damage.
Chances - 15+(10 x Level).
Multiply - 1.5+(0.5 x Level).
JASS:
scope CriticalBuff

//===================================================================================
//                                 Critical Buff                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Critical Strike [CS Buff]
//  2. Spell Book [CS Buff]
//  3. Critical Buff
//
//  [ Buff ]
//  1. Critical Buff
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//--------------------------------------------------------------------------------
//===================================================================================
//  Implementation End                                 
//===================================================================================

globals

//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//
//&lt;-------------------- Rawcode --------------------&gt;//
//
    private constant integer CB_ID = &#039;A007&#039;
//Rawcode of Critical Buff

    private constant integer CBR_ID = &#039;A005&#039;
//Rawcode of Critical Strike [CS Buff]

    private constant integer SB_ID = &#039;A006&#039;
//Rawcode of Spell Book [CS Buff]

    private constant integer CBBUFF_ID = &#039;B004&#039;
//Rawcode of the buff Critical Buff
//
//&lt;-------------------- Rawcode --------------------&gt;//
//
endglobals
//
//&lt;-------------------- Effect Range --------------------&gt;//
//
private constant function GetEffectRange takes integer lvl returns real
    return 450.+(100. * lvl)  //How far will this buff affect
endfunction
//
//&lt;-------------------- Effect Range End --------------------&gt;//

//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

//*******************************************************************************************
// FAQ
//*******************************************************************************************
//
// Q. How to adjust the critical strike data? (Multiply, percentage and others)
// A. All of these can be adjust at &quot;Critical Strike [CS Buff]&quot; ability.
//
// Q. Is the effect range should be the same as the one in &quot;Critical Buff&quot; ability?
// A. Yes, it should be the same or else it will malfunction, use a nice formula to make it accurately same as in object editor.
//
//*******************************************************************************************
// FAQ End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
    
globals    
    private group HOST = CreateGroup()
    private group CHILD = CreateGroup()
endglobals

private struct CritiBuff
        
        static method ChildCond takes nothing returns boolean
            return GetUnitAbilityLevel(GetFilterUnit(),CBBUFF_ID) &gt;0
        endmethod
    
        static method HostAct takes nothing returns nothing
        local unit host = GetEnumUnit()
        local unit leecher
        local integer lvl
        local real Er = GetEffectRange(GetUnitAbilityLevel(host,CB_ID))
        
            call GroupEnumUnitsInRange(CHILD, GetUnitX(host),GetUnitY(host),Er+9000,Condition(function CritiBuff.ChildCond))
            set leecher = FirstOfGroup(CHILD)
            set lvl = GetUnitAbilityLevel(host,CB_ID)
            
            loop
            exitwhen leecher == null
            //&lt;- Adding Real Buff -&gt;//
                if SquareRoot((GetUnitX(leecher)-GetUnitX(host)) * (GetUnitX(leecher)-GetUnitX(host)) + (GetUnitY(leecher)-GetUnitY(host)) * (GetUnitY(leecher)-GetUnitY(host))) &lt; Er+30 then 
                    if GetUnitAbilityLevel(leecher, CBR_ID) &lt; lvl then
                        call UnitAddAbility(leecher,SB_ID)
                        call SetUnitAbilityLevel(leecher, CBR_ID,lvl)
                        call SetPlayerAbilityAvailable(GetOwningPlayer(leecher),SB_ID,false)
                    endif
                elseif SquareRoot((GetUnitX(leecher)-GetUnitX(host)) * (GetUnitX(leecher)-GetUnitX(host)) + (GetUnitY(leecher)-GetUnitY(host)) * (GetUnitY(leecher)-GetUnitY(host))) &gt; Er+30 then
                    call UnitRemoveAbility(leecher, CBR_ID)
                    call UnitRemoveAbility(leecher, SB_ID)
                endif
       
            //&lt;- Adding Real Buff End -&gt;//
            call GroupRemoveUnit(CHILD,leecher)
            set leecher = FirstOfGroup(CHILD)
            endloop
        
        set leecher = null
        set host = null
        endmethod
    
        static method HostCond takes nothing returns boolean
            return GetUnitAbilityLevel(GetFilterUnit(),CB_ID) &gt; 0
        endmethod

        static method create takes nothing returns CritiBuff
        local CritiBuff cb = CritiBuff.allocate()
            call GroupEnumUnitsInRect(HOST,bj_mapInitialPlayableArea,Condition(function CritiBuff.HostCond))
            call ForGroup(HOST,function CritiBuff.HostAct)
        
        call cb.destroy()
        return 0
        endmethod

endstruct

//===========================================================================
function InitTrig_Critical_Buff takes nothing returns nothing
local trigger t = CreateTrigger()
    call TriggerAddAction(t, function CritiBuff.create)
    call TriggerRegisterTimerEvent(t,0.1,true)
endfunction

endscope

i1625863_CriticalBuff.jpg


Lucky Barrier
Code:
Can bashes any unit that attacks this unit.
7 x level %
Damage - 50 x level
Distance - 400  per second
Period - 00.25 x lvl
JASS:
scope LuckyBarrier

//===================================================================================
//                                    Lucky Barrier                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Lucky Barrier
//
//  [ Buff ]
//  1. Lucky Barrier
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//  2. Copy ABC to your map if you don&#039;t have one.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//  2. ABC system.
//--------------------------------------------------------------------------------
//===================================================================================
//  Implementation End                                 
//===================================================================================

//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//&lt;-------------------- Percentage --------------------&gt;//

private constant function GetPercentage takes integer lvl returns integer
    return lvl * 7 //lvl x 7
endfunction

//&lt;------------------ Percentage End ------------------&gt;//
//
//&lt;-------------------- Damage --------------------&gt;//

private constant function GetDamage takes integer lvl returns real
    return lvl * 50. //lvl x 50
endfunction

//&lt;-------------------- Damage End --------------------&gt;//
//
//&lt;-------------------- Period --------------------&gt;//

private constant function GetPeriod takes integer lvl returns real
    return .25 * lvl//0.25 * lvl
endfunction

//&lt;-------------------- Period End --------------------&gt;//
globals
//&lt;-------------------- Rawcode --------------------&gt;//

    private constant integer LB_ID = &#039;A008&#039; //Rawcode of Lucky Barrier Ability
    private constant integer LBBuff_ID = &#039;B005&#039; //Rawcode of Lucky Barrier Buff
    
//&lt;-------------------- Rawcode End --------------------&gt;//
//
//&lt;-------------------- Slide Rate --------------------&gt;//

    private constant real LB_SLIDE_RATE = 8. // Slide the unit x range per LB_SPD second
    
//&lt;-------------------- Slide Rate End --------------------&gt;//
//
//&lt;-------------------- Speed --------------------&gt;//

    private constant real LB_SPD = 0.02 //The current spd is 8 range per 0.02 sec. (Aka 400 range per second)

//&lt;-------------------- Speed End--------------------&gt;//
//
//&lt;-------------------- Effects --------------------&gt;//
    
    private constant string LB_KS_EFFECT = &quot;Abilities\\Spells\\NightElf\\SpiritOfVengeance\\SpiritOfVengeanceBirthMissile.mdl&quot;
    // ^ The effect that appear when knocking back a unit.
    
    private constant string LB_SHIELD_EFFECT = &quot;Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl&quot;
    // ^ The effect that appear at the caster when this spell is fired.
    
//&lt;-------------------- Effects End --------------------&gt;//
//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//

endglobals

private struct LBarrier
unit atked
unit atker
integer lvl
real array x [3]
real array y [3]
real newx
real newy
real stopx
real stopy
real BashAngle
real Counter = 0
real TotalPeriod
boolean fired
timer SlideT = CreateTimer()
    
    private static method slide takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local LBarrier lb = GetTimerStructA(t)
    set lb.newx = lb.x[2] + LB_SLIDE_RATE * Cos(lb.BashAngle * bj_DEGTORAD)
    set lb.newy = lb.y[2] + LB_SLIDE_RATE * Sin(lb.BashAngle * bj_DEGTORAD)
    
        call DestroyEffect(AddSpecialEffect(LB_KS_EFFECT,lb.newx, lb.newy))
        call IssueImmediateOrder(lb.atker, &quot;stop&quot;)
        
        //Check if Pathing Available
        if IsTerrainPathable(lb.newx, lb.newy, PATHING_TYPE_WALKABILITY) == false then    
            call SetUnitX(lb.atker, lb.newx)
            call SetUnitY(lb.atker, lb.newy)
        endif
        set lb.x[2] = GetUnitX(lb.atker)
        set lb.y[2] = GetUnitY(lb.atker)
    
        //The custom counting
        set lb.Counter = lb.Counter + LB_SPD
        if lb.Counter &gt;= lb.TotalPeriod then
            call lb.destroy()
        endif
    set t = null
    endmethod

    static method create takes unit attked, unit attacker returns LBarrier
    local LBarrier lb = LBarrier.allocate()
    set lb.atked = attked
    set lb.atker = attacker
    set lb.lvl = GetUnitAbilityLevel(lb.atked,LB_ID)
    set lb.fired = GetRandomInt(0,100) &lt;= (GetPercentage(lb.lvl)) and (IsUnitType(attacker, UNIT_TYPE_MELEE_ATTACKER) == true) and (IsUnitEnemy(attacker, GetOwningPlayer(attked))==true)
    set lb.x[1] = GetUnitX(attked)
    set lb.y[1] = GetUnitY(attked)
    set lb.x[2] = GetUnitX(attacker)
    set lb.y[2] = GetUnitY(attacker)
    set lb.BashAngle = bj_RADTODEG * (Atan2(lb.y[2] - lb.y[1], lb.x[2] - lb.x[1]))//atked --&gt; atker
    set lb.TotalPeriod = GetPeriod(lb.lvl)
    call SetTimerStructA(lb.SlideT, lb)
    
        
        if lb.fired == true then
            call DestroyEffect(AddSpecialEffectTarget(LB_SHIELD_EFFECT,lb.atked,&quot;origin&quot;)) //x3 to improve visual effects
            call DestroyEffect(AddSpecialEffectTarget(LB_SHIELD_EFFECT,lb.atked,&quot;origin&quot;))
            call DestroyEffect(AddSpecialEffectTarget(LB_SHIELD_EFFECT,lb.atked,&quot;origin&quot;))
            call UnitDamageTarget(lb.atked, lb.atker, GetDamage(lb.lvl),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
            call TimerStart(lb.SlideT,LB_SPD, true, function LBarrier.slide)
        elseif lb.fired == false then
            call lb.destroy()
            return 0
        endif
    
    return lb
    endmethod
    
    method onDestroy takes nothing returns nothing
        call PauseTimer(.SlideT)
        call ClearTimerStructA(.SlideT)
        call DestroyTimer(.SlideT)
    endmethod

endstruct

private function Cond takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(),LB_ID)&gt;0 then
    call LBarrier.create(GetTriggerUnit(), GetAttacker())
endif

return false
endfunction

//===========================================================================
function InitTrig_Lucky_Barrier takes nothing returns nothing
local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(t,Condition(function Cond))
endfunction

endscope

i1625866_LuckyBarrier.jpg

Download it here:

View attachment [Spell Pack] Passive v1.2.w3x
[Spell Pack] Passive v1.1.w3x
[Spell Pack] Passive v1.0.w3x


Q - Why use filefront instead of uploading to this site?
A - This is not the final version, people will critic me, and I will upload newer version. I will only upload the final version to TH.
A - I don't know why can't press the attachment button...
Code:
[B][U][I]Change Log[/I][/U][/B]
v1.2 - Fixed misc code issue pointed out by Andrewgosu and released a beta code. (But he didn't appear to check it out.)
     - Fixed a leak mistake pointed out by Tinki3. (CALL_BACK==null should be !=)
v1.1 - Fixed a bug pointed out by GoGo-Boy which the sliding doesn't stop because unit can't reach its destination. 
       (Fixed by changing system abit)
v1.0 - First released.
Feel free to critic me. :p
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
I don't know why I can't, the forum won't let me to click the attachment button.
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
I really like critical buff and lucky barrier, the other two aren't very innovative imo^^.
However, there seems to occur a bug with the bash-slide from lucky barrier when the unit is in water or gets pushed to water. Neither the special effect nor the sliding stops. You should fix that.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>However, there seems to occur a bug with the bash-slide from lucky barrier when the unit is in water or gets pushed to water. Neither the special effect nor the sliding stops. You should fix that.
Thanks for the report, I didn't test it before in water.

Edit -
Fixed that issue.
Cause - Unit unable to reach destination and caused a forever periodic timer.
Fixed - Changed the system a bit and it now uses timer to determine when should the knockback stop instead of when the unit reaches its destination.

Note - I will upload the map tomorrow or later on, report more issue is appreciated.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>i dont like the names, but i like the spells.
Sorry, but I do admit that I had no creativity of naming.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>Very innovative Spellpack.
I like the Critical buff one the most ^^

Well thanks.
Actually, that system could be modified to become a universal buff spell instead of just critical strike.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
JASS:
    private method DistBtwReal takes real x1, real y1, real x2, real y2 returns real
        return SquareRoot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)))
    endmethod
    
    private method offsetX takes real x1, real dist, real angle returns real
        return x1 + dist * Cos(angle * bj_DEGTORAD)
    endmethod
    
    private method offsetY takes real y1, real dist, real angle returns real
        return y1 + dist * Sin(angle * bj_DEGTORAD)
    endmethod
    
    private method AngBtwReal takes real x1, real y1, real x2, real y2 returns real
        return bj_RADTODEG * (Atan2(y2 - y1, x2 - x1))
    endmethod


You do know functions like these are worse than BJ's?

They add to function calls amount and aren't compatible like the BJ are.

Call them directly or I will murder some small animals. And I am dead-serious. Maybe.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>You do know functions like these are worse than BJ's?
Not all BJs are bad. TriggerRegisterAnyUnitEvent is the best example.

>>They add to function calls amount and aren't compatible like the BJ are.
Don't understand.

>>Call them directly or I will murder some small animals. And I am dead-serious. Maybe.
I could call the formula directly but instead I do it in a 2 step work.
1. For me, I had bad maths, I seperate them up to make it non-confuse when I debuging them.
2. It is more tidy, right? Or you would say a line of function call of 10 miles long would be tidy-er...

Don't murder small animals. It is not worth it.

I will try get more critic before updating the map. I'm not those guys which update a map once every bug found. More critic to be expected.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
I mean, every map has the 'blizzard.j' file, which contains all the BJ-functions. They are same for all. Compatible.

The functions you use are not. (The names already are untraditional, beginning in lower case)

You could have at least made them public and put them inside a library, so you wouldn't have to declare them more than once (function "DistBtwReal" is declared twice).

So they would be all-purpose, not spell-specific.


But that's not the point.

Why do "local real x = offsetX(x1, dist, angle)" if you can do it directly?

"local real x = x1 + dist * Cos(angle * bj_DEGTORAD)"

It saves a function call. The length of the code does not matter, the amount of function calls does.

The fewer the function call amount, the more smooth code. (That is especially important when dealing with timer-intensive spells)


In addition, I took a closer look at your code, and something really bothers me. And I will keep on nagging on you until it is fixed.

You should start to name your variables more descriptively! "e" for a unit is well, not good. Maybe it is for you, but not for other code readers, possible users.

Also, please, if you declare globals variables, write the names in capital letters!

I took me quite some time to find out where the variable "p" in function "pickedAct" for the 'Gold Transmittion' spell came.

NB!

"local unit e = GetEnumUnit()"
"call TriggerRegisterUnitEvent(p,e,EVENT_UNIT_DAMAGED)"
"set e = null"


Can be optimised to a single line of code.

"call TriggerRegisterUnitEvent(p, GetEnumUnit(), EVENT_UNIT_DAMAGED)"

Next, I don't see you destroying any triggeractions. They need to be destroyed. (Another option is to use conditions instead of triggeractions)
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>The functions you use are not. (The names already are untraditional, beginning in lower case)
Well, who stated that function's name must be begining in Upper Case?

>>You could have at least made them public and put them inside a library, so you wouldn't have to declare them more than once (function "DistBtwReal" is declared twice).
So they would be all-purpose, not spell-specific.

I seperate them is for spell-specific, because some spell might not need it, but you are also right of it, these things should be all-purpose.

If you want me to make them in a library, then every spell will need that specific library and will need do extra trigger copying... Or should I make the library spell specified? xD

>>"local real x = x1 + dist * Cos(angle * bj_DEGTORAD)"
Because I am bad in maths, and it is not even my standard to study those things... (I even don't know what Cos/Sin does.)
So I seperate them up into function calling is not to make me confusing myself when checking the code.

Hmm, there is also a way to solve this too. I will do then calculation directly, but I will add tons of comment in exchange. :p (I am serious.)

>>The fewer the function call amount, the more smooth code.
True, and I knew of it already. (Yea, just a milisecond.)

>>"e" for a unit is well, not good. Maybe it is for you, but not for other code readers, possible users.
Oh, it is the damaged system, which I made half a year ago.
I will change it. (Actually it represent "EnumUnit", so I uses the "E" for the name of the var.)

>>Also, please, if you declare globals variables, write the names in capital letters!
Well, who stated it again? Maybe I am not a programmer, I don't know what is your sight of view to a piece of code. But I, just think that those variable is for private use (Spell specified), so I will just simply name it (Atleast it is self explaining).

>>I took me quite some time to find out where the variable "p" in function "pickedAct" for the 'Gold Transmittion' spell came.
I should be easy to find it, Every thing inside the Damage System will not be anywhere but inside the comment border.

>>NB!
? "NB!"?

>>Can be optimised to a single line of code.
Well, yea. My knowledge ends at those 3 lines when I am half a year ago.

>>Next, I don't see you destroying any triggeractions. They need to be destroyed. (Another option is to use conditions instead of triggeractions)
Well, I have no knowledge about how triggeractions leaks.
I bet I need a tutorial on it, any?

I'll fix it by replacing the actions code into the Condition's function and make it always return false.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Well, who stated that function's name must be begining in Upper Case?

Functions in JASS start with a capital letter and each new words' first letter is capitalized, too.

"UnitAddAbility"
"AddSpecialEffect"


That is not a written law, but it's just the way it is.

On the other hand, when you use methods, it's fine to start the method name in lower case, but each word still needs to be separated by capitalizing.

"onDestroy"
"setSomething"


Because I am bad in maths, and it is not even my standard to study those things... (I even don't know what Cos/Sin does.)
So I seperate them up into function calling is not to make me confusing myself when checking the code.

Hmm, there is also a way to solve this too. I will do then calculation directly, but I will add tons of comment in exchange. :p (I am serious.)

You mean, you hide everything you don't know about to the deepest corners of the Earth and deny their existence? :)

What's so difficult about using the values directly?

Code:
private method offsetX takes real x1, real dist, real angle returns real
     return [B]x1[/B] + [B]dist[/B] * Cos([B]angle[/B] * bj_DEGTORAD)
endmethod

You just have to replace the text in bold with your values, instead calling the function.

Well, who stated it again? Maybe I am not a programmer, I don't know what is your sight of view to a piece of code. But I, just think that those variable is for private use (Spell specified), so I will just simply name it (Atleast it is self explaining).

Back in the days with no NewGen, one had to declare globals using the Variable Editor.

Every global variable has an 'udg_' prefix.' To separate them from local variables. Everyone was happy.

At present, you can declare globals with the help of NewGen and you don't have to write the prefixes anymore.

However, if there are no prefixes, how to separate globals from locals?

That's where block letters come to play.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>That is not a written law, but it's just the way it is.
So, can't it just my way it is? (Just my oppinion.)
If you demand it, I will change it.

My oppinion of it will be, it is a private function which is used by the spell, it doesn't needed to be showed to everyone or to be called everywhere.

>>You mean, you hide everything you don't know about to the deepest corners of the Earth and deny their existence?
False.
I do accept their existence but it is the fact the I don't know about it. I will try to evade it and make through it by the way I prefer and I understood.

>>What's so difficult about using the values directly?
No difficulties.

>>You just have to replace the text in bold with your values, instead calling the function.
I don't like reading maths afterwards. As you didn't answer my question in the early stage.

It is hard to be read afterwards if it is written in that way, atleast for me.
I would like to wrap them up nicely with the help of extra functions.

But I will change it if you demand it.

>>Back in the days with no NewGen, one had to declare globals using the Variable Editor.

Every global variable has an 'udg_' prefix.' To separate them from local variables. Everyone was happy.

Yea, true!
But during that time, I will rather uses locals and Kattana's system instead.
Don't compare the past and now. Past is past, now is now. :)

>>how to separate globals from locals?
Well, use you eyes and read? =.=''

I don't really sees a reason to stated out what variables are locals and what variables are locals.
It should not be called or used anywhere other than the system itself.
And the system is not used by anybody else, I, the one that understand it, is enough.

I will change it too, if you demand.

Well, nevermind, I did a big change on every code.

This is the Beta code, take a look. If it is ok, then I will remove all comment and update the map.
(Those comments is the older version of code, just in case they didn't work, I can revert it back.)
JASS:
scope StrengthRequiem

//===================================================================================
//                                 Strength Requiem                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Increase Armor [R] [StrengthRequiem]
//  2. Increase Damage [D] [StrengthRequiem]
//  3. Strength Requiem
//
//  [ Buff ]
//  1. Increase Armor [StrengthRequiem]
//  2. Increase Damage [StrengthRequiem]
//  3. Strength Requiem [StrengthRequiem]
//
//  [ Unit ]
//  1. Dummy +Armor/+Damage [StrengthRequiem]
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//--------------------------------------------------------------------------------
//===================================================================================
//  Implementation End                                 
//===================================================================================



//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//&lt;-------------------- Percentage --------------------&gt;//

private constant function GetPercent takes integer level returns integer
    return level*5   //Level * 5
endfunction

//&lt;------------------ Percentage End ------------------&gt;//

globals

//&lt;-------------------- Rawcode --------------------&gt;//
//
    private constant integer SR_Id = &#039;A000&#039;
//Rawcode of Strength Requiem

    private constant integer SR_Dm = &#039;A003&#039;
//Rawcode of Increase Damage [D] [Strength Requiem]

    private constant integer SR_Am = &#039;A001&#039;
//Rawcode of Increase Armor [A] [Strength Requiem]

    private constant integer SR_Dy = &#039;h001&#039;
//Rawcode of +Damage/Armor unit.
//
//&lt;------------------ Rawcode End ------------------&gt;//
//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//

endglobals



private struct StrReq
unit atker
unit trgerunit
integer lvl
integer percent
    
    method PlusArmor takes nothing returns nothing
    local unit u = CreateUnit(GetOwningPlayer(.atker),SR_Dy,GetUnitX(.atker),GetUnitY(.atker),0)
        call UnitAddAbility(u,SR_Am)
        call SetUnitAbilityLevel(u,SR_Am,.lvl)
        call UnitApplyTimedLife(u,&#039;BTLF&#039;,1)
        call IssueTargetOrder(u,&quot;innerfire&quot;,.trgerunit)
    set u = null
    endmethod
    
    method PlusDamage takes nothing returns nothing
    local unit u = CreateUnit(GetOwningPlayer(.atker),SR_Dy,GetUnitX(.atker),GetUnitY(.atker),0)
        call UnitAddAbility(u,SR_Dm)
        call SetUnitAbilityLevel(u,SR_Dm,.lvl)
        call UnitApplyTimedLife(u,&#039;BTLF&#039;,1)
        call IssueTargetOrder(u,&quot;innerfire&quot;,.atker)
    set u = null
    endmethod
    
    static method create takes unit atk, unit trg returns StrReq
        local StrReq SR = StrReq.allocate()
        set SR.atker = atk
        set SR.trgerunit = trg
        set SR.lvl = GetUnitAbilityLevel(SR.atker, SR_Id)
        set SR.percent = GetPercent(SR.lvl)
        
        if GetRandomInt(0,100) &lt;= SR.percent then
            call SR.PlusArmor()
            call SR.PlusDamage()
        endif
        
    call SR.destroy()
    return 0
    endmethod

endstruct

private function SRCond takes nothing returns boolean
    //return GetUnitAbilityLevel(GetEventDamageSource(),SR_Id) &gt; 0
if GetUnitAbilityLevel(GetEventDamageSource(),SR_Id) &gt; 0 then
    call StrReq.create(GetEventDamageSource(),GetTriggerUnit())
endif

return false
endfunction

//private function SRAct takes nothing returns nothing
//local StrReq SR = StrReq.create(GetEventDamageSource(),GetTriggerUnit())
//    if GetRandomInt(0,100) &lt;= SR.percent then
//        call SR.PlusArmor()
//        call SR.PlusDamage()
//    endif
//call SR.destroy()
//endfunction

//&lt;-- Damaged Main Engine --&gt;//
globals
    private trigger CALL_BACK = null//p = null
    private trigger PERIODIC = CreateTrigger()//time = CreateTrigger()
endglobals

private function pickedCond takes nothing returns boolean
    return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)&gt;0 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction

private function pickedAct takes nothing returns nothing
//local unit e = GetEnumUnit()
    call TriggerRegisterUnitEvent(CALL_BACK,GetEnumUnit(),EVENT_UNIT_DAMAGED)//p,GetEnumUnit(),EVENT_UNIT_DAMAGED)
//set e = null
endfunction

private function PeriodicAct takes nothing returns nothing//TimeAct takes nothing returns nothing
local group picked = CreateGroup()

    //Setting Trigger
    if CALL_BACK == null then//p != null then
        call DestroyTrigger(CALL_BACK)//p)
    endif
    set CALL_BACK = CreateTrigger()//p = CreateTrigger()
    call TriggerAddCondition(CALL_BACK,Condition(function SRCond))//p,Condition(function SRCond))
    //call TriggerAddAction(CALL_BACK, function SRAct )//p, function SRAct )
    //End
    

    call GroupEnumUnitsInRect(picked, bj_mapInitialPlayableArea,Condition(function pickedCond))
    call ForGroup(picked, function pickedAct)
    
call DestroyGroup(picked)
set picked = null
endfunction
//&lt;-- Damaged Main Engine End --&gt;//


//===========================================================================
function InitTrig_Strength_Requiem takes nothing returns nothing
    call TriggerRegisterTimerEvent(PERIODIC,.1,true)//time, .1, true)
    call TriggerAddAction(PERIODIC,function PeriodicAct)//time, function TimeAct)
endfunction

endscope

JASS:
scope GoldTransmittion

//===================================================================================
//                                   Gold Transmittion                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Gold Transmittion
//  
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//--------------------------------------------------------------------------------
// -Optional
//  1. Import the icon in Import Manager to your map. It is Passive Transmute icon.
//===================================================================================
//  Implementation End                                 
//===================================================================================



//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//
//&lt;-------------------- Percentage --------------------&gt;//
private constant function GetPercent takes integer level returns integer
    return 3 * level    //3 * Level
endfunction
//&lt;------------------ Percentage End ------------------&gt;//

//&lt;-------------------- Gold --------------------&gt;//
private constant function GetGold takes integer level returns integer
    return 5 * level    //Gold stole when ability fired. ( 5 * Level )
endfunction
//&lt;------------------ Gold End ------------------&gt;//

globals
//  &lt;-------------------- Rawcode --------------------&gt;
//
    private constant integer GT_ID = &#039;A004&#039; 
//  Rawcode of Gold Transmittion
//
//  &lt;------------------ Rawcode End ------------------&gt;
//
//
//  &lt;-------------------- Special Effect --------------------&gt;
//
    private constant string  GT_SF = &quot;UI\\Feedback\\GoldCredit\\GoldCredit.mdl&quot;  
//  This is the special effect that will spawn when the ability is fired.      
//
//  &lt;------------------ Special Effect End------------------&gt;
//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
endglobals

globals
    private sound GT_SD
endglobals

private struct GoldT
unit atker
unit atked
integer lvl
integer perc
integer gold
texttag tt
texttag tt2
    
    method PlaySoundOnUnit takes sound soundHandle, real volumePercent, unit whichUnit returns nothing
        call AttachSoundToUnitBJ(soundHandle, whichUnit)
        call SetSoundVolumeBJ(soundHandle, volumePercent)
        call StartSound(soundHandle)
    endmethod
    
    
    method StealGold takes nothing returns nothing
        call SetPlayerState(GetOwningPlayer(.atked),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(.atked),PLAYER_STATE_RESOURCE_GOLD)-.gold)
        call SetPlayerState(GetOwningPlayer(.atker),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(.atker),PLAYER_STATE_RESOURCE_GOLD)+.gold)
        call DestroyEffect(AddSpecialEffectTarget(GT_SF,.atked,&quot;overhead&quot;))
        call DestroyEffect(AddSpecialEffectTarget(GT_SF,.atker,&quot;overhead&quot;))
        call .PlaySoundOnUnit(GT_SD,100, .atked)
    endmethod
    
    method CreateTT takes nothing returns nothing
    set .tt = CreateTextTag()
        call SetTextTagText(.tt,&quot;-&quot;+I2S(.gold),10 * 0.023 / 10)
        call SetTextTagVelocityBJ(.tt, 64,90)
        call SetTextTagPos(.tt, GetUnitX(.atked),GetUnitY(.atked),100)
        call SetTextTagPermanent(.tt,false)
        call SetTextTagFadepoint(.tt,1)
        call SetTextTagColor(.tt,255,255,1,255)
        call SetTextTagLifespan(.tt,2)
        
    set .tt2 = CreateTextTag()
        call SetTextTagText(.tt2,&quot;+&quot;+I2S(.gold),10 * 0.023 / 10)
        call SetTextTagVelocityBJ(.tt2, 64,90)
        call SetTextTagPos(.tt2, GetUnitX(.atker),GetUnitY(.atker),100)
        call SetTextTagPermanent(.tt2,false)
        call SetTextTagFadepoint(.tt2,1)
        call SetTextTagColor(.tt2,255,255,1,255)
        call SetTextTagLifespan(.tt2,2)
    endmethod
    
    static method create takes unit atk, unit atk_ed returns GoldT
    local GoldT GT = GoldT.allocate()
        set GT.atker = atk
        set GT.atked = atk_ed
        set GT.lvl = GetUnitAbilityLevel(atk, GT_ID)
        set GT.perc = GetPercent(GT.lvl)
        set GT.gold = GetGold(GT.lvl)
        
        if GetRandomInt(0,100) &lt;= GT.perc then
            call GT.StealGold()
            call GT.CreateTT()
        endif
        
    call GT.destroy()
    return 0
    endmethod

endstruct

private function GTCond takes nothing returns boolean
    //return GetUnitAbilityLevel(GetEventDamageSource(),GT_ID)&gt;0
if GetUnitAbilityLevel(GetEventDamageSource(),GT_ID)&gt;0 then
    call GoldT.create(GetEventDamageSource(),GetTriggerUnit())
endif

return false
endfunction    

//function GTAct takes nothing returns nothing
//local GoldT GT = GoldT.create(GetEventDamageSource(),GetTriggerUnit())
//    if GetRandomInt(0,100) &lt;= GT.perc then
//        call GT.StealGold()
//        call GT.CreateTT()
//    endif
//call GT.destroy()
//endfunction

//&lt;-- Damaged Main Engine --&gt;//
globals
    private trigger CALL_BACK = null//p = null
    private trigger PERIODIC = CreateTrigger()//time = CreateTrigger()
endglobals

private function pickedCond takes nothing returns boolean
    return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)&gt;0 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction

private function pickedAct takes nothing returns nothing
//local unit e = GetEnumUnit()
    call TriggerRegisterUnitEvent(CALL_BACK,GetEnumUnit(),EVENT_UNIT_DAMAGED)//p,GetEnumUnit(),EVENT_UNIT_DAMAGED)
//set e = null
endfunction

private function PeriodicAct takes nothing returns nothing//TimeAct takes nothing returns nothing
local group picked = CreateGroup()

    //Setting Trigger
    if CALL_BACK == null then//p != null then
        call DestroyTrigger(CALL_BACK)//p)
    endif
    set CALL_BACK = CreateTrigger()//p = CreateTrigger()
    call TriggerAddCondition(CALL_BACK,Condition(function GTCond))//p,Condition(function SRCond))
    //call TriggerAddAction(CALL_BACK, function SRAct )//p, function SRAct )
    //End
    

    call GroupEnumUnitsInRect(picked, bj_mapInitialPlayableArea,Condition(function pickedCond))
    call ForGroup(picked, function pickedAct)
    
call DestroyGroup(picked)
set picked = null
endfunction
//&lt;-- Damaged Main Engine End --&gt;//


//===========================================================================
function InitTrig_Gold_Transmittion takes nothing returns nothing
    call TriggerRegisterTimerEvent(PERIODIC,.1,true)//time, .1, true)
    call TriggerAddAction(PERIODIC,function PeriodicAct)//time, function TimeAct)
    

    set GT_SD = CreateSound( &quot;Abilities\\Spells\\Other\\Transmute\\AlchemistTransmuteDeath1.wav&quot;, false, true, true, 10, 10, &quot;CombatSoundsEAX&quot; )
    call SetSoundParamsFromLabel( GT_SD, &quot;TransmuteMissileImpact&quot; )
    call SetSoundDuration( GT_SD, 1601 )
endfunction

endscope

JASS:
scope CriticalBuff

//===================================================================================
//                                 Critical Buff                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Critical Strike [CS Buff]
//  2. Spell Book [CS Buff]
//  3. Critical Buff
//
//  [ Buff ]
//  1. Critical Buff
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//--------------------------------------------------------------------------------
//===================================================================================
//  Implementation End                                 
//===================================================================================

globals

//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//
//&lt;-------------------- Rawcode --------------------&gt;//
//
    private constant integer CB_ID = &#039;A007&#039;
//Rawcode of Critical Buff

    private constant integer CBR_ID = &#039;A005&#039;
//Rawcode of Critical Strike [CS Buff]

    private constant integer SB_ID = &#039;A006&#039;
//Rawcode of Spell Book [CS Buff]

    private constant integer CBBUFF_ID = &#039;B004&#039;
//Rawcode of the buff Critical Buff
//
//&lt;-------------------- Rawcode --------------------&gt;//
//
endglobals
//
//&lt;-------------------- Effect Range --------------------&gt;//
//
private constant function GetEffectRange takes integer lvl returns real
    return 450.+(100. * lvl)  //How far will this buff affect
endfunction
//
//&lt;-------------------- Effect Range End --------------------&gt;//

//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

//*******************************************************************************************
// FAQ
//*******************************************************************************************
//
// Q. How to adjust the critical strike data? (Multiply, percentage and others)
// A. All of these can be adjust at &quot;Critical Strike [CS Buff]&quot; ability.
//
// Q. Is the effect range should be the same as the one in &quot;Critical Buff&quot; ability?
// A. Yes, it should be the same or else it will malfunction, use a nice formula to make it accurately same as in object editor.
//
//*******************************************************************************************
// FAQ End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
    
globals    
    private group HOST = CreateGroup()
    private group CHILD = CreateGroup()
endglobals

//private function DisBtwReal takes real x1, real y1, real x2, real y2 returns real
//    return SquareRoot((x2-x1) * (x2-x1) + (y2-y1) * (y2-y1))
//endfunction

private struct CritiBuff
        
        static method ChildCond takes nothing returns boolean
            return GetUnitAbilityLevel(GetFilterUnit(),CBBUFF_ID) &gt;0
        endmethod
    
        static method HostAct takes nothing returns nothing
        local unit host = GetEnumUnit()
        local unit leecher
        local integer lvl
        local real Er = GetEffectRange(GetUnitAbilityLevel(host,CB_ID))
        
            call GroupEnumUnitsInRange(CHILD, GetUnitX(host),GetUnitY(host),Er+9000,Condition(function CritiBuff.ChildCond))
            set leecher = FirstOfGroup(CHILD)
            set lvl = GetUnitAbilityLevel(host,CB_ID)
            
            loop
            exitwhen leecher == null
            //&lt;- Adding Real Buff -&gt;//
                //if DisBtwReal(GetUnitX(host),GetUnitY(host),GetUnitX(leecher),GetUnitY(leecher)) &lt; Er+30 then //Bug occurs that ally unit had buff but didn&#039;t affected.
                if SquareRoot((GetUnitX(leecher)-GetUnitX(host)) * (GetUnitX(leecher)-GetUnitX(host)) + (GetUnitY(leecher)-GetUnitY(host)) * (GetUnitY(leecher)-GetUnitY(host))) &lt; Er+30 then 
                    if GetUnitAbilityLevel(leecher, CBR_ID) &lt; lvl then
                        call UnitAddAbility(leecher,SB_ID)
                        call SetUnitAbilityLevel(leecher, CBR_ID,lvl)
                        call SetPlayerAbilityAvailable(GetOwningPlayer(leecher),SB_ID,false)
                    endif
                //elseif DisBtwReal(GetUnitX(host),GetUnitY(host),GetUnitX(leecher),GetUnitY(leecher)) &gt; Er+30 then
                elseif SquareRoot((GetUnitX(leecher)-GetUnitX(host)) * (GetUnitX(leecher)-GetUnitX(host)) + (GetUnitY(leecher)-GetUnitY(host)) * (GetUnitY(leecher)-GetUnitY(host))) &gt; Er+30 then
                    call UnitRemoveAbility(leecher, CBR_ID)
                    call UnitRemoveAbility(leecher, SB_ID)
                endif
       
            //&lt;- Adding Real Buff End -&gt;//
            call GroupRemoveUnit(CHILD,leecher)
            set leecher = FirstOfGroup(CHILD)
            endloop
        
        set leecher = null
        set host = null
        endmethod
    
        static method HostCond takes nothing returns boolean
            return GetUnitAbilityLevel(GetFilterUnit(),CB_ID) &gt; 0
        endmethod

        static method create takes nothing returns CritiBuff
        local CritiBuff cb = CritiBuff.allocate()
            call GroupEnumUnitsInRect(HOST,bj_mapInitialPlayableArea,Condition(function CritiBuff.HostCond))
            call ForGroup(HOST,function CritiBuff.HostAct)
        
        call cb.destroy()
        return 0
        endmethod

endstruct

//private function Actions takes nothing returns nothing
//local CritiBuff CB = CritiBuff.create()
//call CB.destroy()
//endfunction

//===========================================================================
function InitTrig_Critical_Buff takes nothing returns nothing
local trigger t = CreateTrigger()
    call TriggerAddAction(t, function CritiBuff.create)
    call TriggerRegisterTimerEvent(t,0.1,true)
endfunction

endscope

JASS:
scope LuckyBarrier

//===================================================================================
//                                    Lucky Barrier                                 
//                                by kentchow75/~GaLs~
//===================================================================================
//
// Implemention Instruction
// 
//--------------------------------------------------------------------------------
// -Object Needed to be copied from Object Editor to your map.
//  [ Ability ]
//  1. Lucky Barrier
//
//  [ Buff ]
//  1. Lucky Barrier
//--------------------------------------------------------------------------------
// -Trigger  
//  1. Copy this whole trigger to your map.
//  2. Copy ABC to your map if you don&#039;t have one.
//--------------------------------------------------------------------------------
// -Requirements
//  1. Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>. ( v4b and above )
//  2. ABC system.
//--------------------------------------------------------------------------------
//===================================================================================
//  Implementation End                                 
//===================================================================================

//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//&lt;-------------------- Percentage --------------------&gt;//

private constant function GetPercentage takes integer lvl returns integer
    return lvl * 7 //lvl x 7
endfunction

//&lt;------------------ Percentage End ------------------&gt;//
//
//&lt;-------------------- Damage --------------------&gt;//

private constant function GetDamage takes integer lvl returns real
    return lvl * 50. //lvl x 50
endfunction

//&lt;-------------------- Damage End --------------------&gt;//
//
//&lt;-------------------- Period --------------------&gt;//

private constant function GetPeriod takes integer lvl returns real
    return .25 * lvl//0.25 * lvl
endfunction

//&lt;-------------------- Period End --------------------&gt;//
globals
//&lt;-------------------- Rawcode --------------------&gt;//

    private constant integer LB_ID = &#039;A008&#039; //Rawcode of Lucky Barrier Ability
    private constant integer LBBuff_ID = &#039;B005&#039; //Rawcode of Lucky Barrier Buff
    
//&lt;-------------------- Rawcode End --------------------&gt;//
//
//&lt;-------------------- Slide Rate --------------------&gt;//

    private constant real LB_SLIDE_RATE = 8. // Slide the unit x range per LB_SPD second
    
//&lt;-------------------- Slide Rate End --------------------&gt;//
//
//&lt;-------------------- Speed --------------------&gt;//

    private constant real LB_SPD = 0.02 //The current spd is 8 range per 0.02 sec. (Aka 400 range per second)

//&lt;-------------------- Speed End--------------------&gt;//
//
//&lt;-------------------- Effects --------------------&gt;//
    
    private constant string LB_KS_EFFECT = &quot;Abilities\\Spells\\NightElf\\SpiritOfVengeance\\SpiritOfVengeanceBirthMissile.mdl&quot;
    // ^ The effect that appear when knocking back a unit.
    
    private constant string LB_SHIELD_EFFECT = &quot;Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl&quot;
    // ^ The effect that appear at the caster when this spell is fired.
    
//&lt;-------------------- Effects End --------------------&gt;//
//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//
// -----------------------&gt; Do not edit anything below this line. &lt;-----------------------//

endglobals

private struct LBarrier
unit atked
unit atker
integer lvl
real array x [3]
real array y [3]
real newx
real newy
real stopx
real stopy
real BashAngle
real Counter = 0
real TotalPeriod
boolean fired
timer SlideT = CreateTimer()
    
    //Formula
    //private method DistBtwReal takes real x1, real y1, real x2, real y2 returns real
    //    return SquareRoot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)))
    //endmethod
    
    //private method offsetX takes real x1, real dist, real angle returns real
    //    return x1 + dist * Cos(angle * bj_DEGTORAD)
    //endmethod
    
    //private method offsetY takes real y1, real dist, real angle returns real
    //    return y1 + dist * Sin(angle * bj_DEGTORAD)
    //endmethod
    
    //private method AngBtwReal takes real x1, real y1, real x2, real y2 returns real
    //    return bj_RADTODEG * (Atan2(y2 - y1, x2 - x1))
    //endmethod
    //Formula End
    
    private static method slide takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local LBarrier lb = GetTimerStructA(t)
    set lb.newx = lb.x[2] + LB_SLIDE_RATE * Cos(lb.BashAngle * bj_DEGTORAD)//lb.offsetX(lb.x[2], LB_SLIDE_RATE, lb.BashAngle)
    set lb.newy = lb.y[2] + LB_SLIDE_RATE * Sin(lb.BashAngle * bj_DEGTORAD)//lb.offsetY(lb.y[2], LB_SLIDE_RATE, lb.BashAngle)
    
        call DestroyEffect(AddSpecialEffect(LB_KS_EFFECT,lb.newx, lb.newy))
        call IssueImmediateOrder(lb.atker, &quot;stop&quot;)
        
        //Check if Pathing Available
        if IsTerrainPathable(lb.newx, lb.newy, PATHING_TYPE_WALKABILITY) == false then    
            call SetUnitX(lb.atker, lb.newx)
            call SetUnitY(lb.atker, lb.newy)
        endif
        set lb.x[2] = GetUnitX(lb.atker)
        set lb.y[2] = GetUnitY(lb.atker)
    
        //The custom counting
        set lb.Counter = lb.Counter + LB_SPD
        if lb.Counter &gt;= lb.TotalPeriod then
            call lb.destroy()
        endif
    set t = null
    endmethod

    static method create takes unit attked, unit attacker returns LBarrier
    local LBarrier lb = LBarrier.allocate()
    set lb.atked = attked
    set lb.atker = attacker
    set lb.lvl = GetUnitAbilityLevel(lb.atked,LB_ID)
    set lb.fired = GetRandomInt(0,100) &lt;= (GetPercentage(lb.lvl)) and (IsUnitType(attacker, UNIT_TYPE_MELEE_ATTACKER) == true) and (IsUnitEnemy(attacker, GetOwningPlayer(attked))==true)
    set lb.x[1] = GetUnitX(attked)
    set lb.y[1] = GetUnitY(attked)
    set lb.x[2] = GetUnitX(attacker)
    set lb.y[2] = GetUnitY(attacker)
    set lb.BashAngle = bj_RADTODEG * (Atan2(lb.y[2] - lb.y[1], lb.x[2] - lb.x[1]))//lb.AngBtwReal(lb.x[1],lb.y[1], lb.x[2], lb.y[2]) //atked --&gt; atker
    set lb.TotalPeriod = GetPeriod(lb.lvl)
    call SetTimerStructA(lb.SlideT, lb)
    
        
        if lb.fired == true then
            call DestroyEffect(AddSpecialEffectTarget(LB_SHIELD_EFFECT,lb.atked,&quot;origin&quot;)) //x3 to improve visual effects
            call DestroyEffect(AddSpecialEffectTarget(LB_SHIELD_EFFECT,lb.atked,&quot;origin&quot;))
            call DestroyEffect(AddSpecialEffectTarget(LB_SHIELD_EFFECT,lb.atked,&quot;origin&quot;))
            call UnitDamageTarget(lb.atked, lb.atker, GetDamage(lb.lvl),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
            call TimerStart(lb.SlideT,LB_SPD, true, function LBarrier.slide)
        elseif lb.fired == false then
            call lb.destroy()
            return 0
        endif
    
    return lb
    endmethod
    
    method onDestroy takes nothing returns nothing
        call PauseTimer(.SlideT)
        call ClearTimerStructA(.SlideT)
        call DestroyTimer(.SlideT)
    endmethod

endstruct

//private function Actions takes nothing returns nothing
//local LBarrier lb = LBarrier.create(GetTriggerUnit(), GetAttacker())
//endfunction

private function Cond takes nothing returns boolean
    //return GetUnitAbilityLevel(GetTriggerUnit(),LB_ID)&gt;0
if GetUnitAbilityLevel(GetTriggerUnit(),LB_ID)&gt;0 then
    call LBarrier.create(GetTriggerUnit(), GetAttacker())
endif

return false
endfunction

//===========================================================================
function InitTrig_Lucky_Barrier takes nothing returns nothing
local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(t,Condition(function Cond))
    //call TriggerAddAction(t,function Actions)
endfunction

endscope
 

Hatebreeder

So many apples
Reaction score
380
You changed the TriggerAddAction, to TriggerAddCondition, to avoid Leaks, right? :)
Anyways, good job on these Spells
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>You changed the TriggerAddAction, to TriggerAddCondition, to avoid Leaks, right?
I change it for the demand of andrew, but he is not looking at it...
 

Tinki3

Special Member
Reaction score
418
The beta codes are fine, replace all old triggers.

Though the line "if CALL_BACK == null then" in the Strength Requiem and Gold Transmission triggers needs to be "if CALL_BACK != null then".

You should also explain where to replace raw codes.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>Though the line "if CALL_BACK == null then" in the Strength Requiem and Gold Transmission triggers needs to be "if CALL_BACK != null then".
Why should I? It is for checking if the trigger is first time run in game or not, because if it is the first time, CALL_BACK is equal to null. After that, it will always return a value.

>>You should also explain where to replace raw codes.
I though I explained them??
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top