• 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.

Need help with a BIG Spell

Status
Not open for further replies.
Level 19
Joined
Aug 24, 2007
Messages
2,888
Warning Only PRO help requested with this spell
So I dont want to see replies like "omg JASS sucks use GUI" or anything like this

My problem is prison_spell1 and takeout_spell1 causes thread crash

Here spell goes

JASS:
globals
group udg_dummygroup_spell1
endglobals

constant function spellid_spell1 takes nothing returns integer
return 'A000' // Spell ID
endfunction
constant function shardspersecond_spell1 takes nothing returns integer
return 10 // shards per second
endfunction
constant function dummyunit_spell1 takes nothing returns integer
return 'u000' // dummy unit ID (locust)
endfunction
constant function dummyspellid_spell1 takes nothing returns integer
return 'A001' // ID of spell that casted to units like slow on hit
// Also level of this spell increases with level of main spell 
endfunction
constant function dummyspellorder_spell1 takes nothing returns string
return "frostnova" // Order string of Dummy Spell
// type an invaild string for no spell
endfunction
constant function shardslows_spell1 takes nothing returns boolean
return true  // Determines if Each shard does a slowing effect on enemies
endfunction
constant function spellslows_spell1 takes nothing returns boolean
return true  // Determines if finishing strike_spell1 does slowing effect
endfunction
constant function destructableid_spell1 takes nothing returns integer
return 'IRic' // ID of destructable that makes prison
endfunction
constant function duration_spell1 takes nothing returns real
return 2.00 // How long the rain will continue
endfunction
constant function durationlevelfactor_spell1 takes nothing returns real
return 1.00 // Level Factor of rain duration
endfunction
constant function shardbasedamage_spell1 takes nothing returns real
return 50.00 // Base Damage of a Shard
endfunction
constant function shardlevelfactordamage_spell1 takes nothing returns real
return 25.00 // Level factor of Shard Damage
endfunction
constant function shardspellarea_spell1 takes nothing returns real
return 100.00 // Area of Effect which one shard has
endfunction
constant function shardspellarealevelfactor_spell1 takes nothing returns real
return 10.00 // Level factor of Area of Effect of one shard
endfunction
constant function spellarea_spell1 takes nothing returns real
return 300.00 // Area of Effect of Spell
endfunction
constant function spellarealevelfactor_spell1 takes nothing returns real
return 50.00 // Level Factor of AoE for spell
endfunction
constant function spellfinaldamage_spell1 takes nothing returns real
return 400.00 // Final Damage that spell does
endfunction
constant function spellfinaldamagelevelfactor_spell1 takes nothing returns real
return 100.00 // level factor of Final Damage that spell does
endfunction
constant function spellprisoncreate_spell1 takes nothing returns boolean
return true  //  Determines if spell creates a prison to block enemies inside it
endfunction
constant function spelltakealliesout_spell1 takes nothing returns boolean
return true // Determines if spell takes allies out of spell area
endfunction
constant function spelldamageallies_spell1 takes nothing returns boolean
return false // Determines if spell damages allies too
endfunction
constant function spellexplodetargets_spell1 takes nothing returns boolean
return true // Determines if spell kills enemies with exploding (like mortars do)
endfunction

function takeout_spell1 takes unit caster, real x, real y, integer s returns nothing

local unit u
local integer s
local real x2
local real y2
local real r = spellarea_spell1()+spellarealevelfactor_spell1()*s
local group g  = CreateGroup()
call GroupEnumUnitsInRange(g,x,y,r,Filter(null))
loop
set u = FirstOfGroup(g )
exitwhen u == null
    if  IsUnitAlly(u,GetOwningPlayer(caster))  then
    set x2 = GetUnitX(u )
    set y2 = GetUnitY(u )
        if x == x2 then
            set x2 = x2+1
        endif
            
        if y == y2 then
            set y2 = y2+1
        endif
        call SetUnitX(u,x+(r+50)*Cos(Atan((y2-y)/(x2-x))))
        call SetUnitY(u,y+(r+50)*Sin(Atan((y2-y)/(x2-x))))
    endif
call GroupRemoveUnit(g,u)
endloop

endfunction

function prison_spell1 takes real x,real y,integer s returns nothing
local destructable array des
local real dir
local integer a =0
local integer s
local real r = spellarea_spell1()+spellarealevelfactor_spell1()*s
loop
exitwhen a == R2I(r/10)
set des[a] = CreateDestructableLoc(destructableid_spell1(),Location(x+r*Cos((360/(r/10))*a),y+r*Sin((360/(r/10))*a)),0,1,0)
set a = a+1
endloop
call TriggerSleepAction(duration_spell1()+durationlevelfactor_spell1()*s)
set a = 0
loop
exitwhen a == R2I(r/10)
call KillDestructable(des[a])
set a = a+1
endloop

endfunction


function spellcaster_spell1 takes player owner, integer spell,integer level,string spellorder, unit target returns nothing
local unit caster
local real x
local real y
set x = GetUnitX(target)
set y = GetUnitY(target)
set caster = CreateUnitAtLoc(owner,dummyunit_spell1(),Location(x,y),bj_UNIT_FACING)
call UnitAddAbility(caster,spell)
call SetUnitAbilityLevel(caster,spell,level)
call IssueTargetOrder(caster,spellorder,target)
call UnitApplyTimedLife(caster,'BTLF',5)
set caster = null
set target = null
endfunction

function DamageArea_spell1 takes unit attacker, location point, real area, real damage,integer a returns nothing
    local unit u
    local group g = CreateGroup()
    local player p = GetOwningPlayer(attacker)
    call GroupEnumUnitsInRange(g,GetLocationX(point),GetLocationY(point),area,Filter(null))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if IsUnitEnemy(u,p) and GetWidgetLife(u) > 0 and not (IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) or IsUnitType(u,UNIT_TYPE_STRUCTURE)) then
            if spellexplodetargets_spell1() then
            call SetUnitExploded(u,true)
            endif
            call UnitDamageTarget(attacker,u,damage,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
            if spellexplodetargets_spell1() then
            call SetUnitExploded(u,false)
            endif
            call spellcaster_spell1(GetOwningPlayer(attacker),dummyspellid_spell1(),a,dummyspellorder_spell1(),u)
        endif
        if  spelldamageallies_spell1() and IsUnitAlly(u,p) and GetWidgetLife(u) > 0 and not (IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) or IsUnitType(u,UNIT_TYPE_STRUCTURE)) then
            if spellexplodetargets_spell1() then
            call SetUnitExploded(u,true)
            endif
            call UnitDamageTarget(attacker,u,damage,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
            if spellexplodetargets_spell1() then
            call SetUnitExploded(u,false)
            call spellcaster_spell1(GetOwningPlayer(attacker),dummyspellid_spell1(),a,dummyspellorder_spell1(),u)
            endif
        endif
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    set g = null
    set p = null
    set attacker = null
    set point = null
endfunction   
function strikeac_spell1 takes nothing returns nothing
local group g = CreateGroup()
local unit u
local location tar
local rect reg
local integer a
local effect e
local unit caster
call GroupAddGroup(udg_dummygroup_spell1,g)
loop
set u = FirstOfGroup(g)
exitwhen u == null
if GetUnitTypeId(u) == dummyunit_spell1() then
set a = GetUnitUserData(u)
set reg = RectFromCenterSizeBJ(GetUnitLoc(u), spellarea_spell1()+a*spellarealevelfactor_spell1()+100, spellarea_spell1()+a*spellarealevelfactor_spell1()+100)
set tar = GetRandomLocInRect(reg)
set e = AddSpecialEffect("Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl",GetLocationX(tar),GetLocationY(tar))
set caster = CreateUnitAtLoc(GetOwningPlayer(u),dummyunit_spell1(),tar,bj_UNIT_FACING)
call SetUnitUserData(caster,a)
call UnitAddAbility(caster,'Abu2')
call IssueImmediateOrder(caster,"burrow")
set caster = null
call DamageArea_spell1(u,tar,shardspellarea_spell1()+a*shardspellarealevelfactor_spell1(),shardbasedamage_spell1()+shardlevelfactordamage_spell1()*a,a)
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
call DestroyEffect(e)
set g = null
call RemoveLocation(tar)
set tar = null
call RemoveRect(reg)
set reg = null
endfunction


function dummyac_spell1 takes nothing returns nothing
local unit dummyu
local unit caster = GetTriggerUnit()
local location pos = GetSpellTargetLoc()
local integer a = GetUnitAbilityLevel(caster,spellid_spell1())
if  ( GetSpellAbilityId() == spellid_spell1() )  then
if spelltakealliesout_spell1() then
call takeout_spell1(caster,GetLocationX(pos),GetLocationY(pos),a)
endif
if spellprisoncreate_spell1() then
call prison_spell1(GetLocationX(pos),GetLocationY(pos),a)
else
set dummyu = CreateUnitAtLoc(GetOwningPlayer(caster),dummyunit_spell1(),pos,bj_UNIT_FACING)
call SetUnitUserData(dummyu,GetUnitAbilityLevel(caster,spellid_spell1()))
call GroupAddUnit(udg_dummygroup_spell1,dummyu)


call TriggerSleepAction(duration_spell1()+durationlevelfactor_spell1()*a)
endif
call TriggerSleepAction(0.5)
call DamageArea_spell1(dummyu,pos,spellarea_spell1()+spellarealevelfactor_spell1()*a,spellfinaldamage_spell1()+spellfinaldamagelevelfactor_spell1()*a,a)
call GroupRemoveUnit(udg_dummygroup_spell1,dummyu)
call KillUnit(dummyu)
set dummyu = null
call RemoveLocation(pos)
set caster = null
endif
endfunction

function damageac_spell1 takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer a = GetUnitUserData(u)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
if GetSpellAbilityId() == 'Abu2' then
call RemoveUnit(u)
call TriggerSleepAction(3.5)
call DamageArea_spell1(u,Location(x,y),shardspellarea_spell1()+a*shardspellarealevelfactor_spell1(),shardbasedamage_spell1()+shardlevelfactordamage_spell1()*a,a)
endif
endfunction
//===========================================================================

function InitTrig_Blizzard_Field takes nothing returns nothing
    local trigger strike_spell1
    local trigger dummy_spell1
    local trigger damage_spell1
    set  dummy_spell1 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( dummy_spell1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( dummy_spell1, function dummyac_spell1 )
    set  strike_spell1 = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( strike_spell1, 1/I2R(shardspersecond_spell1()) )
    call TriggerAddAction( strike_spell1, function strikeac_spell1 )
    set  damage_spell1 = CreateTrigger(  )
      call TriggerRegisterAnyUnitEventBJ( damage_spell1, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddAction( damage_spell1, function damageac_spell1 )
endfunction
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
Why I couldnt see that thanks
this is totally lame
I should kill myself

Well
Im gonna publish it when its finished

I like working with AoE's single spells sound " -.- " to me :p
 
Status
Not open for further replies.
Top