- Joined
- Oct 11, 2012
- Messages
- 711
Hi all. What does "instance" mean in vJass? I have seen a lot of tutorials talking about it but I cannot get a clear meaning of it.
Also, under what circumstances do I need to destroy the instance (set it to 0 or something) or to use the destroy method in order to free the memory usage?
Does the following spell need to use the destroy thing?
Edit:
One last question, how to use "extends array"? In vJass manual, it stats that if the struct has no method then use "extends array". But in Mag's struct example, he uses "extends array" while having methods in the struct. This really confuses me... Thanks guys.
Also, under what circumstances do I need to destroy the instance (set it to 0 or something) or to use the destroy method in order to free the memory usage?
Does the following spell need to use the destroy thing?
JASS:
struct JRXFeng extends array
private static method run takes nothing returns boolean
local unit caster = GetTriggerUnit()
local unit dummy
local real x=GetSpellTargetX()
local real y=GetSpellTargetY()
local integer level=GetUnitAbilityLevel(caster,'A0LP')
if GetSpellAbilityId()=='A0LP' then
set dummy=CreateUnit(GetOwningPlayer(caster),'n024',x,y,bj_UNIT_FACING)
call UnitAddAbility(dummy,'A0LQ')
call SetUnitAbilityLevel(dummy,'A0LQ',level)
call UnitApplyTimedLife(dummy,'BHwe',22.)
call IssuePointOrder(dummy,"stampede",x,y)
endif
set caster = null
set dummy = null
return false
endmethod
private static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function thistype.run))
set t = null
endmethod
endstruct
Edit:
One last question, how to use "extends array"? In vJass manual, it stats that if the struct has no method then use "extends array". But in Mag's struct example, he uses "extends array" while having methods in the struct. This really confuses me... Thanks guys.