• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Need help troubleshooting this code...

Status
Not open for further replies.
Level 3
Joined
Jul 21, 2004
Messages
20
I know it isn't cleaned up yet, but i do that after i get the trigger to work...

What i want it to do is make a dummy caster for each unit within 300 of the dummy spell target, and for them to cast the spell on their assigned units. This spell should drag the units closer by 24 every 0.02 seconds if it is further away than 300 from the dummy casters (and so the tower)

Basically, the problem is that only the unit targeted by the original dummy spell is actually caught by the real one, and that one isn't dragged in...

Code:
function Trig_Traction_start_JASS_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A03A' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Traction_start_JASS_Func001001003001001 takes nothing returns boolean
    return ( GetOwningPlayer(GetFilterUnit()) == Player(8) )
endfunction

function Trig_Traction_start_JASS_Func001001003001002 takes nothing returns boolean
    return ( GetOwningPlayer(GetFilterUnit()) == Player(9) )
endfunction

function Trig_Traction_start_JASS_Func001001003001 takes nothing returns boolean
    return GetBooleanOr( Trig_Traction_start_JASS_Func001001003001001(), Trig_Traction_start_JASS_Func001001003001002() )
endfunction

function Trig_Traction_start_JASS_Func001001003002001 takes nothing returns boolean
    return ( GetOwningPlayer(GetFilterUnit()) == Player(10) )
endfunction

function Trig_Traction_start_JASS_Func001001003002002 takes nothing returns boolean
    return ( GetOwningPlayer(GetFilterUnit()) == Player(11) )
endfunction

function Trig_Traction_start_JASS_Func001001003002 takes nothing returns boolean
    return GetBooleanOr( Trig_Traction_start_JASS_Func001001003002001(), Trig_Traction_start_JASS_Func001001003002002() )
endfunction

function Trig_Traction_start_JASS_Func001001003 takes nothing returns boolean
    return GetBooleanOr( Trig_Traction_start_JASS_Func001001003001(), Trig_Traction_start_JASS_Func001001003002() )
endfunction

function Trig_Traction_start_JASS_Func001Func004Func001C takes unit dummy, unit dummytarget returns boolean
    if ( not ( DistanceBetweenPoints(GetUnitLoc(dummy), GetUnitLoc(dummytarget)) > 300.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Traction_start_JASS_Func001A takes nothing returns nothing
    local unit dummy
    local unit dummyparent = GetSpellAbilityUnit()
    local unit dummytarget = GetEnumUnit()
    local integer d = 0
    local integer e 
    call CreateNUnitsAtLocFacingLocBJ( 1, 'h00W', GetOwningPlayer(dummyparent), GetUnitLoc(dummyparent), GetUnitLoc(dummytarget) )
    set dummy = GetLastCreatedUnit()
    set e = ( R2I(DistanceBetweenPoints(GetUnitLoc(dummy), GetUnitLoc(dummytarget))) / 24 )
    call UnitAddAbilityBJ( 'A039', dummy )
    call IssueTargetOrderBJ( dummy, "magicleash", dummytarget )
    call UnitAddAbilityBJ( 'Aloc', dummy )
    loop
        exitwhen d > e
        if ( Trig_Traction_start_JASS_Func001Func004Func001C(dummy,dummytarget) ) then
            call SetUnitPositionLoc( dummytarget, PolarProjectionBJ(GetUnitLoc(dummytarget), 24.00, AngleBetweenPoints(GetUnitLoc(dummytarget), GetUnitLoc(dummy))) )
            call PolledWait( 0.02 )
        else
        endif
        set d = d + 1
    endloop
endfunction

function Trig_Traction_start_JASS_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsInRangeOfLocMatching(300.00, GetUnitLoc(GetSpellTargetUnit()), Condition(function Trig_Traction_start_JASS_Func001001003)), function Trig_Traction_start_JASS_Func001A )
endfunction

//===========================================================================
function InitTrig_Traction_start_JASS takes nothing returns nothing
    set gg_trg_Traction_start_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Traction_start_JASS, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Traction_start_JASS, Condition( function Trig_Traction_start_JASS_Conditions ) )
    call TriggerAddAction( gg_trg_Traction_start_JASS, function Trig_Traction_start_JASS_Actions )
endfunction


I hope someone can help me :( once i get the map mostly finished, i'll upload it here and you all can tell me what you think :p

p.s. sorry for not posting it in JASS formatting, but for some reason it won't properly display :S
 
Status
Not open for further replies.
Top