| 03-16-2007, 06:32 AM | #1 |
Having a little problem with this trigger. JASS:function Tree_Conditions takes nothing returns boolean return (GetSpellAbilityId() == 'A00N') endfunction function Tree_Actions takes nothing returns nothing local location loc = GetSpellTargetLoc() local real x = GetLocationX(loc) local real y = GetLocationY(loc) local destructable array tree local integer i = 0 loop exitwhen i == 16 call CreateDeadDestructable('B000',x+GetRandomReal(-800,800),y+GetRandomReal(-800,800),GetRandomDirectionDeg(),1,GetRandomInt(1,3)) set tree[i] = bj_lastCreatedDestructable call DestructableRestoreLife(tree[i],50,true) set i = i+1 set bj_lastCreatedUnit = null endloop set i = 0 call TriggerSleepAction(5) loop exitwhen i == 16 call TriggerSleepAction(GetRandomReal(0,4)) call KillDestructable(tree[i]) set i = i+1 endloop set i = 0 loop exitwhen i == 16 set tree[i]= null set i = i+1 endloop set loc = null endfunction //=========================================================================== function InitTrig_Tree takes nothing returns nothing set gg_trg_Tree = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Tree, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Tree, Condition( function Tree_Conditions ) ) call TriggerAddAction( gg_trg_Tree, function Tree_Actions ) endfunction It will create the dead destructables, but simply will not resurrect them. Any suggestions, or notes on where I am making a mistake or false assumption? The intent is to create a number of tree stumps then cause them to grow up right away...eventually dying after a small random interval. -Fluxx Edit: Problem solved, revised code below. JASS:function Tree_Conditions takes nothing returns boolean return (GetSpellAbilityId() == 'A00N') endfunction function Tree_Actions takes nothing returns nothing local location loc = GetSpellTargetLoc() local real x = GetLocationX(loc) local real y = GetLocationY(loc) local real array xx local real array yy local destructable array tree local integer i = 0 loop exitwhen i == 22 set tree[i] = CreateDestructable('ATtr',x+GetRandomReal(-400,400),y+GetRandomReal(-400,400), GetRandomReal(0, 360), 1,GetRandomInt(1,3)) call SetDestructableAnimation(tree[i], "birth") set xx[i] = GetDestructableX(tree[i]) set yy[i] = GetDestructableY(tree[i]) call DestroyEffect(AddSpecialEffect("Units\\NightElf\\Wisp\\WispExplode.mdl",xx[i],yy[i])) set i = i+1 endloop set i = 0 call TriggerSleepAction(6) loop exitwhen i == 22 call TriggerSleepAction(GetRandomReal(0,3)) call KillDestructable(tree[i]) set i = i+1 endloop call TriggerSleepAction(3) set i = 0 loop exitwhen i == 22 call RemoveDestructable(tree[i]) call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl",xx[i],yy[i])) set tree[i] = null set i = i+1 endloop call RemoveLocation(loc) set loc = null endfunction //=========================================================================== function InitTrig_Tree takes nothing returns nothing set gg_trg_Tree = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Tree, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Tree, Condition( function Tree_Conditions ) ) call TriggerAddAction( gg_trg_Tree, function Tree_Actions ) endfunction |
| 03-18-2007, 01:49 AM | #2 |
this is how I have a regrow tree's thing set up on my map if it helps ya at all... Trigger: |
