• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[JASS] parameter error and ForGroup usage error

Status
Not open for further replies.
Level 4
Joined
Dec 10, 2005
Messages
73
MUI problem and leaking.

Just have a few problems with Jass. Converting GUI to jass because of MUI problems.

This trigger leaks and I can't find a cause why.

EDIT: Solved, don't cast immolation/ use it as a dummy spell.

What is/are the better dummy spell to base off?

Feel free to check my trigger.

JASS:
function Trig_Placing_Blocker_Func002002002 takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'h001' )
endfunction

function Checking_Chair_Conditions takes unit Temp_Unit, boolean Temp_Boolean returns boolean
    if ( not ( Temp_Boolean == false ) ) then
        return false
    endif
    if ( not ( GetUnitUserData(Temp_Unit) == 1 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Placing_Blocker takes unit T_Unit,location T_Point2,location T_Point3,integer iSTableC returns nothing
    
    local integer array iSTableBreakdown
    local boolean Temp_Boolean = false     
    local rect Temp_Region = RectFromCenterSizeBJ(T_Point2, 192.00, 192.00)
    local group Temp_Group = GetUnitsInRectMatching(Temp_Region,Condition(function Trig_Placing_Blocker_Func002002002) )
    local unit u
    local integer LoopA = 0

   call GroupRemoveUnitSimple( T_Unit, Temp_Group )
   call RemoveRect ( Temp_Region )
   set Temp_Region = null
         
   loop
    set u = FirstOfGroup(Temp_Group)
    exitwhen u == null

        if ( Checking_Chair_Conditions(u,Temp_Boolean)) then
        set Temp_Boolean = true
        call SetUnitUserData( T_Unit, 2 )
        endif

    call GroupRemoveUnit(Temp_Group, u)
   endloop
   
   call DestroyGroup( Temp_Group )
   set u = null      
   set Temp_Group =null 
                                
    if ( Temp_Boolean == false ) then
        call SetUnitUserData( T_Unit, 1 )
        call CreateDestructableLoc( 'B000', T_Point3, 0.00, 1, 0 )
        //call ShowDestructableBJ( false, GetLastCreatedDestructable() )
    endif    
    
    //set LoopA = 1    
    //loop
    //    exitwhen LoopA > 4
    //    set iSTableBreakdown[LoopA] = S2I(SubStringBJ(udg_STables[GetUnitUserData(GetTriggerUnit())], LoopA, LoopA))
    //    set LoopA = LoopA + 1
    //endloop
    
    //set udg_STables[GetUnitUserData(GetSpellAbilityUnit())] = ""
    //set iSTableBreakdown[iSTableC] = 1
    //set iSTableBreakdown[5] = S2I(SubStringBJ(udg_STables[GetUnitUserData(GetTriggerUnit())], 5, 9))
    
    //set LoopA = 1
    //loop
    //    exitwhen LoopA > 5
    //    set udg_STables[GetUnitUserData(GetSpellAbilityUnit())] = ( udg_STables[GetUnitUserData(GetSpellAbilityUnit())] + I2S(iSTableBreakdown[LoopA]) )
    //    set LoopA = LoopA + 1        
    //endloop
    
    call DisplayTextToForce( GetPlayersAll(), "Place" )
    
endfunction


function Trig_Tables_making_chairs_Actions takes nothing returns nothing
    
     local integer iSTableChange 
     local location Temp_Point
     local location Temp_Point2
     local location Temp_Point3
     local unit Temp_Unit    
   
    if ( GetUnitTypeId(GetTriggerUnit()) == 'h000' ) then
        call DisplayTextToForce( GetPlayersAll(), "Running" )
    endif 
    
    
    set Temp_Point = GetUnitLoc(GetTriggerUnit())
    
    // Buy
    if ( GetIssuedOrderIdBJ() == String2OrderIdBJ("manashieldon")  ) then
        set iSTableChange = 1 //North
        set Temp_Point2 = OffsetLocation(Temp_Point, 0, 128.00)
        set Temp_Point3 = OffsetLocation(Temp_Point2, 64.00, 0.00)
    endif
    
    if ( GetIssuedOrderIdBJ() == String2OrderIdBJ("defend")   ) then
        set iSTableChange = 2 //East
        set Temp_Point2 = OffsetLocation(Temp_Point, 128.00, 0.00)
        set Temp_Point3 = OffsetLocation(Temp_Point2, 0.00, -64.00)
    endif
    
    if ( GetIssuedOrderIdBJ() == String2OrderIdBJ("immolation") ) then
        set iSTableChange = 3  //West
        set Temp_Point2 = OffsetLocation(Temp_Point, -128.00, 0.00)
        set Temp_Point3 = OffsetLocation(Temp_Point2, 0.00, 64.00)
    endif
    
    if (GetIssuedOrderIdBJ() == String2OrderIdBJ("divineshield") ) then
        set iSTableChange = 4  //South
        set Temp_Point2 = OffsetLocation(Temp_Point, 0, -128.00)
        set Temp_Point3 = OffsetLocation(Temp_Point2, -64.00, 0.00)
    endif
    
    call DisplayTextToForce( GetPlayersAll(), I2S(iSTableChange)+R2S(GetLocationX(Temp_Point2)) )
    call RemoveLocation( Temp_Point )
    set Temp_Point = null
      
    call CreateNUnitsAtLoc( 1, 'h001', GetTriggerPlayer(), Temp_Point2, udg_AngleChair[iSTableChange] )
    set Temp_Unit = GetLastCreatedUnit()
    
    call Trig_Placing_Blocker(Temp_Unit,Temp_Point2,Temp_Point3,iSTableChange)
    
    set Temp_Unit = null 
    call RemoveLocation( Temp_Point2 )
    call RemoveLocation( Temp_Point3 )
    set Temp_Point2 = null
    set Temp_Point3 = null
    call TriggerSleepAction(5)
    
endfunction

//===========================================================================
function InitTrig_Tables_making_chairs takes nothing returns nothing
    set gg_trg_Tables_making_chairs = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Tables_making_chairs, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddAction( gg_trg_Tables_making_chairs, function Trig_Tables_making_chairs_Actions )
endfunction
 
Last edited:
Status
Not open for further replies.
Top