| 03-19-2008, 08:01 PM | #1 |
JASS:call GroupEnumUnitsInRange(engroup, ax, ay, 250, IsPlayerEnemy(GetOwningPlayer(GetEnumUnit()), GetOwningPlayer(GetSpellAbilityUnit())) == true) I need some help, why is this giving me the error: "Cannot Convert Boolean to Boolexpr"? Thanks in advance. |
| 03-19-2008, 08:10 PM | #2 |
a boolexper is a function with no argument (takes nothing) and returns a boolean So you need to use globals or the cache for use your conditions. also you can use only one boolexpr |
| 03-19-2008, 08:12 PM | #3 |
You need to stick the boolean check in a function which returns a boolean and then use Condition(function FunctionName) to get the boolexpr |
| 03-19-2008, 08:12 PM | #4 |
A boolean is not a boolexpr. You'd need to do it like this: JASS:function MyBoolExpr takes nothing returns boolean return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(bj_meleeNearestMine)) endfunction function Rawr takes nothing returns nothing local boolexpr b = Condition(function MyBoolExpr) // Declare other variables set bj_meleeNearestMine = GetSpellAbilityUnit() call GroupEnumUnitsInRange(engroup, ax, ay, 250, b) endfunction |
| 03-19-2008, 08:17 PM | #5 | |
Wow, am I getting worse at this or what? Thank you guys, it may seem like I don't know what I'm doing but you just helped me pass another stepping stone to vJass mastery. Also thank you all for your quick posts! Edit: Quote:
Sorry for posting so quick without reading your code, but why did you use "set bj_meleeNearestMine = ..." I tried compiling without it and it still worked. |
| 03-19-2008, 08:23 PM | #6 |
there is no VJass here :p |
| 03-20-2008, 04:18 AM | #7 |
He used bj_meleeNearestMine as a global variable to pass the unit which cast the spell to the boolexpr function. He could have easily wrote either of the following two instead: JASS:globals private unit U endglobals function MyBoolExpr takes nothing returns boolean return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(U)) endfunction function Rawr takes nothing returns nothing local boolexpr b = Condition(function MyBoolExpr) // Declare other variables set U = GetSpellAbilityUnit() call GroupEnumUnitsInRange(engroup, ax, ay, 250, b) endfunction JASS:globals private player P endglobals function MyBoolExpr takes nothing returns boolean return IsUnitEnemy(GetFilterUnit(), P) endfunction function Rawr takes nothing returns nothing local boolexpr b = Condition(function MyBoolExpr) // Declare other variables set P = GetOwningPlayer(GetTriggerUnit()) call GroupEnumUnitsInRange(engroup, ax, ay, 250, b) endfunction |
| 03-20-2008, 10:20 AM | #8 |
I don't like player variables, too many bad memories of Player(-1). |
| 03-20-2008, 01:46 PM | #9 |
You still could have used the IsUnitEnemy native instead of IsPlayerEnemy, though. :) |
| 03-20-2008, 07:45 PM | #10 |
Hey, I just copied and pasted what was in his original function, lay off! :( |
| 03-20-2008, 07:47 PM | #11 | |
Quote:
Oh, I'll do that. I never knew that existed because this was Gui converted code. |
