function pokemonreturn takes integer playerslot,integer pkcondition returns nothing
//if condition is 0 no one cares. If its 1, both players return pkmn.//Timer defeat for wild pokemon cannot happen here because endbattle deals with that.//Timer defeat for pokemontrainer fights however, is dealt with, here.set udg_TempInt3=playernumberid(udg_Playerhero[playerslot])
call DisplayTextToForce( GetPlayersAll(), ("TempInt3 is "+ I2S(udg_TempInt3)) )
if ((udg_Playerhero[playerslot]== udg_PokemonTrainer[playerslot]) and (pkcondition !=1)) then//Should never get here, even by timer defeat.
call DisplayTextToForce( GetPlayersAll(),"Map error 8")
endif
if((udg_ReturnPreventerCondition[playerslot]==false) or (pkcondition ==1) ) then//this bool is to prevent retarded/abuse esc spams.if(udg_Playerhero[playerslot]== udg_PokemonTeam[udg_Activepokemon[playerslot]]) then//Timerdefeat for VersusPlayerslot[playerslot], but playerslot player may also have not an pokemon outside. This is done so it doesnt bug.if (udg_HP[AIslot(playerslot)]!=0) then//detects wild pkmn fight
call UnitRemoveAbilityBJ( 'A01R', udg_Playerhero[playerslot])//removes catch pokemon skill
endif
set udg_TempRect = playeritemrects(playerslot)
set udg_TempX = GetRectCenterX(udg_TempRect)
set udg_TempY = GetRectCenterY(udg_TempRect)
call SetUnitX(udg_Playerhero[playerslot],udg_TempX)
call SetUnitY(udg_Playerhero[playerslot],udg_TempY)//puts the pokemon "back to its ball"up to hereset udg_NoPokemon[playerslot]=trueset udg_NoPokemonInt[playerslot]=10
call SetTextTagPosUnitBJ( udg_NoPokemonText[playerslot], udg_Playerhero[playerslot],0 )//moves dat floating text
call SetTextTagTextBJ( udg_NoPokemonText[playerslot], I2S(udg_NoPokemonInt[playerslot]),10 )//gives text: nopokemonint, converted from into to string
call ShowTextTagForceBJ( true, udg_NoPokemonText[playerslot], GetPlayersAll() )//show floating text, cuz hidden// BELOW LIES THE THORN, DESTROYER OF IMAGINARY BEATIFUL WORLDS!(It is safe to put /* here and right after local multiboard.//If I display tempint3 here, it returns 24. Then it goes to assign player 24. ggwp
call DisplayTextToForce( GetPlayersAll(), ("But after it becomes "+ I2S(udg_TempInt3)) )