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

More ability help for sum guy

Status
Not open for further replies.
Level 3
Joined
Jun 10, 2008
Messages
29
alright I've just been playing around with the trigger editor but I saw the Capitalism Aura (which I must say looks really cool) and I got a good idea... the trouble being I don't know how to do it.

I need a trigger script to make it so the bounty of enemy units under the aura is 2 times, 3 times, 4 times so on and so fourth. Also I need the suggestion if this should be either an ultamate (3 levels, lvl skip is 6) or just a regular ability (5 levels, lvl skip is 2)

I link to the aura model... it looks great
http://www.hiveworkshop.com/forums/resource.php?t=88789
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
I have made it for you.
It's in JASS.

Put this in you header:
JASS:
function RegisterDmgConditions takes nothing returns boolean
    return GetWidgetLife(GetFilterUnit()) > 0.405
endfunction

function RegisterDmg takes code handlerFunc returns nothing
    local trigger t = CreateTrigger()
    local group g = CreateGroup()
    local unit u
    local boolexpr b = Condition(function RegisterDmgConditions)
    call GroupEnumUnitsInRect( g, bj_mapInitialPlayableArea, b )
    loop
        set u = FirstOfGroup(g)
        call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_DAMAGED )
        call GroupRemoveUnit(g, u)
        set u = null
        exitwhen CountUnitsInGroup(g) == 0
    endloop
    call TriggerAddAction( t, handlerFunc )
    call DestroyGroup(g)
    set g = null
    set b = null
    set t = null
endfunction


Then create a trigger you call Capitalism Aura and convert it to custom text and the replace everything in it with this:

JASS:
//===========Change these!=========================
constant function Capitalism_Aura_Id1 takes nothing returns integer
    return 'B000'//The raw code of the "Capitalism Aura" buff (Level 1)
endfunction

constant function Capitalism_Aura_Id2 takes nothing returns integer
    return 'B001'//The raw code of the "Capitalism Aura" buff (Level 2)
endfunction

constant function Capitalism_Aura_Id3 takes nothing returns integer
    return 'B002'//The raw code of the "Capitalism Aura" buff (Level 3)
endfunction
//===============================================



constant function H2I takes handle h returns integer
    return h
    return 0
endfunction

function Data takes nothing returns gamecache
    return InitGameCache( "CapitalismAura.w3v" )
endfunction

function AttachHandle takes handle attached, handle attacher, string s returns nothing
    call StoreInteger(Data(), I2S(H2I(attacher)), s, H2I(attached))
endfunction

function AttachInt takes integer attached, handle attacher, string s returns nothing
    call StoreInteger(Data(), I2S(H2I(attacher)), s, attached)
endfunction

function RetrieveUnit takes handle attacher, string s returns unit
    return GetStoredInteger(Data(), I2S(H2I(attacher)), s)
    return null
endfunction

function RetrieveInt takes handle attacher, string s returns integer
    return GetStoredInteger(Data(), I2S(H2I(attacher)), s)
endfunction

function Clear takes handle attacher returns nothing
    call FlushStoredMission(Data(), I2S(H2I(attacher)))
endfunction


function DetectLevel takes unit u returns integer
    local integer lvl = 0
    if GetUnitAbilityLevel(u, Capitalism_Aura_Id1()) > 0 then
        set lvl = 1
    elseif GetUnitAbilityLevel(u, Capitalism_Aura_Id2()) > 0 then
        set lvl = 2
    elseif GetUnitAbilityLevel(u, Capitalism_Aura_Id3()) > 0 then
        set lvl = 3
    else
        set lvl = 0
    endif
    return lvl
endfunction

function Capitalism_AuraChild takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = RetrieveUnit(t, "u")
    local unit u2 = RetrieveUnit(t, "u2")
    local player p = GetOwningPlayer(u2)
    local integer lvl = RetrieveInt(t, "lvl")
    local integer money = RetrieveInt(t, "m")
    local integer money2 = GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD)
    local integer add = (money2 - money) * 3
    local texttag array text
    local integer i = 0
    call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, money2 + add)
    loop
        set i = i + 1
        set text[i] = CreateTextTagUnitBJ( "+"+I2S(add/3), u, 0, 10, 100.00, 85.00, 15.00, 0 )
        call SetTextTagPermanentBJ( text[i], false )
        call SetTextTagLifespanBJ( text[i], 2.00 )
        call SetTextTagFadepointBJ( text[i], 1.00 )
        call SetTextTagVelocityBJ( text[i], 60.00, GetRandomReal(0, 360) )
        set text[i] = null
        exitwhen i == lvl
    endloop
    call Clear(t)
    call DestroyTimer(t)
    set t = null
    set u = null
    set u2 = null
    set p = null
endfunction


function Capitalism_Aura takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit u2 = GetEventDamageSource()
    local player p = GetOwningPlayer(u2)
    local timer t = CreateTimer()

    local integer money = GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD)
    local integer lvl = DetectLevel(u)
    if lvl > 0 and GetWidgetLife(u) - GetEventDamage() <= 0.405 then
        call AttachHandle(u, t, "u")
        call AttachHandle(u2, t, "u2")
        call AttachInt(money, t, "m")
        call AttachInt(lvl, t, "lvl")
        call TimerStart(t, 0., false, function Capitalism_AuraChild)
    else
    endif
    set u = null
    set u2 = null
    set p = null
    set t = null
endfunction

//===========================================================================
function InitTrig_Capitalism_Aura takes nothing returns nothing
    local trigger t = CreateTrigger()
    call RegisterDmg(function Capitalism_Aura)
    set t = null
endfunction

Remember to change the three things at the top of the script (The three constants) to the correct values.

(This works with up to 3 levels, if you wish more then send a PM to me and I will update it so it will work with more than 3 levels)

EDIT: I have removed 1 small bug.
 
Last edited:
Status
Not open for further replies.
Top