• 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] Help me clean up my noob spell

Status
Not open for further replies.
Level 1
Joined
May 19, 2009
Messages
1
My first attempt at converting my gui spell to jass.

I tried my best to clean it up.

But i am sure its still far from clean, still looks very messy to me.

So would anyone help me clean it up. And explain it to me if its advanced stuffs.

The spells creates 6 tornados in the area of the point of the ability casted.

The middle tornado is created outside of the loop, then it is given a dummy monsoon ability and it is ordered to cast it.

5 tornados are created from a loop, using integers to determine the location whereby the tornados are created.

All tornados expires after 15 seconds.


Code:
scope ThunderArea initializer Init

private function Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A003' ) ) then
        return false
    endif
    return true
endfunction

private function Actions takes nothing returns nothing
    local location loc = GetSpellTargetLoc()
    local integer int = -72
   
    call CreateNUnitsAtLoc( 1, 'n001', GetOwningPlayer(GetSpellAbilityUnit()), loc, bj_UNIT_FACING )
    call UnitAddAbilityBJ( 'A005', GetLastCreatedUnit() )
    call SetUnitAbilityLevelSwapped( 'A005', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A003', GetSpellAbilityUnit()) )
    call UnitAddAbilityBJ( 'A006', GetLastCreatedUnit() )
    call SetUnitAbilityLevelSwapped( 'A006', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A003', GetSpellAbilityUnit()) )
    call IssuePointOrderLocBJ( GetLastCreatedUnit(), "monsoon", loc )
    call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
    call CreateNUnitsAtLoc( 1, 'n002', GetOwningPlayer(GetSpellAbilityUnit()), loc, bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
   
    loop
        exitwhen int >= 360
        set int = ( int + 72 )
        set loc = PolarProjectionBJ(GetSpellTargetLoc(), 400.00, I2R(int))
        call CreateNUnitsAtLoc( 1, 'n001', GetOwningPlayer(GetSpellAbilityUnit()), loc, bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
    endloop
    
    call PlaySoundAtPointBJ( gg_snd_RollingThunder1, 100, loc, 0 )
    call PlaySoundAtPointBJ( gg_snd_LightningBolt1, 100, loc, 0 )
    
    call RemoveLocation(loc)
    
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger ThunderArea = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( ThunderArea, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( ThunderArea, Condition( function Conditions ) )
    call TriggerAddAction( ThunderArea, function Actions )
endfunction

endscope
 
Status
Not open for further replies.
Top