hi,
this code line is desyncing one of my buddys every time:
call TriggerRegisterPlayerEvent(gg_trg_PlayerLeaves, Player(i), EVENT_PLAYER_LEAVE)
when i comment it out it works fine
the other buddy is fine
some data:
they both have windows 7 but the buddy who gets the disconnect installed his windows7 on a mac computer
things i tried:
1. putting this function in various other places in my map
2. putting it out of a loop
3. makeing a new map and importing everything in the new map because i thought maybe newgen editor corrupted it
4. useing TriggerSyncReady() at the end
5. deactivateing everything else
after all theese things i still have no clue why it disconnects and im not doing any silly mistakes and im not a idiot or somethin
please turn on the creative mind and give me some usefull feedback
this code line is desyncing one of my buddys every time:
call TriggerRegisterPlayerEvent(gg_trg_PlayerLeaves, Player(i), EVENT_PLAYER_LEAVE)
when i comment it out it works fine
the other buddy is fine
some data:
they both have windows 7 but the buddy who gets the disconnect installed his windows7 on a mac computer
things i tried:
1. putting this function in various other places in my map
2. putting it out of a loop
3. makeing a new map and importing everything in the new map because i thought maybe newgen editor corrupted it
4. useing TriggerSyncReady() at the end
5. deactivateing everything else
after all theese things i still have no clue why it disconnects and im not doing any silly mistakes and im not a idiot or somethin
please turn on the creative mind and give me some usefull feedback
JASS:
function Trig_initialisation_Actions takes nothing returns nothing
local integer i = 0
local integer i2 = 0
local integer i3 = 0
local real tempr1
local real tempr2
local real tempr3
set udg_PlayerColorsRGB[0+0] = 255
set udg_PlayerColorsRGB[0+1] = 30
set udg_PlayerColorsRGB[0+2] = 30
set udg_PlayerColorsRGB[1+0] = 0
set udg_PlayerColorsRGB[1+1] = 66
set udg_PlayerColorsRGB[1+2] = 255
set udg_PlayerColorsRGB[2+0] = 28
set udg_PlayerColorsRGB[2+1] = 230
set udg_PlayerColorsRGB[2+2] = 184
set udg_PlayerColorsRGB[3+0] = 83
set udg_PlayerColorsRGB[3+1] = 0
set udg_PlayerColorsRGB[3+2] = 129
set udg_PlayerColorsRGB[4+0] = 255
set udg_PlayerColorsRGB[4+1] = 251
set udg_PlayerColorsRGB[4+2] = 10
set udg_PlayerColorsRGB[5+0] = 253
set udg_PlayerColorsRGB[5+1] = 185
set udg_PlayerColorsRGB[5+2] = 14
set udg_PlayerColorsRGB[6+0] = 33
set udg_PlayerColorsRGB[6+1] = 191
set udg_PlayerColorsRGB[6+2] = 0
set udg_PlayerColorsRGB[7+0] = 229
set udg_PlayerColorsRGB[7+1] = 91
set udg_PlayerColorsRGB[7+2] = 175
set udg_PlayerColorsRGB[8+0] = 147
set udg_PlayerColorsRGB[8+1] = 147
set udg_PlayerColorsRGB[8+2] = 150
set udg_PlayerColorsRGB[9+0] = 124
set udg_PlayerColorsRGB[9+1] = 191
set udg_PlayerColorsRGB[9+2] = 239
set udg_PlayerColorsRGB[10+0]= 0
set udg_PlayerColorsRGB[10+1]= 70
set udg_PlayerColorsRGB[10+2]= 0
set udg_PlayerColorsRGB[11+0]= 125
set udg_PlayerColorsRGB[11+1]= 54
set udg_PlayerColorsRGB[11+2]= 0
// constants
set udg_PlayableMaxXMinXMaxYMinY[0] = GetRectMaxX(bj_mapInitialPlayableArea)
set udg_PlayableMaxXMinXMaxYMinY[1] = GetRectMinX(bj_mapInitialPlayableArea)
set udg_PlayableMaxXMinXMaxYMinY[2] = GetRectMaxY(bj_mapInitialPlayableArea)
set udg_PlayableMaxXMinXMaxYMinY[3] = GetRectMinY(bj_mapInitialPlayableArea)
// call some general functions
call DisplayTextToForce(GetPlayersAll(),R2S(udg_OTTE_WALL_THICKNESS )+" Welcome to Electric motion")
call ClearMapMusic()
call StopMusic(false)
call SetMusicVolume(0)
set udg_StartTournamentTriggerFix = CreateTrigger()
call TriggerAddAction( udg_StartTournamentTriggerFix, function StartTournamentLobby )
set udg_UpdateDamageEventTriggerFix = CreateTrigger()
call TriggerAddAction( udg_UpdateDamageEventTriggerFix , function UpdateTankDamageEvent )
set udg_TournamentLobby1TriggerFix = CreateTrigger()
call TriggerAddAction( udg_TournamentLobby1TriggerFix , function AfterStartTournamentLobby1 )
set udg_MulR1[0] = CreateTextTag()
set udg_MulR1[1] = CreateTextTag()
set udg_MulR1[2] = CreateTextTag()
set udg_MulR2[0] = CreateTextTag()
call SetTextTagColor(udg_MulR2[0],255,255,0,255)
set udg_MulR2[1] = CreateTextTag()
call SetTextTagColor(udg_MulR2[1],255,255,0,255)
set udg_MulR2[2] = CreateTextTag()
call SetTextTagColor(udg_MulR2[2],255,255,0,255)
set i2 = 250 // size of the ottes
set tempr3 = i2 - udg_OTTE_WALL_THICKNESS * 0.5
// create rects for otte (gallos crazy name for safe spots where u cant be catched)
loop
exitwhen i > udg_OTTEGROUPS_AMOUNT-2
set tempr1 = GetRandomReal(udg_PlayableMaxXMinXMaxYMinY[1]+500,udg_PlayableMaxXMinXMaxYMinY[0]-500)
set tempr2 = GetRandomReal(udg_PlayableMaxXMinXMaxYMinY[3]+500,udg_PlayableMaxXMinXMaxYMinY[2]-500)
set udg_OtteRects[i*4+0] = tempr1-i2
set udg_OtteRects[i*4+1] = tempr2-i2
set udg_OtteRects[i*4+2] = tempr1+i2
set udg_OtteRects[i*4+3] = tempr2+i2
set udg_OtteOwningPlayer[i] = null
// 1 lever
set bj_lastCreatedUnit = CreateUnit( Player(15) , 'h00F', tempr1 , tempr2 , GetRandomReal(0,360) )
call SetUnitAnimation( bj_lastCreatedUnit , "death" )
call SetUnitUserData(bj_lastCreatedUnit,i)
// 4 walls
set bj_lastCreatedUnit = CreateUnit( Player(15) , 'h00G', tempr1 , tempr2-tempr3 , 0*90 )
call GroupAddUnit( udg_OtteRectWalls[i] , bj_lastCreatedUnit )
call SetUnitAnimation( bj_lastCreatedUnit , "death" )
set bj_lastCreatedUnit = CreateUnit( Player(15) , 'h00G', tempr1+tempr3 , tempr2 , 1*90 )
call GroupAddUnit( udg_OtteRectWalls[i] , bj_lastCreatedUnit )
call SetUnitAnimation( bj_lastCreatedUnit , "death" )
set bj_lastCreatedUnit = CreateUnit( Player(15) , 'h00G', tempr1 , tempr2+tempr3 , 2*90 )
call GroupAddUnit( udg_OtteRectWalls[i] , bj_lastCreatedUnit )
call SetUnitAnimation( bj_lastCreatedUnit , "death" )
set bj_lastCreatedUnit = CreateUnit( Player(15) , 'h00G', tempr1-tempr3 , tempr2 , 3*90 )
call GroupAddUnit( udg_OtteRectWalls[i] , bj_lastCreatedUnit )
call SetUnitAnimation( bj_lastCreatedUnit , "death" )
set i=i+1
endloop
set i2 = 0
set i = 0
// inner tournament otte rect
set udg_OtteRects[udg_OTTEGROUPS_AMOUNT*4+0] = -2000
set udg_OtteRects[udg_OTTEGROUPS_AMOUNT*4+1] = -1000
set udg_OtteRects[udg_OTTEGROUPS_AMOUNT*4+2] = 2000
set udg_OtteRects[udg_OTTEGROUPS_AMOUNT*4+3] = 1000
set udg_OtteOwningPlayer[udg_OTTEGROUPS_AMOUNT] = null
// outter tournament otte rect
set udg_OtteRects[(udg_OTTEGROUPS_AMOUNT-1)*4+0] = -2500
set udg_OtteRects[(udg_OTTEGROUPS_AMOUNT-1)*4+1] = -1500
set udg_OtteRects[(udg_OTTEGROUPS_AMOUNT-1)*4+2] = 2500
set udg_OtteRects[(udg_OTTEGROUPS_AMOUNT-1)*4+3] = 1500
set udg_OtteOwningPlayer[udg_OTTEGROUPS_AMOUNT-1] = null
call SetPlayerName(Player(10),"hallo")
call SetPlayerName(Player(11),"hall34o")
// for every player
loop
if( GetPlayerName(Player(i)) != "Player " + I2S(i+1)) then
call ForceAddPlayer(udg_AllPlayers,Player(i))
call TriggerRegisterPlayerEvent(gg_trg_Left_Depress, Player(i), EVENT_PLAYER_ARROW_LEFT_DOWN)
call TriggerRegisterPlayerEvent(gg_trg_Right_Depress, Player(i), EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerRegisterPlayerEvent(gg_trg_Up_Depress, Player(i), EVENT_PLAYER_ARROW_UP_DOWN)
call TriggerRegisterPlayerEvent(gg_trg_Down_Depress, Player(i), EVENT_PLAYER_ARROW_DOWN_DOWN)
call TriggerRegisterPlayerEvent(gg_trg_Left_Release, Player(i), EVENT_PLAYER_ARROW_LEFT_UP)
call TriggerRegisterPlayerEvent(gg_trg_Right_Release, Player(i), EVENT_PLAYER_ARROW_RIGHT_UP)
call TriggerRegisterPlayerEvent(gg_trg_Up_Release, Player(i), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_Down_Release, Player(i), EVENT_PLAYER_ARROW_DOWN_UP)
call TriggerRegisterPlayerEvent(gg_trg_PlayerLeaves, Player(i), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerUnitEvent( gg_trg_SelectionEvent , Player(i) , EVENT_PLAYER_UNIT_SELECTED, null)
//call TriggerRegisterPlayerUnitEvent( gg_trg_DeselectionEvent , Player(i) , EVENT_PLAYER_UNIT_DESELECTED, null)
call SetPlayerState( Player(i) , PLAYER_STATE_RESOURCE_GOLD , 100000 )
call FogEnable(false)
call FogMaskEnable(false)
set udg_NettoWorthCount[i] = 0
// create tanks at random point in map
set tempr1 = GetRandomReal(udg_PlayableMaxXMinXMaxYMinY[1]+500,udg_PlayableMaxXMinXMaxYMinY[0]-500)
set tempr2 = GetRandomReal(udg_PlayableMaxXMinXMaxYMinY[3]+500,udg_PlayableMaxXMinXMaxYMinY[2]-500)
call PanCameraToTimedForPlayer(Player(i),tempr1,tempr2,0)
set bj_lastCreatedUnit = CreateUnit( Player(i) , 'h004', tempr1 , tempr2 , GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit// add to groups
set i2 = i2 + 1
set udg_SteamTanks[i3] = bj_lastCreatedUnit
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)// user data as handle to all data of the unit
set udg_xVelocity[udg_iUniqueData] = 0// current velocity
set udg_yVelocity[udg_iUniqueData] = 0
set udg_rCollisionSize[udg_iUniqueData] = 130 / 2
set udg_rMass[udg_iUniqueData] = udg_TANK_MASS// how heavy is the object
set udg_StaticObject[udg_iUniqueData] = true// a static object is treated differently in QuadTree to improve performance
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit// unit safes its own handle for RemoveUnitWrap function .. and more?
call AddUnitToOtteGroupBooleanArray(udg_iUniqueData)
set udg_iUniqueData = udg_iUniqueData + 1// this int must allways point at a free slot, when something removed, it swaps last slot to removed slot
call ShowUnit(bj_lastCreatedUnit,false)
set udg_PeasantAbilityLevel[i] = 2
call SetUnitAbilityLevel( bj_lastCreatedUnit , 'A000' , udg_PeasantAbilityLevel[i] )// level 2 = 1 peasant in tank
call UnitRemoveAbility(bj_lastCreatedUnit,'A001')// removeing engine ability cuz it has an upgrade instead at first
// create one silver to start with
set bj_lastCreatedUnit = CreateUnit( Player(15) , 'h009', tempr1 + 500, tempr2, GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 160 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i3 = i3 + 1
endif
set i = i + 1
exitwhen i > 11
endloop
set udg_SteamTanks[i3] = null
if( i3 > 1 ) then
call TimerStart(udg_TournamentTimer,20,false,function PreStartTournament)
//call TimerStart(udg_TournamentTimer,GetRandomInt(900,1800),false,function PreStartTournament)
endif
call UpdateTankDamageEvent()
call UpdateMultiBoard()
// create many static objects on map
set i = 0
// create minerals
loop
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h002', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 180 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i = i + 1
exitwhen i > 100
endloop
// create minerals
set i = 0
loop
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h008', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 160 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i = i + 1
exitwhen i > 75
endloop
// create minerals
set i = 0
loop
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h009', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 160 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i = i + 1
exitwhen i > 50
endloop
// create minerals
set i = 0
loop
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h001', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 150 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i = i + 1
exitwhen i > 25
endloop
// create minerals
set i = 0
loop
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h00A', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 100 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i = i + 1
exitwhen i > 10
endloop
// create minerals
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h00B', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 120 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
// create obstacles
set i = 0
loop
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h007', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 150 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i = i + 1
exitwhen i > 20
endloop
// create obstacles
set i = 0
loop
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(15) , 'h006', GetRandomLocInRect(GetPlayableMapRect()), GetRandomReal(0,360) )
set udg_CollisionGroup[i2] = bj_lastCreatedUnit
set i2 = i2 + 1
call SetUnitUserData(bj_lastCreatedUnit ,udg_iUniqueData)
set udg_rCollisionSize[udg_iUniqueData] = 200 / 2
set udg_StaticObject[udg_iUniqueData] = true
set udg_UniqueDataUnits[udg_iUniqueData] = bj_lastCreatedUnit
set udg_iUniqueData = udg_iUniqueData + 1
set i = i + 1
exitwhen i > 20
endloop
set udg_MotionGroup[0] = null
set udg_CollisionGroup[i2] = null
set bj_lastCreatedUnit = null
call TriggerSleepAction(1)
set i=0
loop
exitwhen udg_SteamTanks[i] == null
call ShowUnit(udg_SteamTanks[i],true)
set i=i+1
endloop
set i=0
loop
exitwhen i == 12
if( GetPlayerName(Player(i)) != "Player " + I2S(i+1) ) then
call StartChillMusic(i)
endif
set i=i+1
endloop
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_initialisation takes nothing returns nothing
set gg_trg_initialisation = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_initialisation, 0.01 )
call TriggerAddAction( gg_trg_initialisation, function Trig_initialisation_Actions )
endfunction