1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

GetLocalPlayer

Discussion in 'Trigger (GUI) Editor Tutorials' started by Chaosy, Nov 17, 2012.

  1. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,626
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    ok, added a few "NOTICE!" wich will help the reader

    edit;
    list

     
    Last edited: Nov 20, 2012
  2. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    That will hardly help, i guess that yourself don't understand your notice.

    EDIT :

    Ok there are several notices, i just saw this one :

     
  3. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,626
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    I know they are not very helpful but useful in some cases

    edit, yay 1100 posts :)
     
  4. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    uhm,

    this:
    • Custom script: set udg_Player = GetLocalPlayer()
    • Custom script: if GetLocalPlayer() == Player(0) then
    • Set Effect = Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
    • Custom script: endif


    should be
    • Custom script: if GetLocalPlayer() == Player(0) then
    • Set Effect = Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
    • Custom script: endif


    because udg_Player was never used
     
  5. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,626
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    How stupid of me, thanks
     
  6. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    It does not.

    Code (vJASS):
    function DisplayTextToForce takes force toForce, string message returns nothing
        if (IsPlayerInForce(GetLocalPlayer(), toForce)) then
            // Use only local code (no net traffic) within this block to avoid desyncs.
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, message)
        endif
    endfunction


    Yes, opening new threads locally does desync. I think it takes a new id in the shared handle stack. You should be able to do something like

    Code (vJASS):
    if localBoolean then
        call ForForce(f, function a)
    else
        call ForForce(f, function b)
    endif


    though
     
  7. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    You can hide items locally:
    • Hide Item
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Custom script: if GetLocalPlayer() == Player(0) then
        • Item - Hide Claws of Attack +15 0000 <gen>
        • Item - Hide Claws of Attack +15 0001 <gen>
        • Custom script: endif
     
  8. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,426
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Are you sure that won't desync when the player that can see it picks it up? Or even pathing? Generally widgets are a bit troublesome with GetLocalPlayer() due to the player interactions.
     
  9. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    I'm going to test other known desyncs with the kLoader program to see if I can get a desync even if both instances are on the same PC, then I'll go ahead and test this for desync. In the initial test, though, it worked fine.

    EDIT: So it works - you can test desyncs on one PCs.

    http://www.hiveworkshop.com/forums/...multiple-warcraft-3-running-single-pc-226287/

    EDIT2: Did some more tests.

    Terrain deformation - temporary/permanent - desyncs
    Pause day/night cycle - desyncs
    Lightning effect - desyncs immediately
    Animation - does not desync
    Change terrain type - desyncs

    EDIT3: Custom lights.

    • test
      • Events
        • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Conditions
      • Actions
        • Custom script: if GetLocalPlayer() == Player(0) then
        • Custom script: call SetDayNightModels("","")
        • Custom script: endif


    Doesn't desync.
     
    Last edited: Nov 29, 2012
  10. frettory

    frettory

    Joined:
    Jan 19, 2012
    Messages:
    51
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Why are you using so many custom scripts in this GUI tutorial?
     
  11. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    maybe because GetLocalPlayer() does not exist in the GUI selection...
     
  12. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Just do

    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Custom script: set udg_LocalPlayer = GetLocalPlayer()


    so you can refer to the local player via the GUI variable (create player variable "LocalPlayer" in GUI), therefore do not need more jass lines or expressions.
     
  13. frettory

    frettory

    Joined:
    Jan 19, 2012
    Messages:
    51
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    But if GetLocalPlayer does not exist in the GUI section, what is this tutorial doing in the GUI section?
     
  14. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    you see, I said "selection" not "section", better read carefully mate...

    When I say GUI selection, I mean the drop down list that appears when you click Add Action, surely you don't see GetLocalPlayer() there...

    Also, Custom script action is a part of GUI you know... So basically, this tutorial is still a GUI tutorial...

    I think that is easy to understand eh?
     
  15. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,626
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    I will try to explain, GUI is a slower version of JASS. In GUI you can't use GetLocalPlayer if you dont use JASS within the GUI, The tutorial is to meant to show how to use the GetLocalPlayer for GUI users and is clearly focused on GUI not JASS
     
  16. frettory

    frettory

    Joined:
    Jan 19, 2012
    Messages:
    51
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    If this is so, wouldn't a more useful tutorial be "How and when to use a custom script"?
     
  17. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    this tutorial is a really useful one assuming you realize how many things you can do with the GetLocalPlayer() thingy...

    Making a how and when to use a CS is as simple as this one:

    Also, that is a pretty basic triggering concept... So it's not really a good idea to make a whole tutorial for that... And I believe that it is already (or should be) a part of the basic triggering tutorials here instead...

    Have some experience before suggesting will be better for you...
     
  18. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,626
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    Its not ANY custom script anyone can add asnd it reads your mind. Its about how to use GetLocalPlaye.
    Edit: how are you allways faster lol
     
  19. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    Only during weekends maybe... I don't have internet connection at the dorm and I don't really like going to net cafes just to browse for a while... XD...
     
  20. frettory

    frettory

    Joined:
    Jan 19, 2012
    Messages:
    51
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Doesn't this tutorial exist in the JASS section, then?

    Still, how is this GUI?