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

[JASS] Removing Certain units from map...

Status
Not open for further replies.
Level 2
Joined
Oct 29, 2007
Messages
17
JASS:
function Trig_kill_Func1A takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetEnumUnit()) != 'H00A' ) ) then
        return false
    endif
    if ( not ( GetUnitTypeId(GetEnumUnit()) != 'H00z' ) ) then
        return false
    endif
    if ( not ( GetUnitTypeId(GetEnumUnit()) != 'n00B' ) ) then
        return false
    endif
    return true
endfunction

function Trig_kill_Func2A takes nothing returns nothing
 call KillUnit( GetEnumUnit() )
endfunction

call ForGroupBJ( GetUnitsOfPlayerMatching(GetOwningPlayer(GetEnteringUnit()), Condition(function Trig_kill_Func1A)), function Trig_kill_Func2A )

Trying to remove all units for the player, other than those 3 ('H00A', 'H00z' and 'n00B'). For some reason it unconditionally kills everything. Renamed stuff for simplicity, I am sure it is with the conditional checking, but can't see what's wrong.

Event is a unit entering region.

Thanks.

Edit: Yes, I realise this is a gui -> jass convert, but I am not sure how to do with multiple conditions otherwise....
 
Last edited:
JASS:
function Trig_kill_Func1A takes nothing returns boolean  
    return GetUnitTypeId(GetFilterUnit()) != 'H00A' and GetUnitTypeId(GetFilterUnit()) != 'H00z' and GetUnitTypeId(GetFilterUnit()) != 'n00B' 
endfunction 
//
function Trig_kill_Func2A takes nothing returns nothing  
    call KillUnit(GetEnumUnit()) 
endfunction 
//
local group g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetEnteringUnit()), Filter(function Trig_kill_Func1A))
call ForGroup(g, function Trig_kill_Func2A)
call DestroyGroup(g)
set g = null
 
Status
Not open for further replies.
Top