• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] How to modify this spell?

Status
Not open for further replies.
Level 8
Joined
Dec 16, 2007
Messages
252
This spell is not made by me. I pmed the creator but got no response.
Can someone tell me or post the new code, where it damages 8-12 damage per seconds and drains 10 mana per second? I know where the drain mana and damage lines are, but I don't know how to change them.

JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
        constant integer ArcticBlastID = 'A001'
        constant integer ArcticBoltID  = 'n002'
        constant real ArcticBlastSpeed  = 800
        constant integer IceSlowID = 'A000'
        constant integer IceSlowDummyID  = 'n001'
endglobals

struct arctic
    unit caster = null
    trigger hit = null
    timer move = null
    group blast = null
    real cx = 0.0
    real cy = 0.0
    real cost = 0.0
    real min = 0.0
    real max = 0.0
    real dur = 0.0
    real dis = 0.0
    integer interval = 0
    method onDestroy takes nothing returns nothing
        if .hit != null then
            call FlushHandleLocals(.hit)
            call TriggerClearActions(.hit)
            call DestroyTrigger(.hit)
        endif
        if .move != null then
            call FlushHandleLocals(.move)
            call DestroyTimer(.move)
        endif
        if .blast != null then
            call DestroyGroup(.blast)
        endif
   endmethod

endstruct

function ArcticBlastH takes nothing returns nothing
    local trigger t = GetTriggeringTrigger()
    local arctic arc = GetHandleInt(t,"ArcticBlast")
    local unit a = GetTriggerUnit()
    if not IsUnitAliveBJ(a) or not IsUnitEnemy(a,GetOwningPlayer(arc.caster)) then 
        return
    endif
    //when a is alive and a is an enemy, a takes damage (Still need more conditions)
    call UnitDamageTarget(arc.caster,a,GetRandomReal(arc.min,arc.max),false,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
    call IceSlowUnitTimed(a,arc.dur)
    set a = null
endfunction

function ArcticBlastGM takes nothing returns nothing
    local unit d = GetEnumUnit()
    if IsUnitAliveBJ(d) then
        call SetUnitPosition(d, TJGetPPX(GetUnitX(d),ArcticBlastSpeed/25,GetUnitFacing(d)), TJGetPPY(GetUnitY(d),ArcticBlastSpeed/25,GetUnitFacing(d)) )
    endif
    set d = null
endfunction

function ArcticBlastE takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local arctic arc = GetHandleInt(t,"ArcticBlast")
    local boolean b = true
    local string o
    local unit d
    if GetUnitState(arc.caster,UNIT_STATE_MANA)<arc.cost then
        call IssueImmediateOrder(arc.caster,"stop")
    endif
    set o = OrderId2String(GetUnitCurrentOrder(arc.caster))
    if o != "channel" or  arc.cx != GetUnitX(arc.caster) or arc.cy != GetUnitY(arc.caster) then
        set b = false
        call SetHandleInt(arc.caster,"ArcticBlast",0)
    endif

    if arc.interval > 0 and b then
        set arc.interval = arc.interval - 1
    elseif arc.interval == 0 and b then
        set d = CreateUnit(GetOwningPlayer(arc.caster),ArcticBoltID,TJGetPPX(GetUnitX(arc.caster),50,GetUnitFacing(arc.caster)), TJGetPPY(GetUnitY(arc.caster),50,GetUnitFacing(arc.caster)),GetUnitFacing(arc.caster))
        call SetUnitPathing(d,false)
        call SetUnitExploded(d,true)
        call TJSetUnitHeight(d,75)
        call UnitApplyTimedLife(d,'BTLF',arc.dis/ArcticBlastSpeed)
        call GroupAddUnit(arc.blast,d)
        call TriggerRegisterUnitInRange(arc.hit,d,125,null)
        set arc.interval = 2
        call SetUnitState(arc.caster,UNIT_STATE_MANA,GetUnitState(arc.caster,UNIT_STATE_MANA)-arc.cost)
    endif
    
    if IsUnitGroupDeadBJ(arc.blast) then
        call SetHandleInt(arc.caster,"ArcticBlast",0)
        call arctic.destroy(arc)
    else
        call ForGroup(arc.blast,function ArcticBlastGM)
    endif
    set d = null
endfunction

function ArcticBlast takes unit c, real min, real max, real dis, real dur,real cost returns nothing
    local arctic arc = GetHandleInt(c,"ArcticBlast")
    if arc == 0 then
        set arc = arctic.create()
        set arc.hit = CreateTrigger()
        call TriggerAddAction(arc.hit,function ArcticBlastH )
        set arc.move = CreateTimer()
        call TimerStart(arc.move,0.04,true, function ArcticBlastE)
        set arc.blast = CreateGroup()
        call SetHandleInt(arc.move,"ArcticBlast",arc)
        call SetHandleInt(arc.hit,"ArcticBlast",arc)
        call SetHandleInt(c,"ArcticBlast",arc)
    endif
    set arc.cx = GetUnitX(c)
    set arc.cy = GetUnitY(c)
    set arc.caster = c
    set arc.cost = cost
    set arc.min = min
    set arc.max = max
    set arc.dur = dur
    set arc.dis = dis
endfunction

function ArcticBlastC takes nothing returns boolean
    return GetSpellAbilityId() == ArcticBlastID
endfunction

function ArcticBlastA takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local integer lvl = GetUnitAbilityLevel(c,ArcticBlastID)
    call ArcticBlast(c,lvl*5,lvl*10,400+100*lvl,1,10)
    //damage formula: lvl*5*12.5 to lvl*10*12.5
    //damage = damage in tooltp / 12.5
    set c = null
endfunction

//===========================================================================
function InitTrig_ArcticBlast takes nothing returns nothing
    set gg_trg_ArcticBlast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ArcticBlast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_ArcticBlast, Condition( function ArcticBlastC ) )
    call TriggerAddAction( gg_trg_ArcticBlast, function ArcticBlastA )
endfunction
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I suggest you to actually know what you are using next time.
From flipping around the code I'd guess you'll need to do this changes:

call ArcticBlast(c,lvl*5,lvl*10,400+100*lvl,1,10)
Change the level*5 and level*10 to your minimum and maximum damage.

SetUnitState(arc.caster,UNIT_STATE_MANA,GetUnitState(arc.caster,UNIT_STATE_MANA)-arc.cost).
Instead of that -arc.cost put +10
 
Level 8
Joined
Dec 16, 2007
Messages
252
Why +10 and not -10?

And I think this trigger runs 0.04 seconds. And later it says the damage forumula will be lvl*x*12.5. So if it runs 0.04 and the number I put there will be multiplied by 12.5. Does it mean I have to do lvl*0.032 for making it deal 10 damage each second? (The 8-12 was just an example).

0.032 * 12.5 * 0.04 would be 10? But can JASS handle thoose small numbers?

(I meant 0.032 * 12.5 * 25 of course)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Why +10 and not -10?

And I think this trigger runs 0.04 seconds. And later it says the damage forumula will be lvl*x*12.5. So if it runs 0.04 and the number I put there will be multiplied by 12.5. Does it mean I have to do lvl*0.032 for making it deal 10 damage each second? (The 8-12 was just an example).

0.032 * 12.5 * 0.04 would be 10? But can JASS handle thoose small numbers?

Dunno, I can't see anything there with all those weird variable names (yey for not knowing how to name your variables, whoever made this) and I'm not going to study this code now.
Just try it and see.
And yes, reals can go to a very accurate number.
 
Status
Not open for further replies.
Top