• 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] Another spell to fix..

Status
Not open for further replies.
Level 3
Joined
Dec 24, 2006
Messages
68
i just need to make this spell MUI, its converted to jass because i wasnt sure can it be obtained by GUI. Yes i know its huge :p


removed crappy code for better viewing
 
Last edited:
Level 11
Joined
Oct 13, 2005
Messages
233
Don't convert spells like this to GUI, make them starting in JASS. GUI adds way more functions for conditions than is reasonable (1 is reasonable, 10 or whatever you have there is not!). There's really too much there that's errors from GUI to even bother with. If you start the spell in JASS, it'll make you more familiar with JASS so you'll be able to do it for the next spell you make.

If you need any help with starting the spell fresh from JASS, just ask.
 
Level 3
Joined
Dec 24, 2006
Messages
68
so will you help to make it with jass from scratch? :p

well i dont know is it good, but thats what i done
JASS:
function Trig_CtD_Conditions takes nothing returns boolean
   return GetSpellAbilityId() == 'A00N'
endfunction

function Trig_CtD_Func1 takes nothing returns boolean
local unit a  = GetTriggerUnit()
return GetBooleanAnd((UnitHasBuffBJ(GetFilterUnit(), 'B002') == true), (IsUnitAliveBJ(a) == true))
endfunction


function Trig_CtD_Func2 takes nothing returns nothing
 local unit a = GetTriggerUnit()
 local unit b = GetEnumUnit()
 local lightning light
    call AddLightningLoc( "AFOD", GetUnitLoc(a), GetUnitLoc(b) )
    set light = GetLastCreatedLightningBJ()
    call UnitDamageTargetBJ( a, b, 350.00, ATTACK_TYPE_NORMAL, 
DAMAGE_TYPE_DEATH )
    call DestroyLightning(light)
endfunction



function Trig_CtD_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local integer loopv = 0
local group temp

if  ( GetUnitAbilityLevel( a, 'A00N') == 1 ) the
set loopv = 1
    loop
        exitwhen loopv > 10
        if ( IsUnitAliveBJ(a) == false )  then
        set loopv = 10
        else
        set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) )  )
       call ForGroup( temp, function Trig_CtD_Func2 )
        endif
    endloop
    else
    if  ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then
set loopv = 1
    loop
        exitwhen loopv > 20
        if ( IsUnitAliveBJ(a) == false )  then
        set loopv = 10
        else
        set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) )  )
        call ForGroup( temp, function Trig_CtD_Func2 )
        endif
    endloop
    else
        if  ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then
set loopv = 1
    loop
        exitwhen loopv > 30
        if ( IsUnitAliveBJ(a) == false )  then
        set loopv = 10
        else
        set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) )  )
        call ForGroup( temp, function Trig_CtD_Func2 )
        endif
    endloop
    endif
   endif
  endif
endfunction

function InitTrig_CtD takes nothing returns nothing
    set gg_trg_CtD = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_CtD, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_CtD, Condition( function Trig_CtD_Conditions ) )
    call TriggerAddAction( gg_trg_CtD, function Trig_CtD_Actions )
endfunction

can someone point wrong functions, leaks etc.? damn just tested it and doesnt work ;/
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Please state what you want it to do, some of us might like guessing games but most of us do not.

call AddLightningLoc( "AFOD", GetUnitLoc(a), GetUnitLoc(b) )
Leaks 2 locations
set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
Leaks 1 location, 1 group and 1 Condition Function

You forgot to null your local variables (handle ones like locations, units, groups). This helps stop leaks.

I will be able to help more if you describe your spell better.
 
Level 3
Joined
Dec 24, 2006
Messages
68
its suposed to create lightning beetwen random unit from units under effect of ability and unit which casts this ability, the lightning isnt created and unit isnt damaged, better now? :p

JASS:
function Trig_CtD_Conditions takes nothing returns boolean

   return GetSpellAbilityId() == 'A00N'

endfunction


function Trig_CtD_Func1 takes nothing returns boolean


return GetBooleanAnd((UnitHasBuffBJ(GetFilterUnit(), 'B002') == true), (IsUnitAliveBJ(udg_Caster_Unit) == true))

endfunction


function Trig_CtD_Func2 takes nothing returns nothing


 local unit tmp = GetEnumUnit()
 local unit q = GetSpellAbilityUnit()
 local lightning A

    call AddLightning("AFOD", True, GetX(q), GetY(a), GetX(tmp), GetY(tmp)

    set A = GetLastCreatedLightningBJ()

    call UnitDamageTargetBJ( q, tmp, 350.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DEATH )
   
    call DestroyLightning(A)

endfunction



function Trig_CtD_Actions takes nothing returns nothing

local unit a = GetSpellAbilityUnit()

local integer loopv = 0

local group temp

set udg_Caster_Unit = GetSpellAbilityUnit()



if  ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then

set loopv = 1

    loop

        exitwhen loopv > 10

        if ( IsUnitAliveBJ(a) == false )  then

        set loopv = 10

        else

        set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) )  )

        call ForGroup( temp, function Trig_CtD_Func2 )
        
        set loopv = loopv + 1

        endif

    endloop

    else

    if  ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then

set loopv = 1

    loop

        exitwhen loopv > 20

        if ( IsUnitAliveBJ(a) == false )  then

        set loopv = 10

        else

        set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) )  )

        call ForGroup( temp, function Trig_CtD_Func2 )
        
         set loopv = loopv + 1

        endif

    endloop

    else

        if  ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then

set loopv = 1

    loop

        exitwhen loopv > 30

        if ( IsUnitAliveBJ(a) == false )  then

        set loopv = 10

        else

        set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) )  )

        call ForGroup( temp, function Trig_CtD_Func2 )
        
        set loopv = loopv + 1

        endif

    endloop

    endif

   endif

  endif

endfunction

//===========================================================================

function InitTrig_CtD takes nothing returns nothing

    set gg_trg_CtD = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_CtD, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_CtD, Condition( function Trig_CtD_Conditions ) )
    call TriggerAddAction( gg_trg_CtD, function Trig_CtD_Actions )

endfunction
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Sorry, your spell makes no sense.

Trig_CtD_Func2 makes no snese, the lightning is destroied as soon as it is made.

Trig_CtD_Actions uses too many if then actions (could be condesned into one)

set udg_Caster_Unit = GetSpellAbilityUnit()
Could be replaced by making a local unit.

Please learn jass before attempting something like this, you might find that helps.
 
Level 3
Joined
Dec 24, 2006
Messages
68
Please learn jass before attempting something like this, you might find that helps.
thats the way im trying to learn jass, by experimating etc. and i dont think this statment helps in any way
 
Status
Not open for further replies.
Top