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

[JASS] UnitGroup Damage

Status
Not open for further replies.
Level 17
Joined
Jun 28, 2008
Messages
776
I am still new to JASS so I don't know all the tricks.

How can I use a unit(lets call him u) in a Unit Group Function example :

JASS:
function Damage_Units takes nothing returns nothing

    local unit u // ??? how do I get u from function main to function Damage_Unit

    call UnitDamageTargetBJ(u,GetEnumUnit(), 500, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)

endfunction

function Main takes nothing returns nothing

    local unit u          = GetTriggerUnit()
    local group g         = null
    local location point1 = GetUnitLoc(u)
    
    set g = GetUnitsInRangeOfLocAll(900, point1)
    call ForGroupBJ(g, function Damage_Units)

endfunction

I tried the Local Handel Vars system, but I can't seem to get it to work with a group.

Please help me for I am clueless...

Thanks in advance
 
Status
Not open for further replies.
Top