What about this isnt compaible?

MasterOfRa

New Member
Reaction score
10
JASS:
library CS uses Dummy, Recycler, Filter, Constants

globals
    private constant real DELTA = 16.
endglobals

//===========================================================================
public struct Data
    unit whichUnit
    unit target
    
    static method create takes unit whichUnit returns Data
        local Data data = Data.allocate()
        set data.whichUnit = whichUnit
        return data
    endmethod
    
    //===========================================================================
    private method IsLineClear takes nothing returns boolean
        local real x1 = GetUnitX(.whichUnit)
        local real y1 = GetUnitY(.whichUnit)
        local real x2 = GetUnitX(.target)
        local real y2 = GetUnitY(.target)
        local real dy = y2-y1
        local real dx = x2-x1
        local real angle = Atan2(dy, dx)
        local real distance = SquareRoot(dx*dx+dy*dy)
        local real d = 0
        loop
            set d = d + DELTA
            exitwhen d>=distance
            set x2 = x1 + d*Cos(angle)
            set y2 = y1 + d*Sin(angle)
            if IsTerrainPathable(x2, y2, PATHING_TYPE_WALKABILITY) == true then
                return false
            endif
        endloop
        return true
    endmethod
    
    //===========================================================================
    method GetClearTarget takes real area returns unit
        local group g = NewGroup()
        call GroupEnumUnitsInRange(g, GetUnitX(.whichUnit), GetUnitY(.whichUnit), area, Filter_VisibleAliveEnemy(GetOwningPlayer(.whichUnit)))
        if .target != null then
            if IsUnitInGroup(.target,g)then
                if .IsLineClear() then
                    call ReleaseGroup(g)
                    return .target
                endif
            endif
        endif
        loop
            set .target = FirstOfGroup(g)
            if .IsLineClear() then
                call ReleaseGroup(g)
                return .target
            endif
            call GroupRemoveUnit(g, .target)
            exitwhen .target == null
        endloop
        call ReleaseGroup(g)
        return null
    endmethod        
    
    //===========================================================================
    method GetTarget takes real area returns unit
        local group g = NewGroup()
        call GroupEnumUnitsInRange(g, GetUnitX(.whichUnit), GetUnitY(.whichUnit), area, Filter_VisibleAliveEnemy(GetOwningPlayer(.whichUnit)))
        if .target != null then
            if IsUnitInGroup(.target,g)then
                if .IsLineClear() then
                    call ReleaseGroup(g)
                    return .target
                endif
            endif
        endif
        //call GroupEnumUnitsInRange(g, GetUnitX(.whichUnit), GetUnitY(.whichUnit), area, null)
        set .target = FirstOfGroup(g)
        call ReleaseGroup(g)
        return .target
    endmethod
    
    method onDestroy takes nothing returns nothing
        set .whichUnit = null
        set .target = null
    endmethod
endstruct


//===========================================================================
//public function FrostBoltEffect takes unit caster, unit target, integer level returns nothing
//    call Dummy_create(caster, AID_FROSTBOLT_EFFECT, level, 0.0)
//    call IssueTargetOrderById(bj_lastCreatedUnit, OID_frostnova, target)
//endfunction

//===========================================================================
endlibrary
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:
            if .IsLineClear() then
                call ReleaseGroup(g)
                return .target
            else
                call GroupRemoveUnit(g, .target)
            endif

-->
JASS:
            if .IsLineClear() then
                call ReleaseGroup(g)
                return .target
            endif
            call GroupRemoveUnit(g, .target)

That bug is good, if your "if" block contains a return that return should always be followed with "endif" anyway. :thup:

PS. I'm not actually sure if that is it. But that's my bet. :D
 

MasterOfRa

New Member
Reaction score
10
makes sence, tho it didnt fix the problem, it still doesnt work, and i know its this trigger, that may have only been part of the problem, or wasnt a problem at all
 

MasterOfRa

New Member
Reaction score
10
i suggest to disable all your triggers, and enable them one at a time, test it to see if it runs, if not, look at that trigger and fix the error. then continue till you finish

i got mine to work like this, tho this is the one trigger i cant figure out, but at least it isnt required by the game
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top