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

muti unti spells

Status
Not open for further replies.
Level 6
Joined
Oct 11, 2005
Messages
142
how can you get a spell that only hits one target to have a area spell effect? maybe like a charm spell that hits a wide area insted of just one unit?
 
Level 11
Joined
Feb 22, 2006
Messages
752
Well, the easiest way to do that is to make a trigger-enhanced spell. For your charm spell, for example, create a dummy spell based on silence, set mana costs, icons, etc. to whatever you want for your charm spell. Set duration to 0.01( we want 0.01 because WE recognizes duration of 0 as infinity) and targets allowed to none. Now, set your area of effect to whatever area of effect you want the spell to have. Finally, give your hero or unit, etc. the dummy Silence spell.

Now, you need a trigger that fires whenever a unit casts your dummy spell and "charms" every unit within the area of effect. You can easily do it using GUI. Note, for the following example, I am assuming the AoE charm spell only affects enemies and non-hero units.

Events:
Unit- A unit starts the effect of an ability

Conditions:
(Ability being cast) Equal to [name of the dummy Silence spell]

Actions:
Unit Group - Pick every unit in (Units within [AoE of your spell] of (Target point of ability being cast) Matching ((((Matching unit) belongs to an enemy of (Owner of (Trigger unit))) Equal to True) and (((Matching unit) is a Hero) Equal to False))) and do (Actions)

Loop - Actions
Unit - Change ownership of (Picked unit) to (Owner of (Triggering unit)) and Change color
Special Effect- Create a special effect at (Position of (Picked unit)) using [whatever special effect you want here]

This trigger should work perfectly (I use it in my own map and it works fine) but if you have any bugs or problems just post a reply.
 
Level 11
Joined
Feb 22, 2006
Messages
752
Ok, I've made a 2nd reply to make things more organized. Now, if you want to make a spell like AoE sleep, for example, you can't simply just use GUI because the GUI triggers won't let you sleep units that don't belong to neutral hostile or neutral passive. To make AoE sleep, you need to create a dummy ability for the hero/unit (again, use Silence and do everything just like for the charm spell). However, this time you will also need a dummy unit and ANOTHER spell for that dummy unit. For the dummy unit, base it off a footman, set collision size to 0, and give it the locust ability (the locust ability makes the unit invisible and unselectable). For the ability to give to the dummy unit, base it off sleep, and give the spell the same duration, buffs, and targets allowed as you want your AoE sleep to have. Make sure to set the mana cost and cooldown to 0. Now, if you know JASS, this next part should be simple and easy to understand. Note, I am assuming that your dummy unit has the code 'H000', your dummy Silence ability has the code 'A000', and your sleep ability for the dummy unit as the code 'A001'. If you have different raw codes for your spells, just replace my codes with yours.

JASS:
function Trig_Mass_Sleep_Conditions takes nothing returns boolean
    return GetSpellAbilityId()==’A000’
endfunction
 
function Trig_Mass_Sleep takes nothing returns nothing
    local group g
    local unit u
    local unit cast
    local unit dumb
    local location p
     
    set cast = GetTriggerUnit()
    set p = GetSpellTargetLoc()
    set g = GetUnitsInRangeOfLocAll([insert whatever AoE you want here], p)
    set u = FirstOfGroup(g)
    loop
        exitwhen u==null
        set u = FirstOfGroup(g)
        if  IsUnitEnemy(u, GetOwningPlayer(cast))==true then
            call GroupRemoveUnit(g,u)
            set dumb = CreateUnitAtLoc(GetOwningPlayer(cast), ‘h000’, GetUnitLoc(u), 0.00)
            call IssueTargetOrderBJ(dumb, “sleep”, u)
            call UnitApplyTimedLifeBJ (1.50, ‘BTLF’, dumb)
            set dumb = null
        endif
    endloop
     
    set g = null
    set u = null
    set cast = null
    set p = null
endfunction
 
function Init_Trig_Mass_sleep takes nothing returns nothing
    local trigger t
    set t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Trig_Mass_Sleep_Conditions))
    call TriggerAddAction(t, function Trig_Mass_Sleep)
endfunction

If you don't understand JASS, basically this trigger fires every time a unit casts the dummy Silence spell. Then, it adds all units within the area of effect to the unit group g. Then, it summons the dummy unit and makes the dummy unit cast the sleep spell we gave it on the first unit in group g. After the spell is cast, the target unit of the sleep spell is removed from group g and the dummy unit is destroyed. The loop ensures that all units within the unit group g will have sleep cast on them. If you need further help or don't understand the concept, I suggest reading Daelin's JASS tutorial. It probably explains the mass sleep spell better than I did.
 
Status
Not open for further replies.
Top