• 🏆 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!

location problem WOOT??

Status
Not open for further replies.
Level 8
Joined
Mar 23, 2007
Messages
302
Hi, i have a problem with this jassy trigger
JASS:
function Trig_set_Info_Actions takes nothing returns nothing
local group G =  CreateGroup() 
local group inG = CreateGroup()
local unit u
local unit inu
local location L
set G = GetUnitsInRectMatching(bj_mapInitialPlayableArea, null)
loop
    set u = FirstOfGroup(G)
    set L = GetUnitLoc(u)
    exitwhen u == null
    if ((GetUnitTypeId(u) == 'h00B')or(GetUnitTypeId(u) == 'h00A')or(GetUnitTypeId(u) == 'h00M'))then
    set inG = GetUnitsInRangeOfLocAll(1000.00, L)
    call RemoveLocation(L)
    loop
        set inu = FirstOfGroup(inG)
        exitwhen inu == null
        if (IsUnitType(inu,UNIT_TYPE_TOWNHALL) == true)then
        call UnitAddAbility(  u ,'A000')
        call SetUnitAbilityLevel(u,'A000',GetUnitAbilityLevel(inu,'A000'))
        endif
        call GroupRemoveUnit(inG, inu)
    endloop
    elseif (GetUnitTypeId(u) == 'h00C')then
    set inG = GetUnitsInRangeOfLocAll(600.00, L)
    loop
        set inu = FirstOfGroup(inG)
        exitwhen inu == null
        if (IsUnitType(inu,UNIT_TYPE_TOWNHALL) == true)then
        call UnitAddAbility(  u ,'A00V')
        call SetUnitAbilityLevel(u,'A00V',GetUnitAbilityLevel(inu,'A000'))
        endif
        call GroupRemoveUnit(inG, inu)
    endloop
    endif
    call GroupRemoveUnit(G, u)
endloop
call DestroyGroup(G)
call DestroyGroup(inG)
call RemoveLocation(L)
set L = null
set G = null
set inG = null
set u = null
set inu = null
endfunction

In game it says that some locations are not destroyed etc, u know, this Red Error message. Pls someone help me and say what i can improve.

I thought i removed all locations. pls someone help

(If it helps, this trigger runs every 3 seconds, i'm gonna change this to "whener unit enters playableMap")
 
Level 11
Joined
Aug 25, 2006
Messages
971
How do you make it display leaks? I've really wanted to know, but I can't seem to find out. Its one of the features of war3err right? Could you tell me how its done!?
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
Well, you must have war3err on (found with Grimoire, which is included in JassNewGenPack). Then, to display the amount of location leaks, do call RemoveLocation( I2L(-1) ). To display the amount of group leaks, do call DestroyGroup( I2G(-1) ), where of course I2L and I2G are integer to location/group return bug functions.
 
Level 11
Joined
Aug 25, 2006
Messages
971
I don't understand, what are I2L and I2G supposed to have in them? (Posting them would be wonderful...)

Surley not this:
JASS:
function I2L takes integer I returns location
return I
return null
endfunction
function I2G takes integer I returns group
return I
return null
endfunction

Hmm those functions I concocted from my knowledge of the return bug worked! Thanks...
 
Level 8
Joined
Mar 23, 2007
Messages
302
However, i get it fixed.
Thx for your help.
I removed the whole Trigger and add the "effect" of this trigger to every one of the 4 "entering the map" trigger. Just notized, running every 3 seconds throu all units was wrong as hell.

just if u r interested
here is 1 of those 4 triggers:
JASS:
function Trig_Mage_Guilde_Conditions takes nothing returns boolean
return GetResearched() == 'R003'
endfunction

function Trig_Mage_Guilde_Actions takes nothing returns nothing
local unit T = GetResearchingUnit()
local location L = GetUnitLoc(T)
local group G = GetUnitsInRangeOfLocAll(1000.00, L)
local unit u
local integer x = 0
local real X = GetUnitX(T)
local real Y = GetUnitY(T)
local player P = GetOwningPlayer(T)
local integer Gold = 90
local integer InfoAbility = 'A00V'
local integer AL = GetUnitAbilityLevel(T,'A000')
call RemoveLocation(L)
set L = null
loop
    set u = FirstOfGroup(G)
    exitwhen u == null
    if (GetUnitTypeId(u) == 'h00M')then
    set x  = x+1
    elseif (GetUnitTypeId(u) == 'h00C')then
    set x = x+2
    endif
    call GroupRemoveUnit(G, u)
endloop
    if (x == 1)then
    set u = CreateUnit(P,'h00C',X,Y,270)
    call UnitAddAbility( u ,InfoAbility)
    call SetUnitAbilityLevel(u,InfoAbility,AL)
    elseif (x == 0)then
    call AdjustPlayerStateBJ( Gold, P, PLAYER_STATE_RESOURCE_GOLD )
    call DisplayTimedTextToPlayer(P,0,0,12,"You need the Capitol at this Town first. 90 Gold returned.")
    elseif (x == 3)then
    call AdjustPlayerStateBJ( Gold, P, PLAYER_STATE_RESOURCE_GOLD )
    call DisplayTimedTextToPlayer(P,0,0,12,"You have a Mage Guild already. 90 Gold returned.")
    endif
call DestroyGroup(G)
set P = null
set T = null
set u = null
set G = null
endfunction

i hope it is leakless , cuz i couldnt find any errors...

THX for help again.
 
Status
Not open for further replies.
Top