| 03-18-2009, 06:02 AM | #1 |
It crashes my World Editor and corrupts the map with every try I take at it, so could somebody help me with this? I've highlighted the area where I think the problem is. JASS:function BoolPasser takes nothing returns boolean return true endfunction // function CrystalFiltering takes nothing returns nothing // if GetItemTypeId(GetEnumItem()) == 'I001' or GetItemTypeId(GetEnumItem()) == 'I002' or GetItemTypeId(GetEnumItem()) == 'I003' then // call RemoveItem( GetEnumItem() ) // endif // endfunction function Trig_GE_Periodic_Effects_Actions takes nothing returns nothing local group g = CreateGroup() local unit u local integer i = 0 // call EnumItemsInRectBJ( GetPlayableMapRect(), function CrystalFiltering ) call GroupEnumUnitsInRect(g, GetPlayableMapRect(), Condition( function BoolPasser ) ) loop set u = FirstOfGroup(g) exitwhen u == null call GroupRemoveUnit(g, u) if UnitHasBuffBJ(u, 'B000')==true and GetUnitAbilityLevel( u, 'A005' )==0 then // Enchantment call UnitAddAbilityBJ( u, 'A005' ) elseif UnitHasBuffBJ(u, 'B000')==false and GetUnitAbilityLevel( u, 'A005' )==1 then call UnitRemoveAbilityBJ( u, 'A005' ) endif if UnitHasBuffBJ(u, 'B002')==true and GetUnitAbilityLevel( u, 'A00J' )==0 then // Mystic Invokation call UnitAddAbility( u, 'A00J' ) call SetUnitAbilityLevel( u, 'A00J', GetUnitAbilityLevel(udg_MainUnit[GetPlayerIndex(GetOwningPlayer(u))], 'A00G')) elseif UnitHasBuffBJ(u, 'B002')==false and GetUnitAbilityLevel( u, 'A00J' )>0 then call UnitRemoveAbility( u, 'A00J' ) endif if GetUnitTypeId(u)=='H007' and GetUnitState(u, UNIT_STATE_MANA)<0.5 then // Shadowclone expiration call MoveLocation(udg_LocSPFX, GetUnitX(u), GetUnitY(u)) call RemoveUnit(u) call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl" ) call DestroyEffect( GetLastCreatedEffectBJ() ) endif endloop call DestroyGroup(g) set u = null set g = null endfunction function InitTrig_GE_Periodic_Effects takes nothing returns nothing set gg_trg_GE_Periodic_Effects = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_GE_Periodic_Effects, 0.05 ) call TriggerAddAction( gg_trg_GE_Periodic_Effects, function Trig_GE_Periodic_Effects_Actions ) endfunction |
| 03-18-2009, 06:55 AM | #2 |
JASS:call GroupEnumUnitsInRect(g, GetPlayableMapRect(), Condition( function BoolPasser ) ) Doesn't that red bolded thing has to be a boolexpr? |
| 03-18-2009, 07:00 AM | #3 |
It's worked the past over 9000 times I've used it, and that's the common no-leak method people suggest for picking ALL units possible. Using a null leaks, apparently. |
| 03-18-2009, 07:05 AM | #4 |
JASS:call GroupRemoveUnit(g, u) Try putting that line at the end of your loop. I don't get whats wrong if that still doesn't work. Although I have to say that you should stop using those BJS. |
| 03-18-2009, 07:07 AM | #5 |
It worked before, and I had that BEFORE the bug appeared. EDIT! I solved it on my own, fixed code... JASS:function BoolPasser takes nothing returns boolean return true endfunction // function CrystalFiltering takes nothing returns nothing // if GetItemTypeId(GetEnumItem()) == 'I001' or GetItemTypeId(GetEnumItem()) == 'I002' or GetItemTypeId(GetEnumItem()) == 'I003' then // call RemoveItem( GetEnumItem() ) // endif // endfunction function Trig_GE_Periodic_Effects_Actions takes nothing returns nothing local group g = CreateGroup() local unit u local integer i = 0 // call EnumItemsInRectBJ( GetPlayableMapRect(), function CrystalFiltering ) call GroupEnumUnitsInRect(g, GetPlayableMapRect(), Condition( function BoolPasser ) ) loop set u = FirstOfGroup(g) exitwhen u == null call GroupRemoveUnit(g, u) if UnitHasBuffBJ(u, 'B000')==true and GetUnitAbilityLevel( u, 'A005' )==0 then // Enchantment call UnitAddAbility( u, 'A005' ) elseif UnitHasBuffBJ(u, 'B000')==false and GetUnitAbilityLevel( u, 'A005' )==1 then call UnitRemoveAbility( u, 'A005' ) endif if UnitHasBuffBJ(u, 'B002')==true and GetUnitAbilityLevel( u, 'A00J' )==0 then // Enchantment call UnitAddAbility( u, 'A00J' ) call SetUnitAbilityLevel( u, 'A00J', GetUnitAbilityLevel( udg_MainUnit[GetPlayerId(GetOwningPlayer(u))], 'A00G')) elseif UnitHasBuffBJ(u, 'B002')==false and GetUnitAbilityLevel( u, 'A00J' )>0 then call UnitRemoveAbility( u, 'A00J' ) endif if GetUnitTypeId(u)=='H007' and GetUnitState(u, UNIT_STATE_MANA)<0.5 then // Shadowclone expiration call MoveLocation(udg_LocSPFX, GetUnitX(u), GetUnitY(u)) call RemoveUnit(u) call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl" ) call DestroyEffect( GetLastCreatedEffectBJ() ) endif endloop call DestroyGroup(g) set u = null set g = null endfunction function InitTrig_GE_Periodic_Effects takes nothing returns nothing set gg_trg_GE_Periodic_Effects = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_GE_Periodic_Effects, 0.05 ) call TriggerAddAction( gg_trg_GE_Periodic_Effects, function Trig_GE_Periodic_Effects_Actions ) endfunction EDIT! +Rep, thanks for helping! |
