| 11-10-2006, 03:08 AM | #1 |
JASS:function Eat_Conditions takes nothing returns boolean return (GetSpellAbilityId() == 'A003') endfunction function If_Conditions takes nothing returns boolean return ( udg_i != 1 ) return ( GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) > .405 ) endfunction function Group_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit u2 if ( function If_Conditions ) then set u2 = CreateUnit( GetOwningPlayer(u), 'e000', GetUnitX(u), GetUnitY(u), 270.0 ) call IssueTargetOrder( u2, "firebolt", u) call RemoveUnit(u2) set udg_i = 1 else call PauseUnit(u, true ) call IssueImmediateOrder(u, "stop" ) call PauseUnit(u, false ) endif set u = null set u2 = null endfunction function Eat_Actions takes nothing returns nothing local group g = CreateGroup() local unit u = GetTriggerUnit() local location l = GetUnitLoc(u) local real x = GetLocationX(l) local real y = GetLocationY(l) local rect r = RectFromCenterSizeBJ(l, 20.0, 20.0) set g = GetUnitsInRectAll(r) call ForGroup( g, function Group_Actions ) endfunction It's telling me that the line with "endif" has an error "Cannot convert code to boolean. Can anyone tell me why it's doing this? It seems ok to me... And yes, there are some leaks and stuff. I intend on patching those as soon as I figure out what's bugging up. |
| 11-10-2006, 07:50 AM | #2 |
if the boolean variant is the problem u can always use 0 and 1 for a boolean am i right? |
| 11-10-2006, 08:11 AM | #3 |
if ( function If_Conditions ) then
This sentence is wrong. "function If_Conditions" is a variable of the type "code", but the statement "if" needs a boolean variable. Change it to this: if ( If_Conditions() ) then And the "If_Conditions()" executes the function and returns a boolean variable. Then your trigger go right. BTW, this trigger JASS:function If_Conditions takes nothing returns boolean return ( udg_i != 1 ) return ( GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) > .405 ) endfunction |
| 11-10-2006, 09:58 AM | #4 |
Sorry for the off-topic but your back ? , it hasn't been 3 years, and thats me at one point in your sig x) |
| 11-10-2006, 11:05 AM | #5 |
Keep it on topic please. We do have a forum dedicated to the rest. And the problem seems to have been solved. |
| 11-10-2006, 02:09 PM | #6 | |
Quote:
Thanks for your help, I wouldn't have caught that one myself. EDIT: Yup, I just saved and it parses correctly. I'll have to remember this for later. |
| 11-10-2006, 02:35 PM | #7 | |
Quote:
You shouldent have 2 return lines in a function really for what you want. If Wc3's parser sees a return when its using it, it will not read the rest of the function. So the seconds return does nothing atall but waste memory. If you want to check them both, use: JASS:function If_Conditions takes nothing returns boolean return ((udg_i != 1) and (GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) > .405)) endfunction |
| 11-10-2006, 10:12 PM | #8 |
ahh, thanks for that. I'll remeber that one too. |
