• 🏆 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!

AOE Spell Request

Status
Not open for further replies.
Level 5
Joined
Mar 5, 2009
Messages
137
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
Joined
Nov 18, 2007
Messages
1,084
I do hope you know a little about Jass and use NewGen WE.
JASS:
scope RoyalGrace initializer Init

    native UnitAlive takes unit id returns boolean //Remove this if already implemented.
    
    globals
        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 //*
    endglobals
    
    private constant function Heal takes integer lvl returns real //How much to heal friendly units by. Depends on level
        return 300.*lvl
    endfunction
    
    private constant function Damage takes integer lvl returns real //How much to hurt enemy undead units by. Depends on level
        return 150.*lvl
    endfunction
    
    private constant function Area takes integer lvl returns real //The area of effect for the spell. 
        return 400.+0*lvl
    endfunction
    
    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)
            endif
        endif
        set u = null
        return false
    endfunction
    
    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)
        endif
        return false
    endfunction
    
    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
    endfunction
endscope
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.
 

Attachments

  • RoyalGrace.w3x
    19.8 KB · Views: 34
Status
Not open for further replies.
Top