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

Agro Roar v 1.2.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Makes enemies attack you within Х seconds. For each unit increases you protection Х.
CD: 16\17\18 s.
Vexorian - TimerUtils
JASS:
scope AgroRoar initializer Init 
////////////////////////////////////
// AGRO ROAR v 1.2.0 vJass        //
// by tRu.Style                   //
// Fixed t = null                 //
// Remove function RoarGroupUnit  //
// Add constant ARMORPERUNIT      //
////////////////////////////////////

////////////////////
//     SetUp      //
////////////////////
globals
    // Spell time = RoarTime + (RoarTimePerLevel * lvl) = time
    private constant integer   ROARID        =   'A000'     // Agro Ability ID
    private constant real      ROARAOE       =    225.      // Agro AoE
    private constant string    ROAREFFECT    =   "Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl"  // Spell effect
    private constant string    ROARATTACH    =   "origin"   // Attach point effect
    private constant integer   ROARTIME      =    5         // Stand roar time duration
    private constant integer   ROARTIMEPL    =    1         // Integer for time pluse per level

    private constant integer   ARMORID   =   'A001'     //Armor ability ID
    private constant integer   ARMORPU   =   1          //Add X armor per unit
    private constant integer   ARMORMAX  =   12         //Max add armor per level, max virable count = 33
endglobals
////////////////////
// End  SetUp     //
////////////////////
//Dont toch this////////////
/* */ private struct Roar //
/* */   unit caster       //
/* */   integer lvl       //
/* */   group g           //
/* */ endstruct           //
//Dont toch this////////////

private function RoarDuration takes integer lvl returns integer
    return ROARTIME+(ROARTIMEPL*lvl)
endfunction

private function RoarEnd takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local Roar data = GetTimerData(t)
    call UnitRemoveAbility(data.caster,ARMORID)
    call GroupClear(data.g)
    call DestroyGroup(data.g)
    call data.destroy()
    call ReleaseTimer(t)
    set t = null
endfunction

private function RoarBool takes unit u,unit e returns boolean
    return IsUnitEnemy(e,GetOwningPlayer(u)) and GetWidgetLife(e) > .405
endfunction

private function RoarGroupIssue takes nothing returns nothing
    local Roar data = GetTimerData(bj_lastStartedTimer)
    local unit e = GetTriggerUnit()
        if IsUnitInGroup(e,data.g) then
            call IssueTargetOrderById(e,851983,data.caster)
        endif
    set e = null
endfunction

private function RoarCast takes nothing returns nothing
    local Roar data=Roar.create()
    local group eg = CreateGroup()
    local timer t = NewTimer()
    local trigger trg = CreateTrigger()
    local unit e
    //Loacals end,dont toch this
    set bj_lastStartedTimer = t         //This add for spell MUI O_o
    set data.caster = GetTriggerUnit()
    set data.g = CreateGroup()
    set data.lvl = GetUnitAbilityLevel(data.caster,ROARID)
    //Data end,dont toch this
    call UnitAddAbility(data.caster,ARMORID)        //Add hero armor ability
    call GroupEnumUnitsInRange(eg, GetUnitX(data.caster), GetUnitY(data.caster),ROARAOE, null) 
    loop 
        set e = FirstOfGroup(eg)
            if RoarBool(data.caster,e) then 
                call GroupAddUnit(data.g,e)
                call TriggerRegisterUnitEvent(trg, e, EVENT_UNIT_ISSUED_POINT_ORDER )
                call TriggerRegisterUnitEvent(trg, e, EVENT_UNIT_ISSUED_ORDER )
                call IssueTargetOrderById(e,851983,data.caster)
                if GetUnitAbilityLevel(data.caster,ARMORID) < ARMORMAX*data.lvl+1 then                      // +1 - level 1 = 0
                    call SetUnitAbilityLevel(data.caster,ARMORID,GetUnitAbilityLevel(data.caster,ARMORID)+ARMORPU)
                else
                    call SetUnitAbilityLevel(data.caster,ARMORID,ARMORMAX*data.lvl)
                endif
            endif 
        exitwhen(e == null)
        call TriggerAddAction(trg,function RoarGroupIssue)
        call GroupRemoveUnit(eg,e)
    endloop
    call SetTimerData(t,data)
    call TimerStart(t,RoarDuration(data.lvl),false,function RoarEnd)
    call DestroyGroup(eg)
    call DestroyEffect(AddSpecialEffectTarget(ROAREFFECT,data.caster,ROARATTACH))
    set e = null
    set eg = null
    set t = null
    set trg = null
endfunction

private function RoarInit takes nothing returns boolean
    if GetSpellAbilityId() == ROARID then
        call RoarCast()
    endif
return false
endfunction

private function Init takes nothing returns nothing
    local trigger trg = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(trg,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trg,Condition(function RoarInit))
    set trg = null
endfunction

endscope

UpData 1.0.0 create spell
UpData 1.1.0 vJass version(It's my first spell vJass)
UpData 1.1.1 Add MUI for spell, use TimerUtils
UpData 1.1.2 Re takes integer lvl in Duration, plus info duration
UpData 1.2.0 Remove function RoarGroupUnit, set t = null, add constant Armor Per Unit

Sorry, I very bad speak English(thanks to the translator :)

Keywords:
Roar,Agro,Armor
Contents

Еще одна карта (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Needs Fix Required changes: You are creating lot of triggers and never destroying them RoarGroupIssue uses bj_lastStartedTimer, not good Suggested changes: You can delete set...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

Reviewed by Maker, Agro Roar v.1.2.0 , 23rd Jan 2013

Needs Fix

Required changes:
  • You are creating lot of triggers and never destroying them
  • RoarGroupIssue uses bj_lastStartedTimer, not good

Suggested changes:
  • You can delete set bj_lastStartedTimer = t. That is GUI stuff and not needed here
  • I recommed you reduce the level count of the ability to the maximum armor bonus you can have. It decreases loading time
  • Instead of eg group, you could use bj_lastCreatedGroup
  • Set the struct member g to null after destroying it
  • Filter out structures

Reviewed by Maker, Agro Roar v.1 , 16th Jan 2013

Needs Fix
  • Using globals block makes it vjass
  • You clear the global group when any instance of the spell ends, thus the sepll will not work several spellcasters
  • There is no importing instructions in the map file
  • The spell is not easily configurable
  • You don't need three separate abilities for the armor
 
Level 10
Joined
Aug 21, 2010
Messages
316
What if I wanted to change something here?
It would be very annoying.

Here are some tips:

JASS:
//This is unnecessary
//So it's not wrong, but it is unnecessary in this case
unit cast
//Use Hashtable - SaveAgentHandle or SaveUnitHandle = LoadUnitHandle



JASS:
GetUnitAbilityLevel(caster,'A000')
->
constant function ExempleSomeName takes nothing returns integer
    return 'A000'/'A001'/'A002' and so on...
endfunction

or global

integer AbilCode = 'A000'/'A000'/'A001'/'A002' and so on...

GetUnitAbilityLevel( caster, ExempleSomeName()/AbilCode )

JASS:
local group g = CreateGroup()
call DestroyGroup(g)
set g = null
->
bj_lastCreatedGroup

Example
JASS:
call TimerStart( t, [5.+lvl "should be configurable"], false,function RemoveAbility )
->
function ExampleSomeName takes integer level returns real
    return 5. + level
endfunction
or
function ExampleSomeName takes real level returns real
    return 5. + level
endfunction

call TimerStart( t,  ExampleSomeName(), false,function RemoveAbility )

or again GLOBALS bla bla

Suggested changes:
JASS:
function Trig_AgroRoar_Actions takes nothing returns nothing
endfunction
------->
function Trig_AgroRoar_Actions takes nothing returns boolean
    if ( GetSpellAbilityId() ) == ExampleSomeAbility() then
        bla,bla
    endif
    return false
endfunction

function InitTrig_AgroRoar takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_AgroRoar_Actions ) )
    set t = null
endfunction


JASS:
function Issued takes nothing returns nothing
local unit attacker = GetTriggerUnit()
if IsUnitInGroup(attacker,gr) == true then
    call IssueTargetOrderById(attacker,851983,cast)
endif
set attacker = null
endfunction

function AddHeroArmor takes unit u,integer i returns nothing
if i == 1 then
    call UnitAddAbility(u,'A001')
elseif i == 2 then
    call UnitAddAbility(u,'A002')
elseif i == 3 then
    call UnitAddAbility(u,'A003')
endif
endfunction

function SetHeroArmor takes unit u,integer i returns nothing
if i == 1 then
    if GetUnitAbilityLevel(u,'A001') <= 13 then
        call SetUnitAbilityLevel(u,'A001',GetUnitAbilityLevel(u,'A001')+1)
    endif
endif
if i == 2 then
    if GetUnitAbilityLevel(u,'A002') <= 25 then
        call SetUnitAbilityLevel(u,'A002',GetUnitAbilityLevel(u,'A001')+1)
    endif
endif
if i == 3 then
    if GetUnitAbilityLevel(u,'A003') <= 37 then
        call SetUnitAbilityLevel(u,'A003',GetUnitAbilityLevel(u,'A003')+1)
    endif
endif
endfunction
 
Last edited:
Level 10
Joined
Jun 9, 2012
Messages
826
Hmm. I played Tidehunter before but can you please add a description? It has only a level of ability, whereas DotA had 3. Tested the spell and found a few problems.

1st: The spell is a no target spell, why make it into a target spell?
2nd: It teleports you to where you cast it, which is not what i experienced in DotA while playing as Tidehunter.
3rd: Once i casted the spell, the spell doesn't work until the units stunned by the spell wakes up again.

Not sure if anyone found the same, but this is what i found. Please update this spell asap. :)
 
Top