| 01-31-2006, 04:12 AM | #1 |
like it says, trying to draw a pentagram thing on screen it draws the outer circle, but nothin more JASS:local location target = GetSpellTargetLoc() local location m local location array point local unit u = GetTriggerUnit() local integer i = 0 local integer j = 1 local integer k = 3 local integer l = 0 local integer effects = 0 local real r = 0 local effect array e loop exitwhen i == 5 set point[i] = PolarProjectionBJ(target, 350, r) set r = r + 72 set i = i + 1 endloop set i = 0 set r = 0 loop exitwhen i == 60 set m = PolarProjectionBJ(target, 350, r) set e[effects] = AddSpecialEffectLoc( "Environment\\LargeBuildingFire\\LargeBuildingFire2.mdl", m ) set effects = effects + 1 call RemoveLocation(m) set r = r + 6 set i = i + 1 endloop set i = 0 set j = 1 set k = 3 loop exitwhen i==5 loop exitwhen l==25 set m = PolarProjectionBJ(point[j], ( DistanceBetweenPoints(point[j], point[k]) / ( 14 * l ) ), AngleBetweenPoints(point[j], point[k])) set e[effects] = AddSpecialEffectLoc( "Environment\\LargeBuildingFire\\LargeBuildingFire2.mdl", m ) set effects = effects + 1 call RemoveLocation(m) set l = l + 1 endloop set l = 0 set i = i + 1 set j = j + 1 if k==5 then set k = 1 else set k = k + 1 endif endloop edit: please put the [jass] tags yourself next time |
| 01-31-2006, 05:53 AM | #2 |
There's a spell somewhere in the submissions area that draws a pentagram. Just steal the code for that. :P |
| 01-31-2006, 11:37 AM | #3 |
You are leaking special effects. Code looks ok to me ;/ |
| 01-31-2006, 01:45 PM | #4 |
set m = PolarProjectionBJ(point[j], ( DistanceBetweenPoints(point[j], point[k]) / ( 14 * l ) ), AngleBetweenPoints(point[j], point[k])) wrong wrong wrong. First of all DistanceBetweenPoints(point[j], point[k]) , and AngleBetweenPoints(point[j], point[k]) are always the same during that loop, so you better use variables to save them, cause they are really slow functions actually. Second, let's say you are now using a d variable for the distance you would have ( d / ( 14 * l ) ) You are not making much sense I think that what you want to have there is (( d * l ) / 25.0 ) Or something like that, cause what you want to draw is a pentagram , right? The old one will draw something but will not draw a line correctly, it will probably draw all the effects very close to themselves and not fill the line (note the 25.0 instead of just 25 that prevents rounding in the division) |
| 01-31-2006, 02:20 PM | #5 | |
Quote:
I am aware of that, but that is only about half the code, jsut the part that draws the pentagram and Vex, I'll try out what you said and see what I can make of it TY a mil. Vex it worked! |
| 01-31-2006, 02:42 PM | #6 |
Use X,Y coords, then you can just use: JASS:// Get X Value For Polar Movement function PolarX takes real x, real offset, real angle returns real return x+offset*Cos(angle*bj_DEGTORAD) endfunction // Get Y Value For Polar Movement function PolarY takes real y, real offset, real angle returns real return y+offset*Sin(angle*bj_DEGTORAD) endfunction then you just go set nx=PolarX(x, offset, angle) Do this in a loop, making the reals arrays this will establish the 5 corner points JASS:loop exitwhen count > 5 set angle=count * (360 / 5) + 18 set xn[count]=PolarX(x, offset, angle) set yn[count]=PolarY(y, offset, angle) set count=count+1 endloop Then for your lines do your offset as JASS:set offset=offset + (350 / 25) * count |
| 01-31-2006, 05:14 PM | #7 |
No, using an extra function for the PolarProjection is stupid, just use Cos and Sin directly, it isn't hard to learn. |
| 01-31-2006, 08:33 PM | #8 |
I use that because I use the coords a lot, and I find it easier to have a seperate function rather than put it in every time. Plus it makes math a whole lot easier |
| 01-31-2006, 10:25 PM | #9 |
Better avoid using such dummy functions it's just bad habit, using Cos and Sin directly is just as easy as soon as you gets used to it. |
| 02-01-2006, 03:37 AM | #10 |
You may say that, I beg to differ since everything we have been taught in the programming courses I'm in say that avoiding redudant lines of code is good |
| 02-01-2006, 10:53 AM | #11 |
As long as you are using a serious language like C++ or even JAVA, the thing is that JASS is way too slow and an extra function call is really charging, much worse if you do anything twice like converting an angle to radians. And yes the rule still is good for JASS but for big functions. When a function takes one line and does something as simple af those multiplications it is more harmful to use it. If it was a function one line long but did stuff like using gamecache + return bug exploitters then it would be harmful to not use it. That would harm your code's reliability and readability. |
| 02-01-2006, 02:24 PM | #12 |
Just how slow is JASS compared to a real language? |
| 02-02-2006, 03:56 AM | #13 |
Slow enough that 'cycle counting' is worth it. Think vacuum tube-based computers. |
