1. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  2. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  3. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice

GetLocalPlayer() faq

Discussion in 'World Editor Help Zone' started by shadowvzs, Oct 30, 2012.

  1. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    [FAQ] GetLocalPlayer()

    since dont see any thread what explain and give example what allowed and what make desync, i thought i open 1.

    if it is completed i want make it like a tutorial or guide or something what usefull to everybody who never used this function on multiplayer maps, so please help me with answers or how to hint how to fix it and few suggestions also welcome.

    - why usefull the the GetLocalPlayer() function?
    - because have few thing in warcraft 3 editor, what applied to all player, example multiboard, if you show multiboard then it is visible to every player, you can't show different multiboard to each player without GetLocalPlayer() function

    i list few thing:

    1. Fade filters for 1 player only

    Question - this cause desyncronization?
    Answer - No - Credit to PurgeandFire111 http://www.hiveworkshop.com/forums/cinematics-268/tips-tricks-cinema-39854/#F
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test1 as An exact match
      • Conditions
      • Actions
        • Set TempForce = (All allies of Player 1 (Red))
        • Set AlphaReal = 100
        • Custom script: if IsPlayerInForce(GetLocalPlayer(),udg_TempForce) then
        • Set AlphaReal = 0
        • Custom script: endif
        • Cinematic - Fade out and back in over 2.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with AlphaReal transparency




    2. Quest for 1 player only?

    Question - this cause desyncronization?
    Answer - Yes but if u use Enable/Disable quest then No
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Quest - Create a Required quest titled Quest 1 - Killing q... with the description long long descripti..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
        • Quest - Disable (Last created quest)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Quest - Enable (Last created quest)
        • Quest - Flash the quest dialog button
        • Custom script: endif




    3. Special effects, visibile for 1 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Set Unit = Peasant 0000 <gen>
        • Set Point = (Position of Unit)
        • Set String = <Empty String>
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Set String = Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
        • Custom script: endif
        • Special Effect - Create a special effect at Point using String
        • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation(udg_Point)




    4. Special effects attachment to unit, visibile for 1 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Set Unit = Peasant 0000 <gen>
        • Set String = <Empty String>
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Set String = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
        • Custom script: endif
        • Special Effect - Create a special effect attached to the overhead of Unit using String




    5. Create floating texts/or show for 1 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Set Unit = Peasant 0000 <gen>
        • Set Point = (Position of Unit)
        • Set String = <Empty String>
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Set String = TEXT-TEXT-TEXT-TEXT
        • Custom script: endif
        • Floating Text - Create floating text that reads String at Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
        • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
        • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        • Custom script: call RemoveLocation(udg_Point)




    6. Unit color, transparancy, size/scale for 1 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Set Unit = Peasant 0000 <gen>
        • Set Alpha = 100
        • Custom script: if GetLocalPlayer() == udg_Player then
          • Set Alpha = 0
        • Custom script: endif
        • Animation - Change Unit's vertex coloring to (100%, 100%, 100%) with Alpha transparency




    7. Fog of war and black mask, color, visibile for 1 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Visibility - Disable fog of war
        • Visibility - Disable black mask
        • Custom script: endif




    8. Images, visibile for 1 player only?

    Question - this cause desyncronization?
    Answer - No
    Alternative methode - If you set locally the transparency to 0 and to others 100% the transparency then that also dont cause desync tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Set String = <Empty String>
        • Set Point = (Target of current camera view)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Set String = ReplaceableTextures\Splats\AuraRune9b.blp
        • Custom script: endif
        • Image - Create an image using String of size 256.00 at Point with Z offset 0.00 using image type Indicator
        • Custom script: call RemoveLocation(udg_Point)





    9. Sound & music, for 1 player only?

    Question - this cause desyncronization?
    Answer - i dont really was able to test it
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Sound - Play (Last played music)
        • Custom script: endif




    10. Show Multiboard, for 1 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Multiboard - Create a multiboard with 1 columns and 2 rows, titled Multiboard
        • Multiboard - Hide (Last created multiboard)
        • Set Player = (Triggering player)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Multiboard - Show (Last created multiboard)
        • Custom script: endif




    11. Trackables, for 1-2 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    jass

    Code (vJASS):

    function Trig_Test_2_Actions takes nothing returns nothing
        local trackable t1 // Player 1's trackable
        local trackable t2 // Player 2's trackable
        local string peasant = "units\\human\\Peasant\\Peasant.mdl"
        local string invisible = ""
        local string path = invisible

        if ( GetLocalPlayer() == Player(0) ) then
            set path = peasant
        endif
        set t1 = CreateTrackable(path, -500, 0, 0)

        set path = invisible
        if ( GetLocalPlayer() == Player(1) ) then
            set path = peasant
        endif
        set t2 = CreateTrackable(path, -500, 0, 0)

        call SetHandleInt(t1, "player", 0) // Store which player "owns" this trackable
        call SetHandleInt(t2, "player", 1) // Same for player 2
    endfunction

    //===========================================================================
    function InitTrig_Test_2 takes nothing returns nothing
        set gg_trg_Test_2 = CreateTrigger(  )
        call TriggerRegisterPlayerChatEvent( gg_trg_Test_2, Player(0), "test", true )
        call TriggerAddAction( gg_trg_Test_2, function Trig_Test_2_Actions )
    endfunction
     




    12. Pause the game, for 1 player only?

    Question - this cause desyncronization?
    Answer - Yes
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Game - Pause the game
        • Custom script: endif





    13. Create different unit for player?

    Question - this cause desyncronization?
    Answer - Yes
    Note - It might not desync if (1) it is a non hero unit and (2) the two units have only differences in art fields/physical display (such as model or icon) - by PurgeandFire111
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set UnitType1 = No unit-type
        • Set UnitType2 = Peasant
        • Set UnitType3 = UnitType1
        • Set Point = (Target of current camera view)
        • Set Player = (Triggering player)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Set UnitType3 = UnitType2
        • Custom script: endif
        • Unit - Create 1 UnitType3 for Player at Point facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_Point)




    14. Weather effect off for 1 player?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Heavy)
        • Environment - Turn (Last created weather effect) On
        • Set Player = (Triggering player)
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Environment - Turn (Last created weather effect) Off
        • Custom script: endif





    15. Desctructible visibility, for 1 player only?

    Question - this cause desyncronization?
    Answer - No - tested myself
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Set Tree = Summer Tree Wall 0000 <gen>
        • Set Boolean = False
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Set Boolean = True
        • Custom script: endif
        • Custom script: call ShowDestructable(udg_Tree, udg_Boolean)



    16. Unit positioning, for 1 player only?

    Question - this cause desyncronization?
    Answer - No - until unit dont got select hero/unit ability or got collision so this is usefull for visualization, only used for visual effects
    trigger

    • Test 1
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Set Player = (Triggering player)
        • Set Unit = Paladin001
        • Set X = 500
        • Set Y = 500
        • Custom script: if GetLocalPlayer() == udg_Player then
        • Set X = 100
        • Set Y = 100
        • Custom script: endif
        • Custom script: call SetUnitPosition(udg_Unit, udg_X, udg_Y)

     
    Last edited: Dec 28, 2012
  2. Tirlititi

    Tirlititi

    Joined:
    Jul 11, 2010
    Messages:
    396
    Resources:
    12
    Models:
    6
    Maps:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    12
    Don't know how you tested wether it desyncs or not, but you're wrong in both case :p.

    This one desync because it creates and destroys timers. So you can't put those actions in a local block. It is still possible to make it in jass using the natives directly, though.

    I am not sure it doesn't desync but I highly doubt it does. Several maps have a feature for using a local weather effect and this action is directly a native.

    Otherwise, I don't see why you list all the actions possible and say if it desyncs or not. You should better list only the safe non-desyncing actions, no?

    There are other things to say about your post (you can create/destroy texttags locally, you have put a "ShowUnit" in the last trigger, pausing game and disabling fog/mask locally will desync but you have other actions for that...).

    Well, it still can come in handy. Good luck for that.
     
  3. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,855
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    1 - answered
    2 - probably yes
    3 - no
    4 - no
    5 - no
    6 - possibly but not sure
    6 fog - most likely no
    7 - dunno but maybe no
    8 - dunno
    9 - wont desync, dota uses the same
    10 - 0 experiences with trackables so dunno
    11 - that most likely would smack your face to lobby(most likely yes)
    12 - maybe no because you create the handle differently but it may desync upon interacing with the unit
    13 - dunno
    14 - should be possible so most likely no

    Dangerous code within local code is mostly only when creating handles but things like pause game within local block may cause desync.

    Those answers are not like I tested it :D just from looking at code so it may change when someone who actually tested it comes here
     
  4. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    i changed the the numbers because i noticed have 2x 6. :D so ty every reply, and i am glad if i get more reply too if somebody tryed it, where still have "?"

    @Tirlititi, right, i can list only what not desync but still hopeing maybe have solution for make it non desync. trigger
    @about floating text, ok if i create it locally but still that visible to other players, no? lets say i want hide that floating text what is not visible to other players (point is fogger or black masked), how to do that?
    @about filter, do you mean to this?
    @what action have for replacing the fog/mask, show&hide unit thing? coz if i know make it transparent or add invisible ability with getlocalplayer also desync no?
    Code (vJASS):

    function CinematicFadeCommonBJ takes real red, real green, real blue, real duration, string tex, real startTrans, real endTrans returns nothing
        if (duration == 0) then
            // If the fade is instant, use the same starting and ending values,
            // so that we effectively do a set rather than a fade.
            set startTrans = endTrans
        endif
        call EnableUserUI(false)
        call SetCineFilterTexture(tex)
        call SetCineFilterBlendMode(BLEND_MODE_BLEND)
        call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterEndUV(0, 0, 1, 1)
        call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-startTrans))
        call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-endTrans))
        call SetCineFilterDuration(duration)
        call DisplayCineFilter(true)
     
  5. Tirlititi

    Tirlititi

    Joined:
    Jul 11, 2010
    Messages:
    396
    Resources:
    12
    Models:
    6
    Maps:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    12
    For texttags : your method works without any flaw, but creating texttags locally has an additional purpose. You know that you can't create more than 100 texttags, right? Well then you create and destroy them locally, you will be able to use 100 texttags per player.

    For cinematic filters, the GUI's action is not this but that :
    code
    Code (vJASS):
    function CinematicFadeBJ takes integer fadetype, real duration, string tex, real red, real green, real blue, real trans returns nothing
        if (fadetype == bj_CINEFADETYPE_FADEOUT) then
            // Fade out to the requested color.
            call AbortCinematicFadeBJ()
            call CinematicFadeCommonBJ(red, green, blue, duration, tex, 100, trans)
        elseif (fadetype == bj_CINEFADETYPE_FADEIN) then
            // Fade in from the requested color.
            call AbortCinematicFadeBJ()
            call CinematicFadeCommonBJ(red, green, blue, duration, tex, trans, 100)
            call FinishCinematicFadeAfterBJ(duration)
        elseif (fadetype == bj_CINEFADETYPE_FADEOUTIN) then
            // Fade out to the requested color, and then fade back in from it.
            if (duration > 0) then
                call AbortCinematicFadeBJ()
                call CinematicFadeCommonBJ(red, green, blue, duration * 0.5, tex, 100, trans)
                call ContinueCinematicFadeAfterBJ(duration * 0.5, red, green, blue, trans, tex)
                call FinishCinematicFadeAfterBJ(duration)
            endif
        else
            // Unrecognized fadetype - ignore the request.
        endif
    endfunction

    There are several problems for using the natives. I didn't see any ressource in the jass section for that but I guess it would be good to make one (unless there is in wc3c or anywhere else).

    The show/hide unit will desync in most case (there are some specific cases in which it can be used and usefull, though, there are threads about it). But I wanted to point out the fact you're using a "ShowUnit" in your trigger about "Show Destructables". The fog mask can be replaced with the action :
    • Visibility - Create Visibility Modifier Region

    which has a similar purpose.

    I think the answers would be more like :
    1. Desync the way it is written
    2. Desync the way it is written (use "Enable/Disable Quest" instead)
    3. No desync
    4. No desync
    5. No desync but there is a better way to do it
    6. Only Show/Hide desyncs
    7. Desync the way it is written
    8. No desync
    9. No desync in most cases
    10. No desync
    11. EDIT: no, I don't think it desyncs, actually. That's a thing to check.
    12. Desync
    13. Desync
    14. No desync in my opinion
    15. Dunno but I think I've recently read it didn't desync. I guess it all depends on wether the pathing is preserved or not.
     
  6. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    @unit show hide, i dont really got any thread where usefull and dont make desync :/
    also watched somewhere a Full screen Shop (via destructibles) and for make space on map, at map init the destructibles are hided, i just curios really if show/hideing destructibles, i can make somehow for dont desync?

    2. if i enable/disable quest in GetLocalPlayer if, then it dont make desync and also will be visible or hidden to others? (so its same like when i disable a ability then look like not exist, if i disable the quest then quest will be "removed" from quest list?)

    also Flash the quest button dont make desync right? :D
    (updated the 2.)
    5. i never heard about that 100 text limit, if we talk lets say about a damage detection system where after every damage created 4 floating text then not hard to make too many floating text, what happen if will be too many ft? lagg or simple dont created the next ft after the 100th?
    u can tell me more... if i use text tag with velocity and lifespan, still i must destroy it each time?
    6. unit color/tranparency [animation - vertex color] also desync?

    @more about floating text

    i write out the damages in DDS with this function
    Code (vJASS):


    function FT_Ex takes string txt, real fsize, unit u, integer speed, integer red, integer green, integer blue, integer alpha, integer dir returns nothing
        local real x
        local real y
        local real diff
        local texttag tt
        if IsUnitVisible(u, GetLocalPlayer()) then
        set x = GetUnitX( u )
        set y = GetUnitY( u )
            set diff = StringLength( txt ) * fsize / 2.00 + 1
            set tt = CreateTextTag( )
            call SetTextTagText( tt, txt, fsize * 0.023 )
            call SetTextTagPos( tt, x - diff, y, 100.00 )
            call SetTextTagColor( tt, red, green, blue, alpha )
            call SetTextTagPermanent( tt, false )
            call SetTextTagLifespan( tt, 4.50 )
            call SetTextTagFadepoint( tt, 2.50 )
            set x = speed * 0.71 / 128
            call SetTextTagVelocity( tt, x * Cos( dir * bj_DEGTORAD ), x * Sin( dir * bj_DEGTORAD ) )
            set tt = null
        endif
    endfunction
     

    i moved few thing inside the if coz i thought this way will be faster coz if point not visible to localplayer then dont need to calculate numbers etc, how can i improve it? or i must move out everything outside and in if i set only the string value and if point is invisible then i show empty string to local player?
     
  7. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,420
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    1. You can check this out:
    http://www.hiveworkshop.com/forums/cinematics-268/tips-tricks-cinema-39854/#F

    Yes it will be hidden to others. And no, the flash quest button does not desync.

    Btw, change the "Disable Quest" within the GetLocalPlayer() block in your example to "Enable Quest". Otherwise it is only disabling it.

    Er if I remember correctly there will be some handle stack problems. So basically you will lose reference to certain objects because there will end up being texttags under the same ID. Something along those lines, I don't remember exactly.

    But you can create texttags directly within a local player block. They are allocated on a separate handle stack. While we are unsure whether that is the exact cause of it being desync-safe, we know that it is a characteristic of the few types that are desync-safe.

    No. But I believe the shadow will still show up and the unit will be selectable.

    You can create it safely inside the block. All the operations you performed are desync-safe, so it is fine the way it is.

    For 11: It won't desync. Check out:
    http://www.hiveworkshop.com/forums/jass-resources-412/system-track-205760/
    That method that you've described is essentially the method I use and I've tested it to work online.

    For 13: It might not desync if (1) it is a non hero unit and (2) the two units have only differences in art fields/physical display (such as model or icon)

    It would be something to test. Someone made a function for it a while back and said the circumstances in which it works.

    For 15: I am pretty sure it is just a matter of pathing as Tirlitti said. It definitely won't desync right away. In fact, you can just move the ShowDestructable into the block. (no need for boolean variable) I've tried it with destructables for full screen systems and it works 100% but for destructables with pathing idk. I haven't tried it.
     
  8. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    1. quest, ok i need enable disable for be the trigger desync safe but what if i want change the quest description/type/name etc?
    i mean if have a multiplayer map, 4 player exist, 2 st pick the quest and appear the quest at quest button (so player 3/4 dont see it because disabled for them), but if player 1 kill a mob and i change the q description or mark quest to be completed then it is also changed to player 2 too even he only started, so what player 1 doing will be effected to player 2 quest and invers...
    i must do quest array then and disable if player(i=1 to 11) != TriggerPlayer()?

    2. destructible show/hide
    so if i want make the full screen equipment system with destructables and show hide, then i must create example every destructable with weapon model and show only the equiped weapon/destructable type, somehow like this?
    (pathing mean destructible with collision/path blocking or the raw code when i create one?)

    • Map Initialization
      • Events
        • Map initialization
      • Conditions
      • Actions
        • For each (Integer A) from 1 to (Random integer number between 7 and 13), do (Actions)
          • Loop - Actions
            • Set Point = (Random point in Region 000 <gen>)
            • Destructible - Create a Summer Tree Wall at Point facing (Random angle) with scale 1.00 and variation 0
            • Set Tree1_Index = (Tree1_Index + 1)
            • Set Tree1[Tree1_Index] = (Last created destructible)
            • Custom script: call RemoveLocation(udg_Point)
            • Destructible - Hide (Last created destructible)
        • For each (Integer A) from 1 to (Random integer number between 7 and 13), do (Actions)
          • Loop - Actions
            • Set Point = (Random point in Region 000 <gen>)
            • Destructible - Create a Barrens Tree Wall at Point facing (Random angle) with scale 1.00 and variation 0
            • Set Tree2_Index = (Tree2_Index + 1)
            • Set Tree2[Tree2_Index] = (Last created destructible)
            • Custom script: call RemoveLocation(udg_Point)
            • Destructible - Hide (Last created destructible)



    y, u told dont need the boolean but still dont changed on the presentation/test map
    Code (vJASS):

    function Trig_Hide_trees_Actions takes nothing returns nothing
        local boolean b1 = true
        local boolean b2 = false
        local boolean b = b2
        local integer i
        local integer a
        local player p1 = Player(0)
        local player p2 = Player(1)

        set i = 1
        loop
            exitwhen i == udg_Tree1_Index
            if GetLocalPlayer() == p1 then
                set b = b1
            endif
            call ShowDestructable(udg_Tree1[i], b)
            set i = i + 1
        endloop
        set b = b2
        set i = 1
        loop
            exitwhen i == udg_Tree2_Index
            if GetLocalPlayer() == p2 then
                set b = b1
            endif
            call ShowDestructable(udg_Tree2[i], b)
            set i = i + 1
        endloop
    endfunction

    //===========================================================================
    function InitTrig_Hide_trees takes nothing returns nothing
        set gg_trg_Hide_trees = CreateTrigger( )
        call TriggerRegisterTimerEventSingle( gg_trg_Hide_trees, 0.50 )
        call TriggerAddAction( gg_trg_Hide_trees, function Trig_Hide_trees_Actions )
    endfunction
     


    3. floating text, what i wrote is desync safe, right?
    so if i put inside the getlocalplayer if the function call what call that function what i wrote, that also desync safe right? (like call FT ( "+" + I2S(i) + " gold", 1.5, u, 6, 255, 255, 0, 200)), because example i dont want show the text to other player than trigger player
     

    Attached Files:

  9. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    It's good to try something like that, but theories are theories, practice is practice.
    I mean you need to test all the codes before valid them, else this thread just doesn't worth it.
     
  10. Karassu

    Karassu

    Joined:
    Jun 15, 2011
    Messages:
    222
    Resources:
    0
    Resources:
    0
    Wow, This is... awesome.
     
    Last edited: Oct 31, 2012
  11. Hashjie

    Hashjie

    Joined:
    Apr 20, 2009
    Messages:
    1,515
    Resources:
    0
    Resources:
    0
    I don't like your sarcasm.
    Where are your test results on desynchronization?
    Don't mock someone for trying to contribute to society.

    This thread is useful IMO.
    And I seriously hope that there will be a full documentation of test results on desync's some day (including explenations).
    +rep to shadowvzs for his results so far.
     
  12. Karassu

    Karassu

    Joined:
    Jun 15, 2011
    Messages:
    222
    Resources:
    0
    Resources:
    0
    I don't like your sarcasm.
    Where are your test results on desynchronization?
    Don't mock someone for trying to contribute to society.

    Oh, I never meant to be sarcastic... But if it looked like that, then I apologize, I will never cough again (cough!) oops :thumbs_up:

    Anyway, I turned back the time to change my first reply, it is now "smile" "smile". (I don't know how it looked like sarcastic, really)
     
  13. Hashjie

    Hashjie

    Joined:
    Apr 20, 2009
    Messages:
    1,515
    Resources:
    0
    Resources:
    0
    If it's not sarcasm, then what is the intention of coughing in the first place (or smiling) in this case?
    Sorry for going off-topic I'll stop posting after this.
     
  14. Karassu

    Karassu

    Joined:
    Jun 15, 2011
    Messages:
    222
    Resources:
    0
    Resources:
    0
    If it's not sarcasm, then what is the intention of coughing in the first place (or smiling) in this case?
    Sorry for going off-topic I'll stop posting after this.

    It's just my (cough!) style! And I swear to you, to everyone in here, and to the almighty king Arthas and that sexy Sorceress, I'm not trying to be sarcastic... I turned the time back again and edited my first post (I removed the "cough and smile" for you, if that'll make you happy)... Yeah you're right, this is off-topic now (cough!)... Gotta stop (cough!) sending replies now...

    About the Local Player test result, I already made one for myself, the SFX attachment visible to certain players only... I did it because of the curiousity, after seeing it in DotA (the Gem of True Sight's magic sentry effect)
     
  15. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    useing getlocalplayer like array index also dont desync, right?

    i mean to this
    Code (vJASS):

    //Camera_Lock = boolean variable array
      if not udg_Camera_Lock[GetPlayerId(GetLocalPlayer())+1] then
        call ShowDestructable(d, false)
      endif
     
     
  16. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,420
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    No, that does not desync.
     
  17. mysteriis

    mysteriis

    Joined:
    May 2, 2011
    Messages:
    39
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Creating images locally do not desync, but what about if they are already created and I want to change their "show/hide" property? For example, if I want an image created only for player 1 to be seen by player 2 for a short period, and later make it appear only for player 1 again? What about if they're always moving all over the map like lifebars? Changes anything?
     
  18. gorillabull

    gorillabull

    Joined:
    Jul 17, 2011
    Messages:
    1,368
    Resources:
    2
    Spells:
    2
    Resources:
    2
    there are a few tutorials on this actually but this has more content, visibility should not be set like that because its for a group of players which can contain only one player, in other words visibility is local
     
  19. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    i am curious too to something like this, coz i can hide a interface from doodas but remain the image there, so need solution for enable/disable it if possible, because could be better than recreate allways 12 (1 image for 1 player)
     
  20. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2