| 01-22-2007, 02:37 AM | #1 |
If I've got a local point local location P, to clean leaks with it do I have to remove the point with call RemoveLocation( P ) and then set it to null? Or do I just have to do one or the other? Is multiplying an angle by -1 the same as subtracting 180 to the angle? Adding 180 to the angle? I don't think it should be, I've seen it used as if it would. How would I go about making a movement speed display command where a player types a string and the game will display the movement speed of their hero? I was thinking of using custom values and then just changing it based on when units pick up/drop items, but is there a JASS command for such a thing? |
| 01-22-2007, 02:53 AM | #2 |
- 90º = 270º - 180º = 180º - 30º = 330º |
| 01-22-2007, 03:00 AM | #3 | |
Quote:
48º - 180º = -132º, but does warcraft read it that way? 48º x -1 = -48º, which is actually 312º, but is that how it's computed in WC3? |
| 01-22-2007, 03:14 AM | #4 |
-angle = 360º-angle 180º has nothing to do with it |
| 01-22-2007, 03:17 AM | #5 |
yeah a negative angle or an angle above 360 will still work.. like 450º = 90º or.. -100º = 260º |
| 01-22-2007, 03:23 AM | #6 |
Well, that answers my question then. +Rep to you both. My other two questions remain unanswered, however... EDIT... apparently I can't rep Vex yet... after I find someone else to rep I'll be back for you ![]() |
| 01-22-2007, 03:36 AM | #7 |
oh, for you first question, on removing points, im no genius on the subject but im pretty sure you just remove the point, you dont have to set P to null, but i could be wrong. and for the movespeed trigger... |
| 01-22-2007, 04:37 AM | #8 |
you must remove location AND set it to null |
| 01-22-2007, 05:03 AM | #9 |
The way I understand it, if it's local and extends a handle, you'll want to remove it and set it to null to avoid a leak. So yeah, with a local location, you'll want to nullify the local variable even after destroying the location. With globals, though, I believe I've read that nullifying them isn't necessary if you set them to different values frequently; however, that still leaves the destroying part necessary. |
| 01-22-2007, 05:16 AM | #10 |
JASS:function LocationLeekPrevention takes nothing returns nothing local location l = Location(0,0) call RemoveLocation(l) set l = null endfunction JASS:constant function MSTrigger_MessageTripper takes nothing returns string return "-ms" endfunction constant function MSTrigger_MessageDuration takes nothing returns real return 4.0 endfunction //****************************************************************************** //****************************************************************************** function MSTrigger_Actions takes nothing returns nothing local player p = GetTriggerPlayer() local unit u = GetPlayerHeroHoweverYouDoIt() call DisplayTimedTextToPlayer(p, 0, 0, MSTrigger_MessageDuration(), "Current Movement Speed: "+R2S(GetUnitMoveSpeed(u))) set u = null endfunction function InitTrig_MSTrigger takes nothing returns nothing set gg_trg_MSTrigger = CreateTrigger() call TriggerRegisterPlayerChatEvent(gg_trg_MSTrigger, GetLocalPlayer(), MSTrigger_MessageTripper(), true) call TriggerAddAction(gg_trg_MSTrigger, function MSTrigger_Actions) endfunction Of course, you could do the GUI way if you really wanted to. :P |
| 01-22-2007, 07:20 PM | #11 |
I store each player's selected hero in an array, that way I always have access to the hero without creating leaks or extra function calls. |
| 01-22-2007, 08:10 PM | #12 |
If you do it that way (Which is probably the easiest way), then replace the... JASS:local unit u = GetPlayerHeroHoweverYouDoIt() ...with... JASS:local unit u = udg_Hero[GetPlayerId(p)] |
| 01-22-2007, 08:23 PM | #13 |
Ya, that's almost exactly how I do it :P |
| 01-22-2007, 11:54 PM | #14 |
Well, that answers them all then. All who I have the ability to rep were rep'd. I really didn't know there was a "Unit - Movespeed of (Unit)" thing. Silly me ![]() |
