| 05-14-2006, 02:12 AM | #1 |
Could someone please help me, I stink at jass and have no idea why this is misbehaving. level and RagingCharge_Damage is a valid variable. JASS:constant function RagingCharge_Damage takes real level returns real if level==1 then return 75 endif if level==2 then return 130 endif if level==3 then return 200 endif if level==4 then return 270 endif if level==5 then return 340 endif if level==6 then return 600 endif endfunction |
| 05-14-2006, 02:18 AM | #2 |
You need to have a return at the end of the function, cause wc3 doesnt know what to return if level==7 for example. And "if level==3 then return 200", you cannot have the "return 200" on the same line. fix:constant function RagingCharge_Damage takes real level returns real if level==1 then return 75 endif if level==2 then return 130 endif if level==3 then return 200 endif if level==4 then return 270 endif if level==5 then return 340 endif if level==6 then return 600 endif return 0 endfunction |
| 05-14-2006, 02:44 AM | #3 |
Doesn't work... The page now has over 2000 errors. I assume this means we are missing a function. The last line "endfunction" says it is the wrong operator. This is also not working, but it may be due to the previous issue: JASS:constant function RagingCharge_DamagePerSecond takes real level returns real return 0 endfunction constant function RagingCharge_ImpactRange takes real level returns real return 115+10*level endfunction constant function RagingCharge_FrontAngle takes real level returns real return 179 endfunction |
| 05-14-2006, 04:15 AM | #4 |
Trying changing it so it returns integer instead of real. Or just add .00 to the return values. |
| 05-14-2006, 11:44 AM | #5 | |
Quote:
That is very bad JASS, when you have if(argument1 == argument2) then You cant have what you are going to do after the then This is how you need it: JASS:constant function RagingCharge_Damage takes real level returns real if level==1 then return 75 endif if level==2 then return 130 endif if level==3 then return 200 endif if level==4 then return 270 endif if level==5 then return 340 endif if level==6 then return 600 endif endfunction EDIT: all the numbers you are returning are integers, put a "." at the end of every line, like this: JASS:constant function RagingCharge_Damage takes real level returns real if level==1 then return 75. endif if level==2 then return 130. endif if level==3 then return 200. endif if level==4 then return 270. endif if level==5 then return 340. endif if level==6 then return 600. endif endfunction EDIT2: your parameter you are taking is a real, for a level! Ok thats just weird, anyways, you arguments are asking if level(which is a real) is == 1/2/3/4/5/6(which is a integer) Bad bad bad. This is how you need it (sorry for all the edits) JASS:constant function RagingCharge_Damage takes real level returns real if level==1. then return 75. endif if level==2. then return 130. endif if level==3. then return 200. endif if level==4. then return 270. endif if level==5. then return 340. endif if level==6. then return 600. endif endfunction EDIT3: sorry these edits are rediculous, but i decided to redo your code completly, because it will never work, the function HAS to have a possible return, and wc3 parser dosent know that is 100% possible. So work round it like this: JASS:constant function RagingCharge_Damage takes integer level returns integer local integer ReturnCount if (level==1) then set ReturnCount = 75 endif if (level==2) then set ReturnCount = 130 endif if (level==3) then set ReturnCount = 200 endif if (level==4) then set ReturnCount = 270 endif if (level==5) then set ReturnCount = 340 endif if (level==6) then set ReturnCount = 600 endif return ReturnCount set ReturnCount = 0 endfunction My parser says theres no errors, dont know about you though |
| 05-14-2006, 03:36 PM | #6 |
Great, it still wont work. JASS:constant function RagingCharge_Damage takes integer level returns integer local integer ReturnCount if (level==1) then set ReturnCount = 75 endif if (level==2) then set ReturnCount = 130 endif if (level==3) then set ReturnCount = 200 endif if (level==4) then set ReturnCount = 270 endif if (level==5) then set ReturnCount = 340 endif if (level==6) then set ReturnCount = 600 endif return ReturnCount endfunction //expected end of line. Note: There are many bugs after this, but I think this first error is causing it. set ReturnCount = 0 constant function RagingCharge_DamagePerSecond takes real level returns real return 0. endfunction constant function RagingCharge_ImpactRange takes real level returns real return 115+10*level. endfunction constant function RagingCharge_FrontAngle takes real level returns real return 179.0 endfunction |
| 05-14-2006, 03:54 PM | #7 |
JASS:endfunction //expected end of line. Note: There are many bugs after this, but I think this first error is causing it. set ReturnCount = 0 constant function RagingCharge_DamagePerSecond takes real level returns real The set ReturnCount = 0 line is in an invalid place, and actually not needed at all. Just remove it. |
| 05-15-2006, 05:34 AM | #8 |
JASS:function RagingCharge_Damage takes integer level returns integer if (level==1) then return 75 elseif (level==2) then return 130 elseif (level==3) then return 200 elseif (level==4) then return 270 elseif (level==5) then return 340 elseif (level==6) then return 600 else return 0 endif endfunction |
| 05-15-2006, 11:32 AM | #9 |
This will work: JASS:function RagingCharge_Damage takes integer level returns real if (level==1) then return 75. elseif (level==2) then return 130. elseif (level==3) then return 200. elseif (level==4) then return 270. elseif (level==5) then return 340. elseif (level==6) then return 600. endif return 0. endfunction constant function RagingCharge_DamagePerSecond takes real level returns real return 0. endfunction function RagingCharge_ImpactRange takes real level returns real return 115.+10*level endfunction constant function RagingCharge_FrontAngle takes real level returns real return 179.0 endfunction |
