• It's time to dig through Hive's model database and dust off some oldie but goldie models and enter Hive's Texturing Contest #31 : Repurposing! Click here to enter!
  • 🏆 Hive's 5th HD Modeling Contest: Creep Camp is now open! Click here to enter!

AOE Spell Request

Level 5
Mar 5, 2009
Hey guys, did some simple trigger spells and ran into a bit of trouble, so I'm requesting someone make this spell for me.

Royalty's Grace (3 levels)
Description: The Royal Guard's loyalty to all his allies are channeled into an area around the Guard. All allied units caught in the spell's radius will have their their health restored by a certain amount and all enemy undead units will receive damage equal to half the amount healed.

So basically in a 500 AOE around the guard, every allied unit gets healed except undead, who dont get healed, and enemy undead units get blasted by holy light. So the base of this is a mass holy light spell.

Level 1: 300 life healed and 150 damage to undead. Level 2: 600 life healed and 300 damage to undead. Level 3: 900 life healed and 450 damage to undead.

Art: I guess basing it off the resurrection spell for the Paladin works, except obviously dead units dont come back and the target effect is Holy Light.

Thanks to whoever looks into this, and of course there's kudos to you.
Level 14
Nov 18, 2007
I do hope you know a little about Jass and use NewGen WE.
scope RoyalGrace initializer Init

    native UnitAlive takes unit id returns boolean //Remove this if already implemented.
        private constant integer SPELL_ID = 'A000' //Raw id of the ability that will trigger this.
        private constant string HOLY_SFX = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" //SFX that will be played on all units affected by the spell
        private constant string HOLY_SFX_ATTACH = "origin" //Attachment point for sfx
        private constant attacktype ATK_TYPE = ATTACK_TYPE_NORMAL //Attacktype for damage
        private constant damagetype DMG_TYPE = DAMAGE_TYPE_UNIVERSAL //Damagetype for damage
        private constant weapontype WPN_TYPE = null //Weapontype for damage
        private group ENUM_GROUP = CreateGroup() //Used for group filter/enumeration
        private boolexpr e //*
        private unit TempCast //*
        private integer TempLvl //*
    private constant function Heal takes integer lvl returns real //How much to heal friendly units by. Depends on level
        return 300.*lvl
    private constant function Damage takes integer lvl returns real //How much to hurt enemy undead units by. Depends on level
        return 150.*lvl
    private constant function Area takes integer lvl returns real //The area of effect for the spell. 
        return 400.+0*lvl
    private function AffectedFilter takes nothing returns boolean //Does the actual effect of the spell
        local unit u = GetFilterUnit()
        if UnitAlive(u) then            
            if IsUnitAlly(u,GetOwningPlayer(TempCast)) and IsUnitType(u,UNIT_TYPE_UNDEAD) == false and IsUnitType(u,UNIT_TYPE_MECHANICAL) == false then
                call DestroyEffect(AddSpecialEffectTarget(HOLY_SFX,u,HOLY_SFX_ATTACH))
                call SetWidgetLife(u,GetWidgetLife(u)+Heal(TempLvl))
            elseif IsUnitEnemy(u,GetOwningPlayer(TempCast)) and IsUnitType(u,UNIT_TYPE_UNDEAD) == true and IsUnitType(u,UNIT_TYPE_MECHANICAL) == false and IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) == false then
                call DestroyEffect(AddSpecialEffectTarget(HOLY_SFX,u,HOLY_SFX_ATTACH))
                call UnitDamageTarget(TempCast,u,Damage(TempLvl),false,true,ATK_TYPE,DMG_TYPE,WPN_TYPE)
        set u = null
        return false
    private function Actions takes nothing returns boolean //Deals with the firing of the spell and group enumeration
        if GetSpellAbilityId() == SPELL_ID then
            set TempCast = GetTriggerUnit()
            set TempLvl = GetUnitAbilityLevel(TempCast,SPELL_ID)
            call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(TempCast),GetUnitY(TempCast),Area(TempLvl),e)
        return false
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t,Condition(function Actions))
        set e = Condition(function AffectedFilter)
        call Preload(HOLY_SFX) //Preloads the SFX
For the spell, I suggest using something like Roar or Fan of Knives.
Feel free to ask any questions.

Note: I did not actually test this code yet so there may be some errors left. Will edit with a test map when I get the chance.

Edit: Should work. Attached map.


  • RoyalGrace.w3x
    19.8 KB · Views: 34