HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Jass Newb: Multi Auras

01-27-2005, 05:16 AM#1
HexenLordX
I recently got ahold of a Multi Aura thanks to Darky27. Here's the JASS:

Code:
function GetAuraGameCache takes nothing returns gamecache
    return gg_trg_Multi_Aura
    return null
endfunction

function Handle2Integer takes handle h returns integer
    return h
    return 0
endfunction

function Integer2Group takes integer i returns group
    return i
    return null
endfunction

function Initialize_Aura_Variables takes nothing returns nothing
    local gamecache  g = GetAuraGameCache()
    local group      u = CreateGroup(  )
    local integer    i = 1
    local real array RadiusLevel
    local integer array AuraAbilities 

    local integer AuraAbility      = 'AOae'   // <-- You can adjust the Value
    local integer AuraLevels       = 3        // <-- You can adjust the Value
    local integer AuraAbilitiesNum = 7        // <-- You can adjust the Value
    set RadiusLevel[1] = 300                  // <-- You can adjust the Value
    set RadiusLevel[2] = 500                  // <-- You can adjust the Value
    set RadiusLevel[3] = 700                  // <-- You can adjust the Value
    set AuraAbilities[1] = 'Apiv'             // <-- You can adjust the Value
    set AuraAbilities[2] = 'AId0'             // <-- You can adjust the Value
    set AuraAbilities[3] = 'AItx'             // <-- You can adjust the Value
    set AuraAbilities[4] = 'ACct'             // <-- You can adjust the Value
    set AuraAbilities[5] = 'AIcf'             // <-- You can adjust the Value
    set AuraAbilities[6] = 'AIl2'             // <-- You can adjust the Value  
    set AuraAbilities[7] = 'AIms'             // <-- You can adjust the Value     

    call StoreIntegerBJ( AuraAbility, "Ability", "Aura", g )
    loop
        exitwhen i > AuraLevels
        call StoreRealBJ( RadiusLevel[i], "Level"+I2S(i), "Radius", g )
        set i = i + 1
    endloop
    set i = 1
    loop
        exitwhen i > AuraAbilitiesNum
        call StoreIntegerBJ( AuraAbilities[i], "Ability"+I2S(i), "Abilities", g )
        set i = i + 1
    endloop
    call StoreIntegerBJ( Handle2Integer(u), "Unitgroup", "Unitgroup", g )
    call StoreIntegerBJ( AuraAbilitiesNum, "Abilities", "Abilities", g )
endfunction

function AuraAbility takes nothing returns integer
    return GetStoredInteger(GetAuraGameCache(), "Aura", "Ability")
endfunction

function AuraAbilities takes nothing returns integer
    return GetStoredInteger(GetAuraGameCache(), "Abilities", "Abilities")
endfunction

function AuraTrigger takes nothing returns trigger
    return GetStoredInteger(GetAuraGameCache(), "Trigger", "AuraTrigger")
    return null
endfunction

function StoreAuraGameCache takes nothing returns trigger
    return bj_lastCreatedGameCache
    return null
endfunction

function Integer2Unit takes integer i returns unit
    return i
    return null
endfunction

function Integer2Trigger takes integer i returns trigger
    return i
    return gg_trg_Multi_Aura
endfunction

function Trig_Invisibility_Aura_Condition takes nothing returns boolean
    local unit  u = Integer2Unit(GetStoredInteger(GetAuraGameCache(), "Trigger", I2S(Handle2Integer(GetTriggeringTrigger()))))
    local unit  t = GetTriggerUnit()
    local group g = Integer2Group(GetStoredInteger(GetAuraGameCache(),"Unitgroup","Unitgroup"))
    if (( IsUnitInGroup(GetTriggerUnit(), g) != true ) and ( GetOwningPlayer(t) != Player(PLAYER_NEUTRAL_PASSIVE) ) and (IsUnitAliveBJ(u)) and ( IsUnitAlly(t, GetOwningPlayer(u)))) then
        return true
    endif
    return false
endfunction

function Trig_Invisibility_Aura_Actions takes nothing returns nothing
    local group    g = Integer2Group(GetStoredInteger(GetAuraGameCache(),"Unitgroup","Unitgroup"))
    local unit     u = Integer2Unit(GetStoredInteger(GetAuraGameCache(), "Trigger", I2S(Handle2Integer(GetTriggeringTrigger()))))
    local unit     t = GetTriggerUnit()
    local location l = GetUnitLoc(t)
    local integer  i = 1
    call GroupAddUnitSimple( t, g )
    loop
        exitwhen i > AuraAbilities()
        call UnitAddAbilityBJ( GetStoredInteger(GetAuraGameCache(), "Abilities", "Ability"+I2S(i)), t )
        set i = i + 1
    endloop
    call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorDamage.mdl", t, "chest"))
    call RemoveLocation(l)
    call StoreIntegerBJ( Handle2Integer(u) , I2S(Handle2Integer(t)), "AuraHero", GetAuraGameCache() )
endfunction

function Trig_Learn_Aura_Condition takes nothing returns boolean
    return (GetLearnedSkill() == AuraAbility())
endfunction

function Trig_Learn_Aura_Actions takes nothing returns nothing
    local trigger    t
    local gamecache  g = GetAuraGameCache()
    local unit       u = GetLearningUnit()
    local integer    l = GetUnitAbilityLevelSwapped(AuraAbility(), u)
    if (l > 1) then
        set t = Integer2Trigger(GetStoredInteger(g, "Trigger", I2S(Handle2Integer(u)) ))
        call DestroyTrigger(t)
    endif
    set t = CreateTrigger(  )
    call TriggerRegisterUnitInRangeSimple( t, GetStoredReal(g,"Radius","Level" + I2S(l) ), u )
    call TriggerAddAction( t, function Trig_Invisibility_Aura_Actions )
    call TriggerAddCondition( t, Condition( function Trig_Invisibility_Aura_Condition ) )
    call StoreIntegerBJ( Handle2Integer(t) , I2S(Handle2Integer(u)), "Trigger", g )
    call StoreIntegerBJ( Handle2Integer(u) , I2S(Handle2Integer(t)), "Trigger", g )
endfunction

function Trig_Aura_Timer_Group_Actions takes nothing returns nothing
    local gamecache g = GetAuraGameCache()
    local group gr = Integer2Group(GetStoredInteger(g,"Unitgroup","Unitgroup"))
    local unit u = GetEnumUnit()
    local unit  hero = Integer2Unit(GetStoredInteger(g, "AuraHero", I2S(Handle2Integer(GetEnumUnit())) ))
    local location s = GetUnitLoc(hero)
    local location t = GetUnitLoc(u)
    local integer  l = GetUnitAbilityLevelSwapped(AuraAbility(), hero)
    local integer  i = 1
    if (DistanceBetweenPoints(s, t) - 50 > GetStoredReal(g,"Radius","Level" + I2S(l) ) ) then
        loop
            exitwhen i > AuraAbilities()
            call UnitRemoveAbilityBJ( GetStoredInteger(GetAuraGameCache(), "Abilities", "Ability"+I2S(i)), u )
            set i = i + 1
        endloop
        call GroupRemoveUnitSimple( u, gr )
        call FlushStoredInteger(g,"AuraHero",I2S(Handle2Integer(GetEnumUnit())))
    endif
    call RemoveLocation(s)
    call RemoveLocation(t)
endfunction

function Trig_Aura_Timer_Actions takes nothing returns nothing
    local group g = Integer2Group(GetStoredInteger(GetAuraGameCache(),"Unitgroup","Unitgroup"))
    call ForGroupBJ( g, function Trig_Aura_Timer_Group_Actions )
endfunction

//===========================================================================
function InitTrig_Multi_Aura takes nothing returns nothing
    local integer i = 0
    local trigger t = CreateTrigger(  )
    local timer   c = CreateTimer(  )
    loop
        exitwhen i > 11
        if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
            call TriggerRegisterPlayerUnitEventSimple( t, Player(i), EVENT_PLAYER_HERO_SKILL )
        endif
        set i = i + 1
    endloop
    call TriggerAddCondition( t, Condition( function Trig_Learn_Aura_Condition ) )
    call TriggerAddAction( t, function Trig_Learn_Aura_Actions )

    set t = CreateTrigger(  )
    call TriggerRegisterTimerExpireEventBJ( t, c )
    call TriggerAddAction( t, function Trig_Aura_Timer_Actions )
    call StartTimerBJ( c, true, 0.50 )

    call InitGameCacheBJ( "InvisibilityAura.w3v" )
    set gg_trg_Multi_Aura = StoreAuraGameCache()
    call Initialize_Aura_Variables()
endfunction

I edited the part where you can change which auras are included in your multi aura to look like this:

Code:
    local integer AuraAbility      = 'AOae'   // <-- You can adjust the Value
    local integer AuraLevels       = 3        // <-- You can adjust the Value
    local integer AuraAbilitiesNum = 2        // <-- You can adjust the Value
    set RadiusLevel[1] = 300                  // <-- You can adjust the Value
    set RadiusLevel[2] = 500                  // <-- You can adjust the Value
    set RadiusLevel[3] = 700                  // <-- You can adjust the Value
    set AuraAbilities[1] = 'A0r2'             // <-- You can adjust the Value
    set AuraAbilities[2] = 'AUav'             // <-- You can adjust the Value

I didn't edit any other part of the trigger. Now the Aura has NO effects, and neither the Vampiric Aura nor the Endurance Aura are working in the multi-aura.

Anyone quite sure what happened?
01-27-2005, 05:18 AM#2
Ryude
Were there any abilities that needed to be copied over?

If not, make sure the AbilityId's actually match up with a real ability.
01-27-2005, 07:21 PM#3
HexenLordX
Quote:
Originally Posted by Ryude
Were there any abilities that needed to be copied over?

If not, make sure the AbilityId's actually match up with a real ability.

I edited the code directly in the map that it came with, so I didn't have to copy anything over. I opened the original map, and edited the values from there.
01-28-2005, 01:26 AM#4
HexenLordX
I just got the aura working fine, except one problem. It only works on surrounding units and has no effect on the actual hero using the aura. Anyone know how to change this? I don't believe its the aura itself in the object editor, because its based off of another aura and nothing but the name was changed.
01-28-2005, 10:55 PM#5
Vexorian
try my aura template http://www.wc3sear.ch/index.php?p=Spells&ID=109 , it is kind of text editing actually