| 10-22-2006, 05:04 AM | #1 | |
ok, i'm doing some experiment on the Tables in CSCache, so i try on a trigger like below, all it does is blink the shadow strike caster to the target after shadow strike has been casted. I can't run the blinking instantly after the spell is casted (not even with "unit start effect of") as it will result in no mana/cooldown is used my question here is simple, the trigger below work perfectly, but did i clean the memory leaks correctly? because i'm not sure is this the right way to clean the leaks in tables JASS:function Trig_shadow_strike_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A005' endfunction function ShadowStrikeMove takes nothing returns nothing local unit u = GetTableUnit("shadowstrike","caster") local unit c = GetTableUnit("shadowstrike","target") local location x = GetUnitLoc(c) call DestroyTimer(GetExpiredTimer()) call DestroyTable("shadowstrike") call SetUnitPositionLoc(u,x) call IssueTargetOrder(u,"attack",c) set u=null set c=null set x=null endfunction function Trig_shadow_strike_Actions takes nothing returns nothing local unit u = GetSpellAbilityUnit() local unit c = GetSpellTargetUnit() call SetTableObject("shadowstrike","caster",u) call SetTableObject("shadowstrike","target",c) call TimerStart(CreateTimer(),0,false,function ShadowStrikeMove) set u=null set c=null endfunction //=========================================================================== function InitTrig_mistress_spells takes nothing returns nothing local trigger t = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( t, Condition( function Trig_shadow_strike_Conditions ) ) call TriggerAddAction( t, function Trig_shadow_strike_Actions ) set t=null endfunction === btw vex, in your caster system's tutorial about CSCache Module, there is this line : Quote:
call AttachObject( GetSummonedUnit() , "master", GetSummonnedUnit() ) is rather confusing @@ or does it mean this ? (errr typo?) call AttachObject( GetSummoningUnit() , "master", GetSummonnedUnit() ) |
| 10-22-2006, 05:08 AM | #2 |
yes and yes |
| 10-22-2006, 05:25 AM | #3 |
wow, thanks for super fast replies O_o now i can do lots more with the table :) |
| 11-05-2006, 05:46 PM | #4 |
Tables are terrible outdated but it is easier to understand and easier for beginners. Consider using DynamicArrays or something Edit: Took me about 5 minutes to realize it was a Blink Strike :D |
