HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Custom Shackles cause a crash

02-26-2008, 09:28 PM#1
Castlemaster
I'm trying to make a puzzle that involves breeding sheep. I've made it so that the sheep have a modified shackle that they cast, and once it's done it produces a new sheep. But for some reason, when the sheep have shackle cast upon them, the game crashes. Any ideas why it crashes?
02-27-2008, 04:40 AM#2
Pyrogasm
"Shackles" as in Aerial Shackles?
02-27-2008, 04:15 PM#3
DioD
Code to thread.

I sure this caused by overloop, cast trigger evented on cast...
02-27-2008, 05:40 PM#4
Castlemaster
This is the full trigger
Collapse JASS:
function BreedFilter takes nothing returns boolean
    return GetUnitTypeId(GetFilterUnit()) == 'n000'
endfunction

function Trig_Sheep_Respawn_and_Breed_Actions takes nothing returns nothing
    local real array x
    local real y = -2165
    local group g = CreateGroup()
    local group sheep = CreateGroup()
    local unit u
    local integer i
    set x[1] = 2238
    set x[2] = 3316
    set u = CreateUnit(Player(1),'n000',x[1],y,270)
    call IssuePointOrder(u,"smart",GetRandomReal(2238,3316),GetRandomReal(-2741,-2165))
    set u = CreateUnit(Player(1),'n000',x[2],y,270)
    call IssuePointOrder(u,"smart",GetRandomReal(2238,3316),GetRandomReal(-2741,-2165))
    call GroupEnumUnitsInRange(g,x[1],y,2000,Condition(function BreedFilter))
    call GroupEnumUnitsInRange(sheep,x[1],y,2000,Condition(function BreedFilter))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call IssueTargetOrder(u,"magicleash",GroupPickRandomUnit(sheep))
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    call DestroyGroup(sheep)
    set g = null
    set sheep = null
    set u = null
endfunction

//===========================================================================
function InitTrig_Sheep_Respawn_and_Breed takes nothing returns nothing
    set gg_trg_Sheep_Respawn_and_Breed = CreateTrigger(  )
    call DisableTrigger( gg_trg_Sheep_Respawn_and_Breed )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Sheep_Respawn_and_Breed, 4 )
    call TriggerAddAction( gg_trg_Sheep_Respawn_and_Breed, function Trig_Sheep_Respawn_and_Breed_Actions )
endfunction

Although this is the area that gives the command
Collapse JASS:
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call IssueTargetOrder(u,"magicleash",GroupPickRandomUnit(sheep))
        call GroupRemoveUnit(g,u)
    endloop
I also have a trigger that activates after said spell is cast.

Collapse JASS:
function Trig_Breed_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A006' 
endfunction

function Trig_Breed_Actions takes nothing returns nothing
    local real x = GetUnitX(GetTriggerUnit())
    local real y = GetUnitY(GetTriggerUnit())
    call CreateUnit(Player(1),'n000',x,y,270)
endfunction

//===========================================================================
function InitTrig_Breed takes nothing returns nothing
    set gg_trg_Breed = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Breed, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( gg_trg_Breed, Condition( function Trig_Breed_Conditions ) )
    call TriggerAddAction( gg_trg_Breed, function Trig_Breed_Actions )
endfunction

I guess this needs to move to GUI/JASS page now...
02-28-2008, 06:22 AM#5
Pyrogasm
And moved it is!