- Joined
- Mar 30, 2008
- Messages
- 7
ive been trying back and forth to understand all this jass madness, but ive got nothing figured out and a substantially painful headache, my tiger still doesnt jump and i hate her for it
method onDestroy takes nothing returns nothing
local real x
local real y
local rect r
if .r != 0.00 then
set x = GetUnitX(.u)
set y = GetUnitY(.u)
set r = Rect(x - .r, y - .r, x + .r, y + .r)
call EnumDestructablesInRect(r, Bool, function TreeKill)
call RemoveRect(r)
set r = null
endif
if .s != "" and .s != null then
call DestroyEffect(AddSpecialEffect(.s, x, y))
endif
call PauseUnit(.u, false)
endmethod
method onDestroy takes nothing returns nothing
local real x = GetUnitX(.u)
local real y = GetUnitY(.u)
local rect r
if .r != 0.00 then
set r = Rect(x - .r, y - .r, x + .r, y + .r)
call EnumDestructablesInRect(r, Bool, function TreeKill)
call RemoveRect(r)
set r = null
endif
if .s != "" and .s != null then
call DestroyEffect(AddSpecialEffect(.s, x, y))
endif
call PauseUnit(.u, false)
endmethod
call PauseUnit(.u, false)
call IssueImmediateOrder(.u, "stop")
set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),Dummy_Id,x,y,blablabla)
call IssueImmediateOrder(u,blabla)
call SetUnitPosition(GLOBAL_TREE_FILTER_UNIT,x,y)
call IssueImmediateOrder(GLOBAL_TREE_FILTER_UNIT,blablabla)
private function TreeFilter takes nothing returns boolean local destructable d = GetFilterDestructable()
local boolean i = IsDestructableInvulnerable(d)
local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID,GetWidgetX(d), GetWidgetY(d), 0)
local boolean result = false
call UnitAddAbility(u, 'Ahrl')
if i then
call SetDestructableInvulnerable(d, false)
endif
set result = IssueTargetOrder(u, "harvest", d)
call RemoveUnit(u)
if i then
call SetDestructableInvulnerable(d, true)
endif
set u = null
set d = null
return result
endfunction
globals
private unit DUMMY = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE)Dummy_Id, blablabla)
endglobals
private function TreeFilter takes nothing returns boolean local destructable d = GetFilterDestructable()
local boolean i = IsDestructableInvulnerable(d)
local boolean result = false
call SetUnitPosition(DUMMY,GetWidgetX(d),GetWidgetY(d))
call UnitAddAbility(DUMMY, 'Ahrl')
if i then
call SetDestructableInvulnerable(d, false)
endif
set result = IssueTargetOrder(DUMMY, "harvest", d)
if i then
call SetDestructableInvulnerable(d, true)
endif
set d = null
return result
endfunction
SetUnitPosition(Dummy,GetWidgetX(d),GetWidgetY(d))
call SetUnitPosition(blabla)
local unit u = CreateUnit(blabla)
, but you didnt removeset u = null[/code]
Those were 2 errors and the Trees didnt get killed,, somehow,,
Copy the dummy unit called caster (Caster System) from Vexorian's CasterSystem map. The id of the copied unit in your map will most probably be 'e000', but if it's not, you MUST change the DUMMY_ID constant integer (in the code above) to that unit's id.
The reason why I used this specific version of a dummy unit is because I want to make you start using it (if you already haven't), because it's really great. You can have a single dummy unit for casting, effects etc. For effects you can just attach an effect to its origin, then you can modify the size, the vertex and whatever else with just applying the changes for the unit! Having that unit really simplifies everything and you don't have to create a dummy unit for each moving special effect.
All you need to do to be able to modify everything is do the following sequence:
JASS:call UnitAddAbility(<caster>, 'Amrf') call UnitRemoveAbility(<caster>, 'Amrf') call UnitAddAbility(<caster>, 'Aloc') call SetUnitAnimationByIndex(<caster>, 90)
I see you create a unit every time the function is run, but I don't see it killed or removed.
so when you null the global Dummy variable, you've leaked a unit
Did you also fixed the unit not landing when a unit is below him? I also have a jump spell with the same problem and i don't know how to fix.