HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Smoke Bomb Code Problem

10-26-2006, 02:20 PM#1
TGhost
Ok, so im trying to make this ability, but JassCraft finds some errors with my code, that i cant find myself... Any help would be greatly appreciated
Collapse JASS:
function Trig_Smoke_Bomb_Cast_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A002'
endfunction

function Group_Filter takes nothing return boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))
endfunction

function Trig_Smoke_Bomb_Cast_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local real targetX = GetLocationX(GetSpellTargetLoc())
    local real targetY = GetLocationY(GetSpellTargetLoc())
    local unit dummy = CreateUnit(GetOwningPlayer(caster), 'e001', targetX, targetY, 90)
    local boolexpr filter = Condition(function Group_Filter)
    local group targetUnits = GroupEnumUnitsInRange(targetUnits, targetX, targetY, 250, filter)
    local unit currentTarget
    call DestroyBoolExpr(filter)
    call UnitAddAbility(dummy, 'A006')
    call UnitApplyTimedLife(dummy, 'BTLF', 2)
    call IssueImmediateOrder(dummy, "stomp")
    loop
        set currentTarget = FirstOfGroup(targetUnits)
        exitwhen currentTarget == null
        call GroupRemoveUnit(targetUnits, currentTarget)
        set dummy = CreateUnit(GetOwningPlayer(caster), 'e001', targetX, targetY, 90)
        call UnitAddAbility(dummy, 'A007')
        call UnitApplyTimedLife(dummy, 'BTLF', 2)
        call IssueTargetOrder(dummy, "curse", currentTarget) 
    endloop
    set dummy = null
    set caster = null
    call DestroyGroup(targetUnits)
    set targetUnits = null    
endfunction

//===========================================================================
function InitTrig_Smoke_Bomb_Cast takes nothing returns nothing
    set gg_trg_Smoke_Bomb_Cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Smoke_Bomb_Cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Smoke_Bomb_Cast, Condition( function Trig_Smoke_Bomb_Cast_Conditions ) )
    call TriggerAddAction( gg_trg_Smoke_Bomb_Cast, function Trig_Smoke_Bomb_Cast_Actions )
endfunction
10-26-2006, 02:49 PM#2
Chuckle_Brother
Collapse JASS:
local group targetUnits = GroupEnumUnitsInRange(targetUnits, targetX, targetY, 250, filter)

GroupEnumUnitsInRange doesn't have a return type.

use:

Collapse JASS:
local group targetunits = CreateGroup()

THEN do your enumeration.
10-26-2006, 02:54 PM#3
TGhost
I still get a ton of errors from line 5 and 7.

EDIT: Looked through line 5 numerous times now, found out that i had typed "return" instead of "returns". Now i don't get any errors, but the spell is not actually working... It doesn't find any units or anything...

EDIT2: Found a problem myself, thanks alot Chuckle for your pointing out (Rep given), the spell is working as intended now.