HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

JASS help

03-14-2006, 05:42 PM#1
Thunder_Eye
Hi there all JASS guru's I have a question, will this trigger work as I want?
And is there anything I can improve?
(1000.00 is the speed of the projectile on the spell)

EDIT: Oh sry posted in the wrong forum :/ had them both opened and didnt notice which one I posted in, can some mod move it?
Collapse JASS:
function Icebolt takes unit caster, unit target, real duration, real slowprecent returns nothing
   local real x1 = GetUnitX(caster)
   local real x2 = GetUnitX(target)
   local real y1 = GetUnitY(caster)
   local real y2 = GetUnitY(target)
   local real dist = SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
   call TriggerSleepAction( ( dist / 1000.00 ) )
   call SetUnitMoveSpeed( target, slowprecent )
   call TriggerSleepAction(duration)//5.00
   call SetUnitMoveSpeed( target, GetUnitDefaultMoveSpeed(target) )
   set caster = null
   set target = null
endfunction
03-14-2006, 07:02 PM#2
emjlr3
looks fine to me have u tried?
03-14-2006, 07:11 PM#3
Tim.
Moved.
03-14-2006, 08:08 PM#4
Thunder_Eye
Thank you.

No, but I'm unsure of the "Squareroot" thing, also about the x,y reals instead of a location? Is it really faster? Cause I think I call more functions when I use reals instead of location, so the only good thing I can think of with reals is that they dont leak.

And is there anything I can improve? I've changed all the non-natives to natives.
03-16-2006, 11:52 AM#5
Thunder_Eye
*bump
03-16-2006, 12:14 PM#6
Captain Griffen
Locations are faster, BUT you have to destroy them, which makes co-ordinates more efficient overall.
03-16-2006, 07:23 PM#7
Thunder_Eye
Ok onto another question, If I pass over a location to another function, I have to destroy it in both functions right?
03-16-2006, 09:03 PM#8
emjlr3
yes
03-16-2006, 09:07 PM#9
Blade.dk
No. It is the same object in both functions.

Take this as an example:

I buy some food in the supermarket. It is covered in plastic. I eat some of the food, and gives it to you. You eat the rest, but only one of us can throw out the plastic it was wrapped in, it is the same here.
03-16-2006, 09:13 PM#10
emjlr3
o, then no, ;)
03-17-2006, 09:04 PM#11
Thunder_Eye
So if I destroy a location in a called function, I wont be able to use it in the main function after the call?
03-24-2006, 09:33 PM#12
Thunder_Eye
*bump
03-24-2006, 10:02 PM#13
Blade.dk
Of course not, it is the same object as said already.