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