| 01-18-2006, 06:06 AM | #1 |
Any idea why this boolean is only checking the first condition within. Unit NC17 is not included in the group, but 'ocat' is getting included. JASS:function GolemsCatsBool takes nothing returns boolean if GetUnitTypeId(GetFilterUnit()) != 'NC17' then return true elseif GetUnitTypeId(GetFilterUnit()) != 'ocat' then return true elseif GetUnitTypeId(GetFilterUnit()) != 'ewsp' then return true endif return false endfunction function Kill_player_units takes nothing returns nothing local unit u=GetEnumUnit() call KillUnit(u) set u=null endfunction function Trig_Kill_units_Actions takes nothing returns nothing local group g set g=GetUnitsOfPlayerMatching(Player(1),Condition (function GolemsCatsBool)) call ForGroup( g, function Kill_player_units ) call DestroyGroup(g) set g=null endfunction This is shortened quite a bit, but the rest of it isn't the problem. |
| 01-18-2006, 08:04 AM | #2 |
well, try merging all of this in one single condition: JASS:if((GetUnitTypeID(GetFilterUnit())=='NC17')or(GetUnitTypeID(GetFilterUnit())=='ocat')or(GetUnitTypeID(GetFilterUnit())=='ewsp'))then return false else return true |
| 01-18-2006, 08:57 AM | #3 |
Wouldn't that be the same as JASS:function GolemsCatsBool takes nothing returns boolean return GetUnitTypeId(GetFilterUnit()) != 'NC17' or GetUnitTypeId(GetFilterUnit()) != 'ocat' or GetUnitTypeId(GetFilterUnit()) != 'ewsp' endfunction |
| 01-18-2006, 09:34 AM | #4 |
It should probably be == (equal to) instead of != (not equal to), if I understand you correctly. Try that. |
| 01-18-2006, 09:37 AM | #5 |
Okay i think i found the error here JASS:function GolemsCatsBool takes nothing returns boolean if GetUnitTypeId(GetFilterUnit()) != 'NC17' then return true elseif GetUnitTypeId(GetFilterUnit()) != 'ocat' then return true elseif GetUnitTypeId(GetFilterUnit()) != 'ewsp' then return true endif return false endfunction The next one has the same problem. JASS:function GolemsCatsBool takes nothing returns boolean return GetUnitTypeId(GetFilterUnit()) != 'NC17' or GetUnitTypeId(GetFilterUnit()) != 'ocat' or GetUnitTypeId(GetFilterUnit()) != 'ewsp' endfunction This function will return "true" on these 3 unit types and false on all else: JASS:function GolemsCatsBool takes nothing returns boolean return GetUnitTypeId(GetFilterUnit()) == 'NC17' or GetUnitTypeId(GetFilterUnit()) == 'ocat' or GetUnitTypeId(GetFilterUnit()) == 'ewsp' endfunction The difference with your function is that all "!=" are replaced with "==". P.S: Oh, BladeDK is fast :( Man all are faster than me today. I should stop making such long posts. |
| 01-18-2006, 07:00 PM | #6 | |
Quote:
|
| 01-18-2006, 10:27 PM | #7 | |
Quote:
JASS:function GolemsCatsBool takes nothing returns boolean return GetUnitTypeId(GetFilterUnit()) != 'NC17' and GetUnitTypeId(GetFilterUnit()) != 'ocat' and GetUnitTypeId(GetFilterUnit()) != 'ewsp' endfunction |
| 01-19-2006, 05:35 AM | #8 |
On an unrelated note, do you know that a logical structure that looks like: A and B and C and D is equivalent to logical structure that looks like: notA or notB or notC or notD So in that sense, it doesn't matter if you use or's and ==, or and's and != |
| 01-19-2006, 06:30 AM | #9 |
The problem ended up being something really dumb. NC17 was supposed to be nC17 Damn that was stupid. |
| 01-19-2006, 09:13 AM | #10 |
didn't know capitalisation mattered in these things :/ |
| 01-19-2006, 10:04 AM | #11 |
ofcourse it does, the number 'n' is completely different than the number 'N' |
