HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Fade Filter for one player without server split?

01-20-2005, 07:19 AM#1
Tommi
Is it possible to create a fade filter for one player only without creating a server split?

I've tried making an if-block with GetLocalPlayer(), but it creates a server split. I tried also looking into Blizzard.j, but I couldn't find anything which would cause network traffic there. :(
01-20-2005, 10:25 AM#2
Bibendus
Plz post your TRIGGER here.
01-20-2005, 11:00 AM#3
Tommi
It's actually part of a long function, not a trigger. To remove the need to understand what the whole thing (hundreds of code lines) does, I give only the most relevant part:

Code:
            set udg_SmoothingActive[GetConvertedPlayerId(udg_TriggerPlayer)] = true
            set mypoint = Location( GetLocationX(udg_TargetPosition), GetLocationY(udg_TargetPosition) )
            call RemoveLocation(udg_TargetPosition)
            call RemoveLocation( currentcamerapoint )
            //if GetLocalPlayer() == myplayer then
            //    call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, udg_LevelFadeTime, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
            //endif
            //call PolledWait( udg_LevelFadeTime )
            call SetCameraBoundsToRectForPlayerBJ( myplayer, myrect )
            set udg_CurrentCameraBounds[GetConvertedPlayerId(myplayer)] = myrect
            call PanCameraToTimedLocForPlayer( myplayer, mypoint, 0.00 )
            call RemoveLocation(mypoint)
            //if GetLocalPlayer() == myplayer then
            //    call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, udg_LevelFadeTime, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
            //endif
            call PolledWait( udg_LevelFadeTime )
            set udg_SmoothingActive[GetConvertedPlayerId(myplayer)] = false
The local variables are defined like this:
Code:
    local rect myrect = udg_TargetRegion
    local string rectname = udg_TargetRegionName
    local player myplayer = udg_TriggerPlayer
    local location mypoint
    local location currentcamerapoint = GetRectCenter(udg_CurrentCameraBounds[GetConvertedPlayerId(udg_TriggerPlayer)])
There are two fades: Out and In. The lines which are commented out. When the lines are included, the function creates a server split. When they are commented out, everything is ok.
01-20-2005, 02:30 PM#4
Bibendus
I got a split problem trying to refresh the multiboard of 1 singe player.

I fixed the problem switching eatch player and refreshing each board with each player value, with blank values when the board should have been empty.

Each function must use ONLY local variables, your problem could be the use of a global variable in the fade function!

-Try to define a new function.
-In this function add local variables at the beginning.
-Assing to this local variable the udg_LevelFadeTime value.
-Use the local variable into the CinematicFadeBJ function.
-Call this function in the middle of "If GetLocalPlayer() = udg_myPlayer Then" and "Endif"


It should work i hope :D

If you ustill need help i suggest you to take a look to the blizzard grand prix map. Look the multioard functions and look how localplayer must be used to evade the netsplit problem.
01-21-2005, 10:20 AM#5
Tommi
OK. I changed the CinamaticFadeBJ function to use only values (not values of variables), and it didn't help any. I would have wondered if it had, since these inputs are passed-by-value and thus values in CinematicFadeBJ are local copies of the input arguments.
01-21-2005, 11:28 AM#6
Bibendus
Do you get the same problem?
Try another thing... take all players and for each assign a fade filter, empty where the player doesnt need fade and normal for player you want he sees the fade.

I got a netsplit problem refreshing a multiboard for a single player and i fixed the problem refreshing all boards for all players with empty values where players didnt need the board.

Another problem i got was with ifs in the multiboard refresh. I'll make you an example.

Code:
  Take all players and for each player:
  	Assign to BoardCell 1 of picked player <-- PlayerLevel
  	If PlayerLevel > 6 then
  		Assign to BoardCell 2 of picked player <-- PlayerLevel - 5
  	End If
  

The board refreshing worked well until the player reached lvl 6. When the level was reached it netsplitted the levelled player.

To fix the problem i changed the code with this:

Code:
   Take all players and for each player:
   	Assign to BoardCell 1 of picked player <-- PlayerLevel
   	If PlayerLevel > 6 then
   		Assign to BoardCell 2 of picked player <-- PlayerLevel - 5
  	Else
   		Assign to BoardCell 2 of picked player <-- "-"
   	End If
   

I don't really understand why this gave netsplit... maybe each client should run the same script and execute the same commands (even with different values).
01-21-2005, 02:06 PM#7
iNfraNe
Code:
function CinematicFadePlayer takes integer fadetype, real duration, string tex, real red, real green, real blue, real transparency, player p returns nothing
  local real trans
  if p == GetLocalPlayer() then
    set trans = transparency
  else
    set trans = 100  //invisible fade for other players
  endif
  CinematicFadeBJ(fadetype, duration, tex, red, green, blue, trans) 
endfunction
01-21-2005, 08:34 PM#8
Tommi
It works!!! Thanks toot!
01-21-2005, 09:13 PM#9
Anitarf
I have been looking for a solution to this problem myself. I found a thread that listed some functions that cause and some that don't cause server splits. Interestingly, in that thread, the basic fade filter action was listed that it causes the split, however, the "advanced fade filter" GUI action was said not to cause server splits when ised in an getlocalplayer if sentence. I used this solution, however, my map remains untested in multiplayer, so I can't know if it works, that's why I'm checking here now, have you tried the advanced fade filter function?
01-21-2005, 10:34 PM#10
Tommi
Nope, but I got this one working already.
01-22-2005, 01:29 AM#11
Anitarf
Yeah, I just tested mine and it works too :)
01-22-2005, 09:13 AM#12
Tommi
Good to know.