| 10-12-2006, 05:16 PM | #1 |
The trigger is supposed to: When a unit of unit type h008 attacks a hero then remove a random random item from attacked unit and create an item of same ID for each hero of the player who Orignally owned the attacking unit (set by a different trigger on unit spawn) JASS:function Mindleech_Mass_Conditions001 takes nothing returns boolean if GetUnitTypeId(GetTriggerUnit()) == 'h008' then return true endif return false endfunction function Mindleech_Mass_Conditions002 takes nothing returns boolean if ( IsUnitType(GetAttackedUnitBJ(), UNIT_TYPE_HERO) == true ) then return true endif return false endfunction function Mindleech_Mass_Conditions003 takes nothing returns boolean if (IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true)) then return true endif return false endfunction function Trig_Mindleech_Mass_func002 takes nothing returns nothing if ( Mindleech_Mass_Conditions003()) then call UnitAddItemByIdSwapped( GetItemTypeId(GetLastRemovedItem()), GetEnumUnit() ) endif endfunction function Mindleech_Mass_Actions takes nothing returns nothing local group array original_owner local integer i = 1 call UnitRemoveItemFromSlot(GetAttackedUnitBJ(),GetRandomInt(1,6)) loop exitwhen i > 10 if IsUnitInGroup(GetTriggerUnit(), original_owner[i]) then call ForGroupBJ( GetUnitsInRectOfPlayer(GetPlayableMapRect(), ConvertedPlayer(i)), function Trig_Mindleech_Mass_func002 ) set i = i + 1 endif endloop endfunction function InitTrig_Mindleech_Mass takes nothing returns nothing local trigger gg_trg_mindleech_mass set gg_trg_mindleech_mass = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_mindleech_mass,EVENT_PLAYER_UNIT_ATTACKED) call TriggerAddCondition(gg_trg_mindleech_mass,Condition(function Mindleech_Mass_Conditions001)) call TriggerAddCondition(gg_trg_mindleech_mass,Condition(function Mindleech_Mass_Conditions002)) call TriggerAddAction(gg_trg_mindleech_mass,function Mindleech_Mass_Actions) endfunction |
| 10-12-2006, 06:21 PM | #2 |
Two )) on the end; should be one. Just use: return IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) |
| 10-12-2006, 06:33 PM | #3 |
wow...thats so much simpler than how i've been doing triggeres, thanks a lot man :) |
| 10-13-2006, 12:45 PM | #4 |
Isn't there an issue with IsUnitType in boolexprs that requires you to compare to == true? |
| 10-13-2006, 12:51 PM | #5 |
btw JASS:function Mindleech_Mass_Conditions003 takes nothing returns boolean if (IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true)) then return true endif return false endfunction JASS:function Mindleech_Mass_Conditions003 takes nothing returns boolean if (IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true) then return true endif return false endfunction |
| 10-13-2006, 06:42 PM | #6 |
actually: JASS:function Trig_Mindleech_Mass_func002 takes nothing returns nothing if (IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO)) then call UnitAddItemByIdSwapped( GetItemTypeId(GetLastRemovedItem()), GetEnumUnit() ) endif endfunction |
| 10-13-2006, 08:39 PM | #7 |
Thanks guys, should be sorted now :) |
