| 10-24-2006, 09:30 PM | #1 |
I made this, and wondered if it would be classed as a system. It (should) work out the time taken for a projectile to reach a unit from an attacking unit. JASS:function angle takes real x, real y, real ux, real uy returns real return Atan(((ux-x)/(uy-y))) endfunction function distance takes real x, real y, real ux, real uy returns real local real y_distance local real x_distance local real distance set y_distance = (uy-y) set x_distance = (ux-x) set distance = SquareRoot((Pow(y_distance,2) + Pow(x_distance,2))) return distance endfunction function projectile_speed takes nothing returns real //set the projectile speed of your unit here return 900.00 endfunction function projectile_time takes unit u, unit p returns real local real x = GetUnitX(u) local real y = GetUnitY(u) local real ux = GetUnitX(p) local real uy = GetUnitY(p) local real dist = distance(x,y,ux,uy) local real speed = 900 local real time set time = dist/speed return time endfunction |
| 10-24-2006, 09:46 PM | #2 |
No, they aren't. They are just functions. On their own, they don't actually do anything. Just like BJs, really. |
| 10-24-2006, 09:48 PM | #3 |
Wats the difference between these and a system then, what exactly does a system do? (Btw, if anyone now wants to use this code, feel free...though Vex has made a better version i believe) |
| 10-24-2006, 10:12 PM | #4 |
A system in this case would be shared code used by more than one spell. Most systems are put in the custom script section, but with preprocessors its possible to put them in a seperate trigger without having to handle WE's trigger compile order. |
| 10-24-2006, 10:29 PM | #5 |
Shadow, that includes way too much. By that definition, using any BJ is using a system. |
| 10-25-2006, 09:32 AM | #6 |
Given theirs no getProjectileSpeedofUnit() trigger i doubt this can ever be a system then :( |
| 10-25-2006, 10:18 AM | #7 |
Systems are nothing more than just a premade set of functions to do something and is easy to customize. Like a camera system, it is a system where u can control cameras by only setting values but don't care on how the core of the system works. |
| 10-25-2006, 11:07 AM | #8 |
So will I be able to use those functions in the hero competition or not? |
| 10-25-2006, 11:47 AM | #9 |
well i believe in hero competition its just about hero, but i don't think you will win cus these functions will not allow many heroes |
| 10-25-2006, 12:30 PM | #10 |
these functions are all used for synchronising fx...so whats the problem with using them...and why wouldn't they help me win? |
| 10-25-2006, 12:36 PM | #11 |
They aren't a system, they are just for calculating stuff, just like the maths functions in blizzard.j. |
| 10-25-2006, 01:04 PM | #12 |
It is a system in the mean that they are extra functions ... the idea is that someone wouldn't need to copy more code than an storage, common, system and the spell's trigger. You can just add a preffix to the functions for the spell. Let's say that your spell is called burning illusions: JASS:function BurningIllusions_projectile_speed takes nothing returns real //set the projectile speed of your unit here return 900.00 endfunction function BurningIllusions_projectile_time takes unit u, unit p returns real Then include those in BurningIllusion's trigger. I'd like to point out that atan is completelly unnecessary, The Atan2 native does exactly the same + it has protection against zero division . distance is useless as well, you can Use DistanceBetweenPoints or, if you really don't want locations you can use the formula directly, it doesn't really need more than one line. SquareRoot((Pow(x2-x1,2) + Pow(y2-y1,2)) Then there's the issue with projectile, it is not like all your spells will use the same projectile speed, as a matter of fact if 2 of your spells use projectiles then they are probably going to be too similar to be in the same hero. |
| 10-25-2006, 05:40 PM | #13 |
Thanks for the info vex, now i can finish off my hero :). |
