• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Trigger spell problem

Status
Not open for further replies.
Level 7
Joined
Mar 12, 2006
Messages
407
Okey what i'm trying to do is triggering the Polymorph ability to have an AOE morph efect. Its quite simple, I know but it won't work :shock:

Here's my skript:

function Trig_masssheep_Kopieren_Kopieren_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00I' ) ) then
return false
endif
return true
endfunction

function Trig_masssheep_Kopieren_Kopieren_Func003A takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'h006', GetOwningPlayer(GetSpellAbilityUnit()), udg_v_punkt, bj_UNIT_FACING )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_v_group )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "polymorph", GetEnumUnit() )
endfunction

function Trig_masssheep_Kopieren_Kopieren_Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_masssheep_Kopieren_Kopieren_Actions takes nothing returns nothing
set udg_v_punkt = GetUnitLoc(GetSpellAbilityUnit())
set bj_wantDestroyGroup = true
call ForGroupBJ( GetUnitsInRangeOfLocAll(250.00, GetSpellTargetLoc()), function Trig_masssheep_Kopieren_Kopieren_Func003A )
call RemoveLocation( udg_v_punkt )
call ForGroupBJ( udg_v_group, function Trig_masssheep_Kopieren_Kopieren_Func005002 )
call DestroyGroup( udg_v_group )
endfunction

//===========================================================================
function InitTrig_masssheep_Kopieren_Kopieren takes nothing returns nothing
set gg_trg_masssheep_Kopieren_Kopieren = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_masssheep_Kopieren_Kopieren, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_masssheep_Kopieren_Kopieren, Condition( function Trig_masssheep_Kopieren_Kopieren_Conditions ) )
call TriggerAddAction( gg_trg_masssheep_Kopieren_Kopieren, function Trig_masssheep_Kopieren_Kopieren_Actions )
endfunction

What happens is:
The units in the target area get the special efects of polymorphs (sparks and so on, dont know what it is ^^) but they don't morph into sheeps.
I used a dummy which has the standart morph ability i just reduced mana cost and cooldown to zero and disabled the checking of tech requirements.
And the dummies aren't removed from game after they casted.

So my spell is pretty fucked up. It doesnt morph and it creates dummies which stay -.-


Anyone knows why ?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
apoc, dont use GUI conversions to mimic JASS

instead of ForGroup, use a loop that checks when the group is empty as an exitwhen

JASS:
local group g = CreateGroup()
local unit u

call GroupEnumUnitsInRange( g, whereX, whereY, null )

loop
set u = FirstOfGroup( g )
exitwhen u == null
//your actions here
endloop
 
Status
Not open for further replies.
Top