View Single Post
Old 02-04-2007, 04:42 AM   #26
Join Date: Feb 2006
Posts: 11

deathreaper945 has little to show at this moment (0)


I've been going through this several damages, no movements or anything..I had errors for first few times, but once I got it, no damage. ><

Stomp Trigger:
Collapse JASS:
function Trig_Stomp_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A0ws'

function Stomp_Filter takes nothing returns boolean
    return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405 and not IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)

function Stomp_CopyGroup takes group g returns group
    set bj_groupAddGroupDest = CreateGroup()
    call ForGroup(g, function GroupAddGroupEnum)
    return bj_groupAddGroupDest

function Stomp_Move takes nothing returns nothing
    local string s = I2S(H2I(GetExpiredTimer()))
    local gamecache gc = udg_AbilityCache
    local real x = GetStoredReal(gc, s, "x")
    local real y = GetStoredReal(gc, s, "y")
    local integer i = GetStoredInteger(gc, s, "level")
    local group g = Stomp_CopyGroup(I2G(GetStoredInteger(gc, s, "group")))
    local real dur = GetStoredReal(gc, s, "dur")+0.05
    local real ux
    local real uy
    local real a
    local unit f
    local real p = GetStoredReal(gc, s, "speed")-0.5/(1+0.5*i)
    local real fx = GetStoredReal(gc, s, "fx")+0.05
    if dur < 1+0.5*i then
            set f = FirstOfGroup(g)
            exitwhen f == null
            set ux = GetUnitX(f)
            set uy = GetUnitY(f)
            set a = Atan2(uy-y, ux-x)
            call SetUnitPosition(f, ux+p*Cos(a), uy+p*Sin(a))
            if fx >= 1 then
                call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById('A0ws', EFFECT_TYPE_MISSILE, 1), f, GetAbilityEffectById('A0ws', EFFECT_TYPE_MISSILE, 2)))
            call GroupRemoveUnit(g, f)
        call StoreReal(gc, s, "dur", dur)
        call StoreReal(gc, s, "speed", p)
        call StoreReal(gc, s, "fx", fx)
        if fx >= 1 then
            call StoreReal(gc, s, "fx", 0)
        call DestroyGroup(I2G(GetStoredInteger(gc, s, "group")))
        call FlushStoredMission(gc, s)
        call DestroyTimer(GetExpiredTimer())
    set gc = null
    call DestroyGroup(g)
    set g = null
    set f = null

function Trig_Stomp_Actions takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local real x = GetUnitX(c)
    local real y = GetUnitY(c)
    local integer i = GetUnitAbilityLevel(c, 'A0ws')
    local boolexpr b = Condition(function Stomp_Filter)
    local group g = CreateGroup()
    local group n
    local unit f
    local gamecache gc = udg_AbilityCache
    local timer t = CreateTimer()
    local string s = I2S(H2I(t))
    call DestroyEffect(AddSpecialEffect(GetAbilityEffectById('A0ws', EFFECT_TYPE_MISSILE, 0), x, y))
    call GroupEnumUnitsInRange(g, x, y, 100+50*i, b)
    set n = Stomp_CopyGroup(g)
        set f = FirstOfGroup(n)
        exitwhen f == null
        call UnitDamageTarget(c, f, 25*i, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
        call GroupRemoveUnit(n, f)
    call StoreInteger(gc, s, "level", i)
    call StoreInteger(gc, s, "group", H2I(g))
    call StoreReal(gc, s, "x", x)
    call StoreReal(gc, s, "y", y)
    call TimerStart(t, 0.05, true, function Stomp_Move)
    set c = null
    call DestroyBoolExpr(b)
    set b = null
    set g = null
    call DestroyGroup(n)
    set n = null
    set f = null
    set gc = null
    set t = null

function InitTrig_Stomp takes nothing returns nothing
    set gg_trg_Stomp = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Stomp, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Stomp, Condition( function Trig_Stomp_Conditions ) )
    call TriggerAddAction( gg_trg_Stomp, function Trig_Stomp_Actions )
    call Preload(GetAbilityEffectById('A0ws', EFFECT_TYPE_MISSILE, 0))
    call Preload(GetAbilityEffectById('A0ws', EFFECT_TYPE_MISSILE, 1))

InitCache Trigger:
Collapse JASS:
function InitTrig_InitCache takes nothing returns nothing
    call FlushGameCache(InitGameCache("abilitycache.w3v"))
    set udg_AbilityCache = InitGameCache("abilitycache.w3v")

And last, Custom Script:
Collapse JASS:
function H2I takes handle h returns integer
    return h
    return 0

function I2G takes integer i returns group
    return i
    return null

P.S. I used JassCraft also. Sorry for bump.
deathreaper945 is offline   Reply With Quote