What's Wrong with this =/

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

AsdGod
Member
Posts: 50
Joined: February 27th, 2007, 11:17 pm

What's Wrong with this =/

Post by AsdGod »

Code: Select all

function Trig_NUKE_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetSummonedUnit()) == 'e007' ) ) then
        return false
    endif
    return true
endfunction


function GetNukeGameCache takes nothing returns gamecache
    return gg_trg_Nuke
    return null
endfunction

function StoreNukeGameCache takes nothing returns trigger
    return bj_lastCreatedGameCache
    return null
endfunction

function TimedSFX_Child takes nothing returns nothing
    local effect tempeffect
    set tempeffect = bj_lastCreatedEffect

    call PolledWait(14.00)
    call DestroyEffect(tempeffect)

    set tempeffect = null
endfunction

function TimedSFX takes location Loc, string Effect, real duration returns nothing
    local trigger TimedSFXTrigger = CreateTrigger()
    call AddSpecialEffectLocBJ( Loc, Effect )
    call TriggerAddAction(TimedSFXTrigger,function TimedSFX_Child)
    call TriggerExecute(TimedSFXTrigger)
    call DestroyTrigger(TimedSFXTrigger)

    set TimedSFXTrigger = null
endfunction

function TimedBlight takes nothing returns nothing
    local location Center
    set Center = Location(GetStoredReal(GetNukeGameCache(), "Nuke", "LocationX" ), GetStoredReal(GetNukeGameCache(), "Nuke", "LocationY" ))
    call PolledWait(16.00)
    call SetBlightLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), Center, 512.00, false )
    call RemoveLocation(Center)
    set Center = null
endfunction

function NukeDamage takes nothing returns nothing
     call UnitDamageTargetBJ( GetSummonedUnit(),GetEnumUnit(), 200.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
endfunction

function RandomPointInRange takes location Center, real Radius returns location
    return PolarProjectionBJ(Center, GetRandomReal(128.00, Radius), GetRandomDirectionDeg())
endfunction
function Trig_NUKE_Actions takes nothing returns nothing
    local integer k
    local location uloc
    set uloc = (GetUnitLoc(GetSummonedUnit()))
    local trigger TempTrigger = CreateTrigger()
    local player owner
    set owner = GetOwningPlayer(GetSummonedUnit())

    call StoreReal( GetNukeGameCache(), "Nuke", "LocationX", GetLocationX(uloc) )
    call StoreReal( GetNukeGameCache(), "Nuke", "LocationY", GetLocationY(uloc) )

    call PolledWait( 4.00 )
    call SetUnitTimeScalePercent( GetSummonedUnit(), 10.00 )
    call SetBlightLoc(Player(12), uloc, 512.00, true)
    call TriggerAddAction(TempTrigger,function TimedBlight)
    call TriggerExecute(TempTrigger)
    call DestroyTrigger(TempTrigger)
    set TempTrigger = null

    call TerrainDeformCrater(GetLocationX(uloc), GetLocationY(uloc), 512, -160, 50, true)
    call TerrainDeformCrater(GetLocationX(uloc), GetLocationY(uloc), 460, 256, 50, true)

    set k = 1 
    loop
        exitwhen k > 32
        call TimedSFX( RandomPointInRange(uloc, 512.00), "Environment\\UndeadBuildingFire\\UndeadSmallBuildingFire0.mdl", 14.00 )
        call TimedSFX( RandomPointInRange(uloc, 512.00), "Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl", 14.00 )
        call TimedSFX( PolarProjectionBJ(uloc, GetRandomReal(384.00, 512.00), (11.25 * I2R(k))), "Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl", 14.00 )
        set k = k + 1
    endloop

    set k = 1
    loop
        exitwhen k > 15
        call ForGroupBJ( GetUnitsInRangeOfLocAll(512.00, uloc), function NukeDamage )
        call PolledWait( 1.00 )
        set k = k + 1
    endloop

endfunction
function InitTrig_Nuke takes nothing returns nothing
    local trigger NukeTrigger = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( NukeTrigger, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition( NukeTrigger, Condition( function Trig_NUKE_Conditions ) )
    call TriggerAddAction( NukeTrigger, function Trig_NUKE_Actions )

    set bj_lastCreatedGameCache = InitGameCache("Nuke.w3v")
    set gg_trg_Nuke = StoreNukeGameCache()
endfunction


I can't get what's wrong with it =/.
Whoa
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

Not gonna tell us what syntax errors you got? Or what the problem was?

Is it that you forgot to call it in function main?

Or that you didnt name the trigger in the globals?