• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Simple MUI spell request

Status
Not open for further replies.
Level 11
Joined
Aug 11, 2009
Messages
594
I need an MUI spell which is very basic. When activated it deals 1xInt per sec to all enemies within 250. Lasts for 5 sec.

+rep for help on this

Thanks in advance for taking your time :)
 
Level 11
Joined
Aug 11, 2009
Messages
594
Preferably GUI.

You can add in a special effect which shows with every damage interval, I can change afterwards which one.

Damage does not have to be displayed.

Damage will most likely not be edited if you put it to 1xIntelligence per second, but make a formula if you like :)

Just ask if there is anything else you need to know. Thanks
 
Sry but I don't have time to create this in GUI.
Here is simple jass script that work in default WE.

JASS:
function EffectedUnits takes nothing returns boolean

    if GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0 then
        return false
    elseif IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true then
        return true
    endif
        return false
        
endfunction

function DamageUnits takes nothing returns nothing
    call UnitDamageTarget(GetTriggerUnit(), GetEnumUnit(), udg_damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endfunction

function Trig_Spell_Actions takes nothing returns nothing

    local integer i = 0
    local group g = CreateGroup()
    local real damage = I2R(( 10 * GetHeroInt(GetTriggerUnit(), true) ))
    
    if GetSpellAbilityId() == 'AHtc' then
        loop
            exitwhen i == 5
            
            call GroupEnumUnitsInRange(g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 250, Condition(function EffectedUnits))
            set udg_damage = damage
            call ForGroup(g, function DamageUnits)
            call GroupClear(g)
            call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit())))
            call TriggerSleepAction( 1. )
            
            set i = i + 1
            
        endloop
        
        call DestroyGroup(g)
        set g = null
        
    endif
endfunction

//===========================================================================
function InitTrig_Spell takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( t, function Trig_Spell_Actions )
endfunction

If you use Jass New Gen this should be simple for use if not, then just contact me for any problems you encounter.
All you need to do now is to create real variable named damage and trigger named Spell, convert trigger into custom script and replace everything there with this code. You can change variable and trigger name after this it will be changed in script as well.
 
Level 11
Joined
Aug 11, 2009
Messages
594
Thanks m8 it seems to work well even if I dont use New Gen :) thanks alot for the help on this, now all my Beta Heroes are done :D

Edit: Actually when I tried to change the special effect into something more fitting than thunder clap, WE stopped working when I tried to save and a (dont know what it is called in english but one of those yellow things on the desktop which you can put files in) was created named after my WE map and with "temp" at the end. And it was filled with all kind of files. Any thoughts what could be wrong?

Edit 2: Noticed now there had to be 2 "\" between each word in the special effect so now it works for me :)
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
^Leaks group if the ability condition fails.
Remove the CreateGroup line. Remove GroupClear line. Use bj_lastCreatedGroup instead of g.
Unit state life <= 0 should be replaced with IsUnitType(u, UNIT_TYPE_DEAD).
You can remove the ForGroup.
Combine DamageUnits and EffectedUnits functions. Always return false at the end of the combined function.
 
Level 11
Joined
Aug 11, 2009
Messages
594
hmm, could you perhaps copy his text and replace the texts that are wrong and then post it here so I can just copy the right text, because I dont really understand :p would be very grateful
 
Damn I missed endif -.-

Anyway Maker suggested something like this:
JASS:
function EffectedUnits takes nothing returns boolean
    if not (IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) and IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) ) then
        call UnitDamageTarget(GetTriggerUnit(), GetFilterUnit(), udg_damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
    endif
    return false
endfunction

function Trig_Spell_Actions takes nothing returns nothing

    local integer i = 0
    local real damage = I2R(( 10 * GetHeroInt(GetTriggerUnit(), true) ))
    
    if GetSpellAbilityId() == 'AHtc' then
        loop
            exitwhen i == 5
            set udg_damage = damage
            call GroupEnumUnitsInRange(bj_lastCreatedGroup, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 250, Condition(function EffectedUnits))
            call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit())))
            call TriggerSleepAction( 1. )
            set i = i + 1
        endloop
    endif
endfunction

//===========================================================================
function InitTrig_Spell takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( t, function Trig_Spell_Actions )
endfunction
 
Last edited:
Level 11
Joined
Aug 11, 2009
Messages
594
because of map mechanics the attack type is Chaos and i set the damage type to Magic. Will it still ignore magic immune even if the first one is set to chaos instead of magic?
 
Level 11
Joined
Aug 11, 2009
Messages
594
i wrote a little wrong :p what I meant is that this spell you have made, I've changed attack type to chaos and damage to Magic. So if an enemy who is magic immune comes close, will he take damage or not?
 
Level 11
Joined
Nov 15, 2007
Messages
781
I bet it would take less time for you to test it and tell us, than for someone who knows off the top of their head to come along and answer you :p
 
Status
Not open for further replies.
Top