| 03-12-2008, 08:16 PM | #1 |
I have this spell JASS:function Trig_Annihilator_Dragon_Nexus_freeze_Actions takes nothing returns nothing local group g=GetUnitsOfTypeIdAll('h00E') local unit u local unit d local group g2 local unit u2 local player p=Player(0) loop set u = FirstOfGroup(g) exitwhen u==null set g2=CreateGroup() call GroupEnumUnitsInRange(g2,GetUnitX(u),GetUnitY(u),400,null) loop set u2 = FirstOfGroup(g2) exitwhen u2==null if GetUnitAbilityLevel(u2,'B00L')==0 then set d=CreateUnit(p,'h002',GetUnitX(u2),GetUnitY(u2),270.) call UnitAddAbility(d,'A03N') call IssueTargetOrder(d,"thunderbolt",u2) call UnitApplyTimedLife(d,'B000',0.40) endif call GroupRemoveUnit(g2,u2) endloop call DestroyGroup(g2) call GroupRemoveUnit(g,u) endloop call DestroyGroup(g) set g=null set g2=null set u=null set u2=null set d=null set p=null endfunction Thanks in advance, rep is awaiting PS: 'B00L' is the buff the thunderbolt gives. Just to prevent useless double casts. |
| 03-13-2008, 02:56 AM | #2 |
It could just be that the sheer amount of groups you create is too much for the game to handle... I'd do this instead: JASS:function Trig_Annihilator_Dragon_Nexus_freeze_Actions takes nothing returns nothing local group g=GetUnitsOfTypeIdAll('h00E') local unit u local unit d local group g2 = CreateGroup() //Initialized as CreateGroup() local unit u2 local player p=Player(0) loop set u = FirstOfGroup(g) exitwhen u==null //No setting of g2 call GroupEnumUnitsInRange(g2,GetUnitX(u),GetUnitY(u),400,null) loop set u2 = FirstOfGroup(g2) exitwhen u2==null if GetUnitAbilityLevel(u2,'B00L')==0 then set d=CreateUnit(p,'h002',GetUnitX(u2),GetUnitY(u2),270.) call UnitAddAbility(d,'A03N') call IssueTargetOrder(d,"thunderbolt",u2) call UnitApplyTimedLife(d,'B000',0.40) endif call GroupRemoveUnit(g2,u2) endloop //No destroying; the group will be clear also call GroupRemoveUnit(g,u) endloop call DestroyGroup(g) set g=null set g2=null set u=null set u2=null set d=null set p=null endfunction |
| 03-13-2008, 08:59 AM | #3 |
You forgot to put call DestroyGroup(g2) in the end, though. The best way to do this would be to simply have two groups in global variables and keep reusing them, without ever destroying them or creating new ones. With vJass, declaring new globals is a piece of cake so this has changed the way we code things considerably. |
| 03-17-2008, 06:42 PM | #4 |
Thanks you both But the problem still lasts - this triger makes the game freeze. While it is disabled, everything is alright. |
| 03-17-2008, 10:21 PM | #5 |
Maybe something is wrong with the spell (thunderbolt)? What's 'B000'? Other than that, I see no reason for the game to freeze, it would take a lot more than group leaks to freeze the game. |
| 03-17-2008, 10:44 PM | #6 |
What calls the function? Maybe ordering the dummy caster to cast the spell is making the trigger run again. |
| 03-18-2008, 03:21 PM | #7 |
B00L is a modified Stunned buff the modified thunderbold gives. Here is whole code of the trigger as I have it now: JASS:function Trig_Annihilator_Dragon_Nexus_freeze_Actions takes nothing returns nothing local group g=GetUnitsOfTypeIdAll('h00E') local unit u local unit d local group g2=CreateGroup() local unit u2 local player p=Player(0) loop set u = FirstOfGroup(g) exitwhen u==null call GroupEnumUnitsInRange(g2,GetUnitX(u),GetUnitY(u),400,null) loop set u2 = FirstOfGroup(g2) exitwhen u2==null if GetUnitAbilityLevel(u2,'B00L')==0 then set d=CreateUnit(p,'h002',GetUnitX(u2),GetUnitY(u2),270.) call UnitAddAbility(d,'A03N') call IssueTargetOrder(d,"thunderbolt",u2) call UnitApplyTimedLife(d,'B000',0.40) endif call GroupRemoveUnit(g2,u2) endloop call GroupRemoveUnit(g,u) endloop call DestroyGroup(g) call DestroyGroup(g2) set g=null set g2=null set u=null set u2=null set d=null set p=null endfunction //=========================================================================== function InitTrig_Annihilator_Dragon_Nexus_freeze takes nothing returns nothing set gg_trg_Annihilator_Dragon_Nexus_freeze = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Annihilator_Dragon_Nexus_freeze, 1.00 ) call TriggerAddAction( gg_trg_Annihilator_Dragon_Nexus_freeze, function Trig_Annihilator_Dragon_Nexus_freeze_Actions ) endfunction |
| 03-18-2008, 04:00 PM | #8 |
hmm maybe it's this line JASS:call UnitApplyTimedLife(d,'B000',0.40) JASS:'BTLF' JASS:'B000'Your trigger fires every 1 second, and creates a lot of dummies. Maybe you actually dont remove the dummies from the game with 'B000'. try using 'BTLF' |
| 03-18-2008, 05:13 PM | #9 |
What is BTLF? It is not in the object editor. My B000 is just modified Summoned unit ith removed vis effect. BTW, I tried the BTLF and it was still the same. |
| 03-18-2008, 05:15 PM | #10 |
BTLF is the generic expiration timer. |
| 03-19-2008, 02:47 PM | #11 | ||
Question: Quote:
Answer: Quote:
Do you see a flaw in your answer? :) |
