Well as the title says I have GetLocalPlayer problem. The function which causes problem should be this:
If you need the map I will gladly post it for you if you can help ^^
JASS:
function CheckAvailQuests takes nothing returns nothing
local integer pid = GetPlayerId( GetOwningPlayer( GetLevelingUnit( ) ) )
local integer int = 0
local group array SUOT
local unit TU
local integer TT = 0
local integer Amount = 0
if GetLevelingUnit( ) == null then
set pid = GetPlayerId( LastTrigPlayer )
endif
set SUOT[1] = CreateGroup( )
set SUOT[2] = CreateGroup( )
set SUOT[3] = CreateGroup( )
set SUOT[4] = CreateGroup( )
loop
if GetLocalPlayer( ) == Player( pid ) then
call DestroyEffect( LoadEffectHandle( Miscdata , pid , int ) )
endif
exitwhen LoadInteger( Miscdata , pid , 8191 ) == int
set int = int + 1
endloop
set int = 0
loop
set int = int + 1
if LoadInteger( udg_QDB , int , 1 ) > 0 and LoadInteger( udg_QDB , int , 25 ) <= GetHeroLevel( udg_PLAYER_Hero[pid] ) and FinishedQuestHandler( pid , int ) == true and ReqTeamHandler( pid , int ) == true then
if LoadInteger( PlayerTable , pid , int ) != -5 and ( LoadInteger( PlayerTable , pid , int ) != -2 or QSYS_Setup[11] == 1 ) then
set Amount = Amount + 1
call SaveInteger( PlayerTable , pid , 2100 + Amount , int )
endif
if LoadInteger( PlayerTable , pid , int ) == 0 and ( GetHeroLevel( udg_PLAYER_Hero[pid] ) - QSYS_Setup[7] < LoadInteger( udg_QDB , int , 28 ) or LoadInteger( udg_QDB , int , 28 ) == -1 ) then
if LoadInteger( udg_QDB , int , 26 ) > 0 then
call GroupAddGroup( GetUnitsOfTypeIdAll( LoadInteger( udg_QDB , int , 26 ) ) , SUOT[1] )
else
call GroupAddUnit( SUOT[1] , LoadUnitHandle( udg_QDB , int , 26 ) )
endif
elseif LoadInteger( PlayerTable , pid , int ) == -1 then
if LoadInteger( udg_QDB , int , 27 ) > 0 then
call GroupAddGroup( GetUnitsOfTypeIdAll( LoadInteger( udg_QDB , int , 27 ) ) , SUOT[2] )
else
call GroupAddUnit( SUOT[2] , LoadUnitHandle( udg_QDB , int , 27 ) )
endif
elseif LoadInteger( PlayerTable , pid , int ) == -2 and QSYS_Setup[11] == 1 then
if LoadInteger( udg_QDB , int , 27 ) > 0 then
call GroupAddGroup( GetUnitsOfTypeIdAll( LoadInteger( udg_QDB , int , 27 ) ) , SUOT[3] )
else
call GroupAddUnit( SUOT[3] , LoadUnitHandle( udg_QDB , int , 27 ) )
endif
elseif LoadInteger( PlayerTable , pid , int ) > 0 then
if LoadInteger( udg_QDB , int , 27 ) > 0 then
call GroupAddGroup( GetUnitsOfTypeIdAll( LoadInteger( udg_QDB , int , 27 ) ) , SUOT[4] )
else
call GroupAddUnit( SUOT[4] , LoadUnitHandle( udg_QDB , int , 27 ) )
endif
endif
endif
exitwhen int == 999
endloop
call SaveInteger( PlayerTable , pid , 2101 + Amount , 0 )
set Amount = 0
loop
exitwhen Amount > 1000 or ( FirstOfGroup( SUOT[1] ) == null and FirstOfGroup( SUOT[2] ) == null and FirstOfGroup( SUOT[3] ) == null and FirstOfGroup( SUOT[4] ) == null ) //Prevent function/trigger crash
if FirstOfGroup( SUOT[1] ) != null then
set TU = FirstOfGroup( SUOT[1] )
set TT = 0
elseif FirstOfGroup( SUOT[2] ) != null then
set TU = FirstOfGroup( SUOT[2] )
set TT = 2
elseif FirstOfGroup( SUOT[3] ) != null then
set TU = FirstOfGroup( SUOT[3] )
set TT = 3
elseif FirstOfGroup( SUOT[4] ) != null then
set TU = FirstOfGroup( SUOT[4] )
set TT = 1
endif
set int = S2I( QSYS_Misc[10 + TT] )
if IsUnitInGroup( TU , SUOT[1] ) and int < S2I( QSYS_Misc[10] ) then
set int = S2I( QSYS_Misc[10] )
set TT = 0
endif
if IsUnitInGroup( TU , SUOT[2] ) and int < S2I( QSYS_Misc[12] ) then
set int = S2I( QSYS_Misc[12] )
set TT = 2
endif
if IsUnitInGroup( TU , SUOT[3] ) and int < S2I( QSYS_Misc[13] ) then
set int = S2I( QSYS_Misc[13] )
set TT = 3
endif
if IsUnitInGroup( TU , SUOT[4] ) and int < S2I( QSYS_Misc[11] ) then
set int = S2I( QSYS_Misc[11] )
set TT = 1
endif
call GroupRemoveUnit( SUOT[1] , TU )
call GroupRemoveUnit( SUOT[2] , TU )
call GroupRemoveUnit( SUOT[3] , TU )
call GroupRemoveUnit( SUOT[4] , TU )
if IsUnitEnemy( TU , Player( pid ) ) == false then
if GetLocalPlayer( ) == Player( pid ) then
call SaveEffectHandle( Miscdata , pid , Amount , AddSpecialEffectTarget( QSYS_Misc[14 + TT] , TU , "overhead" ) )
endif
endif
set Amount = Amount + 1
endloop
call SaveInteger( Miscdata , pid , 8191 , Amount )
call DestroyGroup( SUOT[1] )
call DestroyGroup( SUOT[2] )
call DestroyGroup( SUOT[3] )
call DestroyGroup( SUOT[4] )
endfunction
If you need the map I will gladly post it for you if you can help ^^
Last edited: