| 08-20-2008, 07:33 AM | #1 |
JASS:library ConditionSystem // The default globals; globals private constant integer DummyID = 'h000' // The dummy unit's raw code private constant real Duration = 15 // Remember: the duration should always be the same as the duration of the abilities! endglobals // The ability globals; globals constant integer CONDITION_TYPE_BLIND = 'A000' constant integer CONDITION_TYPE_BURN = 'A002' constant integer CONDITION_TYPE_CRIPPLE = 'A003' constant integer CONDITION_TYPE_DAZED = 'A006' constant integer CONDITION_TYPE_MAIM = 'A005' constant integer CONDITION_TYPE_SILENCE = 'A001' constant integer CONDITION_TYPE_SUNDER = 'A004' endglobals // The ability order strings globals; globals constant string CONDITION_STRING_TYPE_BLIND = "curse" constant string CONDITION_STRING_TYPE_BURN = "innerfire" constant string CONDITION_STRING_TYPE_CRIPPLE = "cripple" constant string CONDITION_STRING_TYPE_DAZED = "cripple" constant string CONDITION_STRING_TYPE_MAIM = "cripple" constant string CONDITION_STRING_TYPE_SILENCE = "silence" constant string CONDITION_STRING_TYPE_SUNDER = "innerfire" endglobals // The buff globals; globals constant integer CONDITION_BUFF_TYPE_BLIND = 'B000' constant integer CONDITION_BUFF_TYPE_BURN = 'B003' constant integer CONDITION_BUFF_TYPE_CRIPPLE = 'B002' constant integer CONDITION_BUFF_TYPE_DAZED = 'B006' constant integer CONDITION_BUFF_TYPE_MAIM = 'B005' constant integer CONDITION_BUFF_TYPE_SILENCE = 'B001' constant integer CONDITION_BUFF_TYPE_SUNDER = 'B004' endglobals // System globals. Shouldn't be edited. globals private group BlindUnits private group BurnUnits private group CrippleUnits private group DazedUnits private group MaimUnits private group SilenceUnits private group SunderUnits endglobals function AddCondition takes unit whichUnit, string whichBuff returns nothing local unit u=whichUnit local string id=whichBuff local unit d=CreateUnit(GetOwningPlayer(u),DummyID,GetUnitX(u),GetUnitY(u),0) if id==CONDITION_STRING_TYPE_BLIND then call UnitAddAbility(d,CONDITION_TYPE_BLIND) call IssueTargetOrder(d,CONDITION_STRING_TYPE_BLIND,u) call GroupAddUnit(BlindUnits,u) elseif id==CONDITION_STRING_TYPE_BURN then call UnitAddAbility(d,CONDITION_TYPE_BURN) call IssueTargetOrder(d,CONDITION_STRING_TYPE_BURN,u) call GroupAddUnit(BurnUnits,u) elseif id==CONDITION_STRING_TYPE_CRIPPLE then call UnitAddAbility(d,CONDITION_TYPE_CRIPPLE) call IssueTargetOrder(d,CONDITION_STRING_TYPE_CRIPPLE,u) call GroupAddUnit(CrippleUnits,u) elseif id==CONDITION_STRING_TYPE_DAZED then call UnitAddAbility(d,CONDITION_TYPE_DAZED) call IssueTargetOrder(d,CONDITION_STRING_TYPE_DAZED,u) call GroupAddUnit(DazedUnits,u) elseif id==CONDITION_STRING_TYPE_MAIM then call UnitAddAbility(d,CONDITION_TYPE_MAIM) call IssueTargetOrder(d,CONDITION_STRING_TYPE_MAIM,u) call GroupAddUnit(MaimUnits,u) elseif id==CONDITION_STRING_TYPE_SILENCE then call UnitAddAbility(d,CONDITION_TYPE_SILENCE) call IssuePointOrder(d,CONDITION_STRING_TYPE_SILENCE,GetUnitX(u),GetUnitY(u)) call GroupAddUnit(SilenceUnits,u) elseif id==CONDITION_STRING_TYPE_SUNDER then call UnitAddAbility(d,CONDITION_TYPE_SUNDER) call IssueTargetOrder(d,CONDITION_STRING_TYPE_SUNDER,u) call GroupAddUnit(SunderUnits,u) else call BJDebugMsg("|cffff0000Condition System|r: You have specified a wrongly spelled buff string, or a buff which isn't existing.") endif call UnitApplyTimedLife(d,'BTLF',2) set u=null set d=null endfunction function AddAllConditions takes unit whichUnit returns nothing call AddCondition(whichUnit,CONDITION_STRING_TYPE_BLIND) call AddCondition(whichUnit,CONDITION_STRING_TYPE_BURN) call AddCondition(whichUnit,CONDITION_STRING_TYPE_CRIPPLE) call AddCondition(whichUnit,CONDITION_STRING_TYPE_DAZED) call AddCondition(whichUnit,CONDITION_STRING_TYPE_MAIM) call AddCondition(whichUnit,CONDITION_STRING_TYPE_SILENCE) call AddCondition(whichUnit,CONDITION_STRING_TYPE_SUNDER) endfunction function RemoveCondition takes unit whichUnit, string whichBuff returns nothing if whichBuff==CONDITION_STRING_TYPE_BLIND then call UnitRemoveBuffBJ(CONDITION_BUFF_TYPE_BLIND,whichUnit) call GroupRemoveUnit(BlindUnits,whichUnit) elseif whichBuff==CONDITION_STRING_TYPE_BURN then call UnitRemoveBuffBJ(CONDITION_BUFF_TYPE_BURN,whichUnit) call GroupRemoveUnit(BurnUnits,whichUnit) elseif whichBuff==CONDITION_STRING_TYPE_CRIPPLE then call UnitRemoveBuffBJ(CONDITION_BUFF_TYPE_CRIPPLE,whichUnit) call GroupRemoveUnit(CrippleUnits,whichUnit) elseif whichBuff==CONDITION_STRING_TYPE_DAZED then call UnitRemoveBuffBJ(CONDITION_BUFF_TYPE_DAZED,whichUnit) call GroupRemoveUnit(DazedUnits,whichUnit) elseif whichBuff==CONDITION_STRING_TYPE_MAIM then call UnitRemoveBuffBJ(CONDITION_BUFF_TYPE_MAIM,whichUnit) call GroupRemoveUnit(MaimUnits,whichUnit) elseif whichBuff==CONDITION_STRING_TYPE_SILENCE then call UnitRemoveBuffBJ(CONDITION_BUFF_TYPE_SILENCE,whichUnit) call GroupRemoveUnit(SilenceUnits,whichUnit) elseif whichBuff==CONDITION_STRING_TYPE_SUNDER then call UnitRemoveBuffBJ(CONDITION_BUFF_TYPE_SUNDER,whichUnit) call GroupRemoveUnit(SunderUnits,whichUnit) else call BJDebugMsg("|cffff0000Condition System|r: You have specified a wrongly spelled buff string, or a buff which isn't existing.") endif endfunction function RemoveAllConditions takes unit whichUnit returns nothing call RemoveCondition(whichUnit,CONDITION_STRING_TYPE_BLIND) call RemoveCondition(whichUnit,CONDITION_STRING_TYPE_BURN) call RemoveCondition(whichUnit,CONDITION_STRING_TYPE_CRIPPLE) call RemoveCondition(whichUnit,CONDITION_STRING_TYPE_DAZED) call RemoveCondition(whichUnit,CONDITION_STRING_TYPE_MAIM) call RemoveCondition(whichUnit,CONDITION_STRING_TYPE_SILENCE) call RemoveCondition(whichUnit,CONDITION_STRING_TYPE_SUNDER) endfunction function UnitHasConditionOfType takes unit whichUnit, string whichBuff returns boolean if whichBuff==CONDITION_STRING_TYPE_BLIND then return IsUnitInGroup(whichUnit,BlindUnits)==true elseif whichBuff==CONDITION_STRING_TYPE_BURN then return IsUnitInGroup(whichUnit,BurnUnits)==true elseif whichBuff==CONDITION_STRING_TYPE_CRIPPLE then return IsUnitInGroup(whichUnit,CrippleUnits)==true elseif whichBuff==CONDITION_STRING_TYPE_MAIM then return IsUnitInGroup(whichUnit,MaimUnits)==true elseif whichBuff==CONDITION_STRING_TYPE_SILENCE then return IsUnitInGroup(whichUnit,SilenceUnits)==true elseif whichBuff==CONDITION_STRING_TYPE_SUNDER then return IsUnitInGroup(whichUnit,SunderUnits)==true endif return false endfunction function UnitHasAnyCondition takes unit whichUnit returns boolean local boolean b=false if UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_BLIND)==true then set b=true elseif UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_BURN)==true then set b=true elseif UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_CRIPPLE)==true then set b=true elseif UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_MAIM)==true then set b=true elseif UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_SILENCE)==true then set b=true elseif UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_SUNDER)==true then set b=true else set b=false endif return b endfunction function UnitHasAllConditions takes unit whichUnit returns boolean return UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_BLIND)==true and UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_BURN)==true and UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_CRIPPLE)==true and UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_DAZED)==true and UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_MAIM)==true and UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_SILENCE)==true and UnitHasConditionOfType(whichUnit,CONDITION_STRING_TYPE_SUNDER)==true endfunction function InitTrig_ConditionSystem takes nothing returns nothing set gg_trg_ConditionSystem=CreateTrigger() set BlindUnits=CreateGroup() set BurnUnits=CreateGroup() set CrippleUnits=CreateGroup() set DazedUnits=CreateGroup() set MaimUnits=CreateGroup() set SilenceUnits=CreateGroup() set SunderUnits=CreateGroup() endfunction endlibrary Somehow, when I call call AddCondition(udg_u,CONDITION_STRING_TYPE_CRIPPLE) it puts on the Cripple condition, but when I call call AddCondition(udg_u,CONDITION_STRING_TYPE_DAZED) it still puts on the Cripple condition, any ideas why? |
| 08-20-2008, 07:44 AM | #2 |
Because all of your abilities for conditions are based on Cripple and the order ids are conflicting with each other. |
| 08-20-2008, 07:45 AM | #3 |
D'oh. Thanks. EDIT: Okay, now I can add all the buffs, but somehow, when I call AddAllCondition(...), only two buff images show, but the effects of all the buffs are there. Why? |
