• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Spell Problem

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2008
Messages
253
Hello everybody, I'm having some problems with own of my spells I made.

Here is the code:

JASS:
function Trig_Divine_Storm_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01I'
endfunction

function Trig_Divine_Storm_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local real damage
    //No Command//
    local real damage1 = 700
    local real damage2 = 1050
    //Command Bonus//
    local real bonus1 = 300
    local real bonus2 = 450
    //----------//
    local group g
    local unit u
    local texttag text
    local integer random
    local location loc = GetUnitLoc(caster)
    local location loc2
    local player p = GetOwningPlayer(caster)
    local string sfx = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
    local real heal = 150
    //Actions//
    set g = GetUnitsInRangeOfLocAll(250, loc)
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if IsUnitEnemy(u, p) then
            if IsUnitAliveBJ(u) then
                if UnitHasBuffBJ( caster , 'B006' ) then
                    set loc2 = GetUnitLoc(u)
                    set random = GetRandomInt( 1 , 100 )
                    if random < udg_CritChance[GetConvertedPlayerId(GetOwningPlayer( caster ))] then            
                        set damage = damage2
                        set random = GetRandomInt( 1 , 100 )
                        if random < udg_CritChance[GetConvertedPlayerId(GetOwningPlayer( caster ))] then            
                            set damage = damage + bonus2
                            call UnitDamageTarget( caster , u , damage , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
                            if GetLocalPlayer() == p then
                                set text = CreateTextTagLocBJ( ( I2S(R2I( damage )) + "!" ), loc2 , 0 , 11.00 , 100 , 100 , 20 , 0 )
                                call SetTextTagVelocityBJ( text , 64, 90 )
                                call SetTextTagPermanentBJ( text , false )
                                call SetTextTagLifespanBJ( text , 1.5 )
                                call SetTextTagFadepointBJ( text , 1 )
                            endif
                        else
                            set damage = damage + bonus1
                            call UnitDamageTarget( caster , u , damage , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
                            if GetLocalPlayer() == p then
                                set text = CreateTextTagLocBJ( ( I2S(R2I( damage )) + "!" ), loc2 , 0 , 11.00 , 100 , 100 , 20 , 0 )
                                call SetTextTagVelocityBJ( text , 64, 90 )
                                call SetTextTagPermanentBJ( text , false )
                                call SetTextTagLifespanBJ( text , 1.5 )
                                call SetTextTagFadepointBJ( text , 1 )
                            endif
                        endif
                    else
                        set damage = damage1
                        set random = GetRandomInt( 1 , 100 )
                        if random < udg_CritChance[GetConvertedPlayerId(GetOwningPlayer( caster ))] then            
                            set damage = damage + bonus2
                            call UnitDamageTarget( caster , u , damage , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
                            if GetLocalPlayer() == p then
                                set text = CreateTextTagLocBJ( ( I2S(R2I( damage )) + "!" ), loc2 , 0 , 10.00 , 100 , 100 , 50 , 0 )
                                call SetTextTagVelocityBJ( text , 64, 90 )
                                call SetTextTagPermanentBJ( text , false )
                                call SetTextTagLifespanBJ( text , 1.5 )
                                call SetTextTagFadepointBJ( text , 1 )
                            endif
                        else
                            set damage = damage + bonus1
                            call UnitDamageTarget( caster , u , damage , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
                            if GetLocalPlayer() == p then
                                set text = CreateTextTagLocBJ( ( I2S(R2I( damage )) + "!" ), loc2 , 0 , 10.00 , 100 , 100 , 50 , 0 )
                                call SetTextTagVelocityBJ( text , 64, 90 )
                                call SetTextTagPermanentBJ( text , false )
                                call SetTextTagLifespanBJ( text , 1.5 )
                                call SetTextTagFadepointBJ( text , 1 )
                            endif
                        endif              
                    endif
                else
                    if random < udg_CritChance[GetConvertedPlayerId(GetOwningPlayer( caster ))] then            
                        set damage = damage2
                        call UnitDamageTarget( caster , u , damage , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
                        if GetLocalPlayer() == p then
                            set text = CreateTextTagLocBJ( ( I2S(R2I( damage )) + "!" ), loc2 , 0 , 10.00 , 100 , 100 , 50 , 0 )
                            call SetTextTagVelocityBJ( text , 64, 90 )
                            call SetTextTagPermanentBJ( text , false )
                            call SetTextTagLifespanBJ( text , 1.5 )
                            call SetTextTagFadepointBJ( text , 1 )
                        endif
                    else
                        set damage = damage1
                        call UnitDamageTarget( caster , u , damage , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
                        if GetLocalPlayer() == p then
                            set text = CreateTextTagLocBJ( ( I2S(R2I( damage )) + "!" ), loc2 , 0 , 8.00 , 100 , 100 , 50 , 0 )
                            call SetTextTagVelocityBJ( text , 64, 90 )
                            call SetTextTagPermanentBJ( text , false )
                            call SetTextTagLifespanBJ( text , 1.5 )
                            call SetTextTagFadepointBJ( text , 1 )
                        endif                    
                    endif
                    call RemoveLocation(loc2)
                    set loc2 = null                     
                endif     
            endif
        else
            if IsUnitAliveBJ(u) then
                call SetUnitState( u ,UNIT_STATE_LIFE, GetUnitState( u , UNIT_STATE_LIFE ) + heal )
            endif
        endif
        call GroupRemoveUnit(g,u)
        set u = null
    endloop
    call DestroyGroup(g)
    call RemoveLocation(loc)
    //Actions//
    set caster = null
    set g = null
    set loc = null
endfunction

//===========================================================================
function InitTrig_Divine_Storm takes nothing returns nothing
    set gg_trg_Divine_Storm = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Divine_Storm, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Divine_Storm, Condition( function Trig_Divine_Storm_Conditions ) )
    call TriggerAddAction( gg_trg_Divine_Storm, function Trig_Divine_Storm_Actions )
endfunction

The problem is that it doesn't do anything at all.

Thanks in advance, Quetzalcotl
 
Status
Not open for further replies.
Top