• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Aspect of the Cheetah


Aspect of the Cheetah

JASS:
//CONFIGURABLES
function AotC_HeroAbility takes nothing returns integer
    return 'A000'//Hero ability raw code
endfunction
function AotC_UnitAbility takes nothing returns integer
    return 'A001'//Buff ability raw code
endfunction
function AotC_DazeAbility takes nothing returns integer
    return 'A002'//Daze ability raw code
endfunction
function AotC_AbilityBuff takes nothing returns integer
    return 'B000'//Buff ability raw code
endfunction
function AotC_UnitId takes nothing returns integer
    return 'u000'//Caster unit rawcode
endfunction
function AotC_LearnSpellOrderId takes nothing returns integer
    return 1093677104//Id of the order learn the ability
endfunction
function AotC_TurnOn takes nothing returns integer
    return 852177//Id of the order "immolation"
endfunction
function AotC_TurnOff takes nothing returns integer
    return 852178//Id of the order "unimmolation"
endfunction
function AotC_UnitAOrder takes nothing returns string
    return "bloodlust"//Buff ability order
endfunction
function AotC_DazeOrder takes nothing returns string
    return "slow"//Daze ability order
endfunction
function AotC_Preload takes nothing returns boolean
    return true
endfunction
//END OF CONFIGURABLES
function AotC_Action2 takes nothing returns boolean
    local unit c = GetTriggerUnit()
    local unit u
    local integer i
    if GetUnitAbilityLevel(c, AotC_AbilityBuff()) > 0 then
        set i = GetUnitAbilityLevel(c, AotC_HeroAbility())
        set u = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), AotC_UnitId(), GetUnitX(c), GetUnitY(c), 0)
        call UnitAddAbility(u, AotC_DazeAbility())
        call SetUnitAbilityLevel(c, AotC_DazeAbility(), i)
        call IssueTargetOrder(u, AotC_DazeOrder(), c)
        call UnitApplyTimedLife(u, 'BTLF', .5)
        set u = null
    endif
    set c = null
    return false
endfunction
function AotC_Action1 takes nothing returns boolean
    local unit c = GetTriggerUnit()
    local unit u
    local integer i
    if GetIssuedOrderId() == AotC_TurnOn() then
        set i = GetUnitAbilityLevel(c, AotC_HeroAbility())
        set u = CreateUnit(GetTriggerPlayer(), AotC_UnitId(), GetUnitX(c), GetUnitY(c), 0)
        call UnitAddAbility(u, AotC_UnitAbility())
        call SetUnitAbilityLevel(u, AotC_UnitAbility(), i)
        call IssueTargetOrder(u, AotC_UnitAOrder(), c)
        call UnitApplyTimedLife(u, 'BTLF', .5)
        set u = null
    elseif GetIssuedOrderId() == AotC_TurnOff() then
        call UnitRemoveAbility(c, AotC_AbilityBuff())
    elseif GetIssuedOrderId() == AotC_LearnSpellOrderId() and GetUnitAbilityLevel(c, AotC_AbilityBuff()) > 0 then
        set i = GetUnitAbilityLevel(c, AotC_HeroAbility())
        call UnitRemoveAbility(c, AotC_AbilityBuff())
        set u = CreateUnit(GetTriggerPlayer(), AotC_UnitId(), GetUnitX(c), GetUnitY(c), 0)
        call UnitAddAbility(u, AotC_UnitAbility())
        call SetUnitAbilityLevel(u, AotC_UnitAbility(), i + 1)
        call IssueTargetOrder(u, AotC_UnitAOrder(), c)
        call UnitApplyTimedLife(u, 'BTLF', .5)
        set u = null
    endif
    set c = null
    set u = null
    return false
endfunction
function InitTrig_AotC takes nothing returns nothing
    local trigger t = CreateTrigger()
    local unit u
    if AotC_Preload() then
        set u = CreateUnit(Player(0), AotC_UnitId(), 0, 0, 0)
        call UnitAddAbility(u, AotC_UnitAbility())
        call UnitAddAbility(u, AotC_DazeAbility())
        call RemoveUnit(u)
    endif
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
    call TriggerAddCondition(t, Condition(function AotC_Action1))
    set t = CreateTrigger()
    call TriggerRegisterVariableEvent(t, "udg_DamageEvent", EQUAL, 1)
    call TriggerAddCondition(t, Condition(function AotC_Action2))
    set t = null
    set u = null
endfunction

  • Updates
    •Fixed the bug that appear when save/load the game
    •Changed the speed bonus from 12/19/26/33% to 15/30/45/60%
    •Changed the speed reduction of dazed from 70% to 80%
    •If you have activated the ability, when you leveling up it the buff will be update to the actual level
  • Thanks
    •@Bribe, for his Unit indexer and Damage engine systems
    •@Maghteridon96
zH8Wj.png

Keywords:
aspect of the, aspect of the cheetah, trigger, with jass, with trigger, aspect, of, the, cheetah, walk, run, fast, quick, quickly, nice, daze, dazed,
Contents

Aspect of the Cheetah (Map)

Reviews
16 July 2012 Bribe: It can use some work but it is bug free from what I can tell. Approved 2.6/5. 20:59, 15th Feb 2012 Pharaoh_: I'd advise you to work with integers as orders. I would also want you to create a function that returns true or false...

Moderator

M

Moderator

16 July 2012
Bribe: It can use some work but it is bug free from what I can tell. Approved 2.6/5.

20:59, 15th Feb 2012
Pharaoh_: I'd advise you to work with integers as orders. I would also want you to create a function that returns true or false (set by the user); this will determine whether the Dazed buff will be removed from the caster, after he goes unimmolation or not (true to remove it, false to retain it).
For the dummy unit, set Stats - Hide Minimap Display to True.

Useful otherwise.
 
The code is fine :)

All you have to do is make "immolation", "unimmolation", "slow" and "bloodlust" configurable like everything else :p

And the Init trigger could be shrunken down to be this:

JASS:
function InitTrig_AotC takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
    call TriggerAddCondition(t, Condition(function AotC_Condition1))
    call TriggerAddAction(t, function AotC_Action1)
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t1, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(t, Condition(function AotC_Condition2))
    call TriggerAddAction(t, function AotC_Action2)
    set t = null
endfunction

Oh and you could merge the actions and the conditions so you'll only be using conditions ;p

JASS:
function AotC_Action1 takes nothing returns nothing
    local string id = AotC_Order()
    local integer i
    local unit c
    local unit u
    if id == "immolation" then
        set c = GetTriggerUnit()
        set u = CreateUnit(GetTriggerPlayer(), AotC_UnitId(), GetUnitX(c), GetUnitY(c), 0)
        call UnitAddAbility(u, AotC_UnitAbility())
        call SetUnitAbilityLevel(u, AotC_UnitAbility(), GetUnitAbilityLevel(c, AotC_HeroAbility()))
        call IssueTargetOrder(u, "bloodlust", c)
        call UnitApplyTimedLife(u, 'BTLF', .5)
        set u = null
        set c = null
    elseif id == "unimmolation" then
        call UnitRemoveAbility(GetTriggerUnit(), AotC_AbilityBuff())
    endif
endfunction

function AotC_Action2 takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local integer i = GetUnitAbilityLevel(c, AotC_HeroAbility())
    local unit u
    if i > 0 then
        set u = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), AotC_UnitId(), GetUnitX(c), GetUnitY(c), 0)
        call UnitAddAbility(u, AotC_DazeAbility())
        call SetUnitAbilityLevel(c, AotC_DazeAbility(), i)
        call IssueTargetOrder(u, "slow", c)
        call UnitApplyTimedLife(u, 'BTLF', .5)
        set u = null
    endif
    set c = null
endfunction

function InitTrig_AotC takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
    call TriggerAddCondition(t, Condition(function AotC_Action1))
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t1, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(t, Condition(function AotC_Action2))
    set t = null
endfunction

As you can see, I didn't cache the level in Action1 because it was only used once ;P
I also didn't cache the caster unless the Id of the order is immolation, because if it's unimmolation, I'm only calling it once, so not using the local is ok :p
 
All you have to do is copy all the system code from this: http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-201016/

Put it into your testmap, and instead of registering the attack event to the trigger, do this:

JASS:
function InitTrig_AotC takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
    call TriggerAddCondition(t, Condition(function AotC_Action1))
    set t = CreateTrigger()
    call TriggerRegisterVariableEvent(t, "udg_DamageEvent", EQUAL, 1.)
    call TriggerAddCondition(t, Condition(function AotC_Action2))
    set t = null
endfunction

That's how Bribe's system works :)
 
Level 1
Joined
May 22, 2010
Messages
2
Is there any quick way to copy all the variables? Otherwise importing this is going to take hours (o).(o) /Importer Noob
 
Top