| 01-22-2006, 05:24 PM | #2 |
clean the leaks. use 2 variables, tempPoint (point) ,tempPoint2 (point) and tempGroup (UnitGroup) then in the beginning of the trigger make Set tempPoint = ((Position of BattleSlam_Caster) offset by 100.00 towards **.** degrees) Set tempPoint2 = ((Position of (Last created unit)) offset by 100.00 towards **.** degrees) Set tempGroup = (Units owned by (Owner of BattleSlam_Caster) of type BattleSlam_Dummy) and in the end add Custom Script: call RemoveLocation(udg_tempPoint) Custom Script: call RemoveLocation(udg_tempPoint2) and, Unit Group - Clear tempGroup |
| 01-22-2006, 05:33 PM | #3 |
Hm, do i need to use "temp" in a var to make it actually work in custom script? Or can i put any name for the var? So what u said above is asking me to do a loop? |
| 01-22-2006, 05:34 PM | #4 |
I don't think that alone is going to do it....I've had loads of lag issues when ordering dummies to cast shockwaves, even with just a single unit sometimes. Anyway the best thing you can do is remove leaks and maybe try some preloading of the abilities and such. |
| 01-22-2006, 05:35 PM | #5 |
you can use any name, using temp just reminds you that it is a temporary variable |
| 01-22-2006, 05:40 PM | #6 | ||
Quote:
Quote:
|
| 01-22-2006, 05:44 PM | #7 |
Anywhere where you create a point, like (Position of Unit) for example. It creates a object at the position and then uses it, If you dont attach it to a variable and destroy it it will get lost and cause "memory leak" the things that you have to worry most about is: Points Unit Groups Player Groups dont remember if there were anymore |
| 01-22-2006, 05:50 PM | #8 |
JASS:function BattleSlam takes nothing returns nothing local unit u = GetTriggerUnit() local location l = GetUnitLoc(u) local location t local player p = GetOwningPlayer(u) local real x = GetLocationX(l) local real y = GetLocationY(l) local real r = 0.0 loop exitwhen r > 288 set u = CreateUnit( p, DummyUnitId, x, y, angle ) set t = Location(x + 150.00 * Cos(r * bj_DEGTORAD), y + 150.00 * Sin(r * bj_DEGTORAD)) call IssuePointOrderLoc( u, "shockwave", t ) call TriggerSleepAction(0) call UnitApplyTimedLife( u, 'Bhwd', 3.00 ) call RemoveLocation(t) set r = r + 72.0 endloop set u = null call RemoveLocation(l) set l = null set t = null endfunction JASS:function BattleSlam_Conditions takes nothing returns boolean return ( GetSpellAbilityId() == BattleSlamSpellId ) endfunction function BattleSlamInit takes unit u returns nothing //u is the specific hero that is going to use this spell local trigger t = CreateTrigger( ) call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_SPELL_CAST ) call TriggerAddCondition( t, Condition( function BattleSlam_Conditions ) ) call TriggerAddAction( t, function BattleSlam ) call UnitAddAbility(u, BattleSlamSpellId) //Preload Spell call UnitRemoveAbility(u, BattleSlamSpellId) set t = null endfunction - You can literally copy-paste this entire thing inside, but I urge you to understand it first. - Create a new trigger, Edit --> Convert to Custom Text (easier to manage rather than placing it in the main custom script area) - Figure out your preferred method of passing in unit u into the initialisation function. - This method solves the memory leaks and duplication of effort. There are many ways to build this spell, and this is my preferred method. - The initialisation deals with first cast lag. - The use of natives as far as possible reduces resource usage, however marginal. |
