• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

GetLocalPlayer

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182

GetLocalPlayer

By Chaosy





Introduction

I made this tutorial since I think way to few people know that this exist in GUI, so I want to show you how to use "GetLocalPlayer" in GUI.​



What is needed?

  • Decent knowlege of GUI triggering
  • Very basic jass knowledge
  • A few moments of your time



What is GetLocalPlayer?


GetLocalPlayer is a method to create certain things/stuff in JASS, but I will show you how to use this method in the GUI.​
This method will allow you to create this thing/stuff [special effects, multiboards, floating text, etc] for the player of your choice only.​
For example, you can show a multiboard to player 1 only, while the other player wont see any multiboard at all!​


That sounds awesome how do I use this?

As one example I will create a multiboard for player 1 only, you can use any event you want.​
I will show you 3 ways to do it, tho you should use the recommended one since you use less memory that way.​


NOTICE! We use a player variable named "GetLocalPlayer" or "Player" based on which way you want to use​


  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_GetLocalPlayer = GetLocalPlayer()
  • Multiboard for one player
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 1 columns and 1 rows, titled hellu
      • Multiboard - Hide (Last created multiboard)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 1 (Red)
        • Then - Actions
          • Multiboard - Show (Last created multiboard)
        • Else - Actions


  • Multiboard for one player jass
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 1 columns and 1 rows, titled hellu
      • Multiboard - Hide (Last created multiboard)
      • Custom script: if GetLocalPlayer() == Player(0) then
      • Multiboard - Show (Last created multiboard)
      • Custom script: endif


  • Multiboard for one player
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 1 columns and 1 rows, titled hellu
      • Multiboard - Hide (Last created multiboard)
      • Custom script: set udg_Player = GetLocalPlayer()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player Equal to Player 1 (Red)
        • Then - Actions
          • Multiboard - Show (Last created multiboard)
        • Else - Actions

Now I will go through the trigger

First we create a multiboard just edit it as you want
  • Multiboard - Create a multiboard with 1 columns and 1 rows, titled hellu
after that we instantly hide it so no player never saw that multiboard
  • Multiboard - Hide (Last created multiboard)
Now the the hard part, now we use a custom script since the action does not exist within the GUI. It stores the player returned from the GetLocalPlayer() function inside your player variable.
  • Custom script: set udg_Player = GetLocalPlayer()
And lastly we just select wich players we want it to be showed to, in this case it will ONLY be showed to player red (1) aint that awesome?
NOTICE! The jass and the GUI version is just the same you can use any of them!
NOTICE! In jass the player index is between in 0-11 insted of 1-12 in GUI
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Player Equal to Player 1 (Red)
    • Then - Actions
      • Multiboard - Show (Last created multiboard)
    • Else - Actions
  • Custom script: if GetLocalPlayer() == Player(0) then
  • Multiboard - Show (Last created multiboard)
  • Custom script: endif



Great, but can I do the same to other things?

Yes you really can, lets take special effects.

  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_GetLocalPlayer = GetLocalPlayer()
  • special effect trollbrain way
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set Effect = <Empty String>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 1 (Red)
        • Then - Actions
          • Set Effect = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
        • Else - Actions
      • Special Effect - Create a special effect attached to the overhead of Peasant 0001 <gen> using Effect


  • Special effect for one player jass
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Right Arrow key
    • Conditions
    • Actions
      • Set Effect = <Empty String>
      • Custom script: set udg_Player = GetLocalPlayer()
      • Custom script: if GetLocalPlayer() == Player(0) then
      • Set Effect = Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
      • Custom script: endif
      • Special Effect - Create a special effect attached to the overhead of Peasant 0001 <gen> using Effect


  • Special effect for one player
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set Effect = <Empty String>
      • Custom script: set udg_Player = GetLocalPlayer()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player Equal to Player 1 (Red)
        • Then - Actions
          • Set Effect = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
        • Else - Actions
      • Special Effect - Create a special effect attached to the overhead of Peasant 0001 <gen> using Effect


As you see I use the same system, but I will explain the new actions for you anyway.

Here I simply store a string variable into nothing, this means if the player aint the player I want it to be there wont be any effect. (you will see later)
  • Set Effect = <Empty String>
Here We check if the player is player red (1) and then we set the string variable to the question mark effect path.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Player Equal to Player 1 (Red)
    • Then - Actions
      • Set Effect = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
    • Else - Actions
And after that we create the effect simple as that.
  • Special Effect - Create a special effect attached to the overhead of Peasant 0001 <gen> using Effect

Desyncronization

Desyncronization only exist in multiplayer due you need both a host and a client to make this happen, it causes clients playing the map do disconnect from the game. Thats why you must keep this in mind, if possible do only use the GetLocalPlayer in conditions.​
So if it does desync do NOT use it, if it does not desync you can just enjoy the game.​
NOTICE! Handles that have their own stack will never desync!​


1. Fade filters for 1 player only

Question
- this cause desyncronization?
Answer - No, but you have to locally set the alpha (transparency) rather than putting the fade filter in the "if" block.
Click this link for the technique.

2. Quest for 1 player only?

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


3. Special effects, visibile for 1 player only?

Question
- this cause desyncronization?
Answer - No


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

Question
- this cause desyncronization?
Answer - No



6. Unit visibility, color, visibile for 1 player only?

Question
- this cause desyncronization?
Answer - Yes but Vertex color dont desync


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

Question
- this cause desyncronization?
Answer - Yes


8. Images, visibile for 1 player only?

Question
- this cause desyncronization?
Answer - No


9. Sound & music, for 1 player only?

Question
- this cause desyncronization?
Answer - Mostly No


10. Show Multiboard, for 1 player only?

Question
- this cause desyncronization?
Answer - No



11. Trackables, for 1-2 player only?

Question
- this cause desyncronization?
Answer - No


12. Pause the game, for 1 player only?

Question
- this cause desyncronization?
Answer - Yes


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


14. Weather effect off for 1 player?

Question
- this cause desyncronization?
Answer - No?


15. Desctructible visibility, for 1 player only?

Question
- this cause desyncronization?
Answer - ?





Credits

Hashjie - Telling me info about GetLocalPlayer and the idea to this tutorial​
Troll-Brain - awesome tip to improve the tutorial​
 
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
Hmm, I think you should explain more about desynchronizations in detail.
People don't really know what this is or what it does. Same counts for GetLocalPlayer().
It's not really clear when you say:

GetLocalPlayer is a function in JASS wich allows you to make multiboards,floating texts, special effects and more.

There is a bit more truth to this part:

In other words things that are meant to be seen by every player, but with GetLocalPlayer you can make it be shown to one player only or maybe two players only.

But I think it's better to explain that GetLocalPlayer() is a function in Jass which returns a local player (which can be used to save it inside a variable like you are doing or by putting it in a condition).
This can then be used to create or display (depending on wether the handle has it's own counter) handles (objects) locally to a player. So that only 1 player can see it (local).
This explenation needs to be adjusted a bit but it would be more correct so to say.

Also, you might want to fix some of your grammar mistakes. I can see how some people might not be abled to understand what you are trying to say.

It basicly stores my player Variable into the GetLocalPlayer.
This is wrong. It stores the player returned from the GetLocalPlayer() function inside your player variable.

Furthermore, some things should probably be tested with other players before submitted.
For example: GetLocalPlayer returns a player which is set inside the global variable, however I'm not sure if this could potentially cause problems since GetLocalPlayer returns a (local) player...
If it does work you need to explain that setting GetLocalPlayer() to a global GUI variable does not mean that you can use that global variable inside GUI actions and that it should solely be used for conditions to check if a player equals the variable.

It might also be nice to tell people how you can check for desynchronizations?
For example commenting out/removing lines which might cause a desynch inside local blocks, displaying debug messages of handle ID's.

Maybe give an example of what happens to the handle ID's of floating texts and explain why?
 
GetLocalPlayer is a function in JASS wich allows you to make multiboards,floating texts, special effects and more.

--> I think you better say first what GetLocalPlayer actually does, and not go directly to the possibilities of its usage... because reading this, someone might think that GetLocalPlayer() does all those by default, when the fact is that they are only methods in which you can utilize what GetLocalPlayer() does...

also,

GetLocalPlayer makes "things" meant to be seen by every player, but with GetLocalPlayer you can make it be shown to one player only or maybe two players only.

--> The first statement says that GetLocalPlayer makes things meant to be seen by every player, then the second one says that it makes it shown to only a few... Here you will see that your two statements contradict each other... The first is false, first and foremost because GetLocalPlayer() doesn't make things...

it will better be off as:

GetLocalPlayer() allows you to make things [effects,variable data, etc] be created for a specific player/s only when utilized...
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
@Hashjie : There is nothing wrong to give different values to a global (or local) variable, you can even do this.

To make it even more "GUI", you just have to use a GUI player variable (variable editor) and set it on map initialization with a custom script.
Here i name this variable " Local_player "

set udg_Local_player = GetLocalPlayer()

And then you can use and if/then in GUI, you don't need more custom scripts.

But yeah of course, since its value will be different for each player's computer, you have to care on how you use it.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Yeah, you're right Troll-Brain, I wasn't really thinking clearly.
Setting it to a global variable will work just as good but people just need to be carefull using it correctly. I agree with you.

Also, chaosy just tested it with me and there are indeed no problems in using global GUI variables.

But I can imagine someone trying to create a floating text locally in GUI and then still getting desync's due to CreateTextTagLocBJ.
A friend of mine tested this and told me it desync'd. (might have something to do with bj_lastCreatedTextTag?) I'll create a test later on to check if he was correct.
If so text tags should be created locally through jass. Same thing counts for, for example SmartCameraPanBJ.
I'm just trying to say that using GetLocalPlayer() in a "GUI way" doesn't nessecarely mean that it will work just as well as when using jass.

Also, lots of BJ's already have a GetLocalPlayer() check so it's not needed for those.
 
Last edited:
Level 17
Joined
Apr 27, 2008
Messages
2,455
If/then in jass or GUI are the same, excepted that conditions of the if/then in GUI are done in other functions.
Which makes annoying the use of a local variable in GUI, you have to use a temp global variable if you want to use a local variable in a GUI if/then condition.
At least it's the case for the if/then multiple, i don't remember for the single one, but i should be the same.

Now, many and many GUI actions uses and eventually creates handles, such as locations, so ofc if you create an handle in a local block, then you will got a desync (excepted few types such as texttags).
Also some GUI functions leaks inherently, such as PolledWait.

So no it's not the fault of the if/then in GUI.

Finally i don't think that "lot of" GUI functions already use GetLocalPlayer(), but i could be wrong about this last one, it was several years ago that i used GUI ...
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
If/then in jass or GUI are the same, excepted that conditions of the if/then in GUI are done in other functions.
Which makes annoying the use of a local variable in GUI, you have to use a temp global variable if you want to use a local variable in a GUI if/then condition.
At least it's the case for the if/then multiple, i don't remember for the single one, but i should be the same.

Yes, this is indeed a disadvantage of using GUI.
In fact I've seen this lots of times before, ugly spagetti code created through lots of if/then's in GUI. But I don't really see your point being on this subject?

Now, many and many GUI actions uses and eventually creates handles, such as locations, so ofc if you create an handle in a local block, then you will got a desync (excepted few types such as texttags).

That's why I tryed to make a clear point to warn other users not to think that just by using a local block in GUI means they can make things work locally.
It's also the GUI actions eg BJ's they will have to be careful with.
Sometimes a BJ simply contains code that will not work in local blocks (code such as creating handles) when done in GUI but will work when using the non BJ version through jass.

Also some GUI functions leaks inherently, such as PolledWait.
I didn't know about this, thanks! Do you perhaps have any refference on this subject?
I would like to know how this was discovered. I'll search for it myself in the meanwhile, I suppose it's got somethng to do with the TSA's?

So no it's not the fault of the if/then in GUI.

I never said it was did I?

Finally i don't think that "lot of" GUI functions already use GetLocalPlayer(), but i could be wrong about this last one, it was several years ago that i used GUI ...

I thought there where quite some BJ's which use local blocks but I'm not entirely sure about that. Plus the fact that "lot of" is not really a measurement. Perhaps I find 2 functions a lot already ;)
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
How about putting generic sounds in local to happen only to a few players? I know it doesn't cause instant desync, but I suspect it sometimes causes players to desync. I'm right? Or is it host bot related?

Otherwise I use only multiboards and texts in local
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
How about putting generic sounds in local to happen only to a few players? I know it doesn't cause instant desync, but I suspect it sometimes causes players to desync. I'm right? Or is it host bot related?

Otherwise I use only multiboards and texts in local

You mean create or play ?

I don't know about create but play should be fine.
Anyway it's already local, since a sound is not played if you have turned off the sound in the wc3 menu, and some other cases such as if wc3 is minimized or not.

@Hashjie :

Well, it's just because the way you said it, the desync was coz of the GUI if, that's why i made it clear it was not.
The local thing was just a bonus, as i like to be accurate, but yeah that's off-topic.

I didn't know about this, thanks! Do you perhaps have any refference on this subject?
blizzard.j :xxd:

I would like to know how this was discovered. I'll search for it myself in the meanwhile, I suppose it's got somethng to do with the TSA's?
No it's because it destroys a timer but not null the local variable -> handle id leak
Well, i've seen it myself but anyway the leak might has been discovered just by browsing blizzard.j

And leak or not using a TSA or a timer in a local code should desync by itself.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
You mean create or play ?

I don't know about create but play should be fine.
Anyway it's already local, since a sound is not played if you have turned off the sound in the wc3 menu, and some other cases such as if wc3 is minimized or not.

@Hashjie :

Well, it just because the way you said it, the desync was coz of the GUI if, that's why i made it clear it was not.
The local thing was just a bonus, as i like to be accurate, but yeah that's off-topic.

blizzard.j :xxd:

No it's because it destroys a timer but not null the local variable -> handle id leak
Well, i've seen it myself but anyway the leak might has been discovered just by browsing blizzard.j

Ah, how stupid of me xD I haven't really looked that much inside blizzard.j tbh I think I'll go through the entire thing some time.

EDIT: Yet another fail of me, I totally forgot that blizzard.j is integrated in the function list of JNGP.


@TKF:

There is a BJ that does the following:

JASS:
function StartSoundForPlayerBJ takes player whichPlayer, sound soundHandle returns nothing
    if (whichPlayer == GetLocalPlayer()) then
        call StartSound(soundHandle)
    endif
endfunction

So yeah I guess that you can start a sound locally but need to create the handle globally.
(Remember not to use a BJ if it's not nessecary, it's yet another function call for something that can be done directly instead.)
 
Last edited:

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Remaining time for WarningTimer[1]) Less than or equal to 0.00
    • Then - Actions
      • Set Temp_Group3 = (Units in Cruiser 2 Interior <gen>((Unit-type of (Matching unit)) Equal to Crew Member))
      • Unit Group - Pick every unit in Temp_Group3 and do (Actions)
        • Loop - Actions
          • Set localplayer = (Owner of (Picked unit))
          • Custom script: if udg_localplayer == GetLocalPlayer() then
          • Game - Display to (Player group(localplayer)) the text: localstring
          • Sound - Play alarm <gen>
          • Custom script: endif
      • Custom script: call DestroyGroup(udg_Temp_Group3)
      • Countdown Timer - Start WarningTimer[1] as a One-shot timer that will expire in 3.00 seconds
    • Else - Actions
Does this work?


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Remaining time for WarningTimer[0]) Less than or equal to 0.00
    • Then - Actions
      • Set Temp_Group2 = (Units in Cruiser 1 Interior <gen>((Unit-type of (Matching unit)) Equal to Crew Member))
      • Unit Group - Pick every unit in Temp_Group2 and do (Actions)
        • Loop - Actions
          • Set Temp_PlayerGroup = (Player group((Owner of (Picked unit))))
          • Game - Display to Temp_PlayerGroup the text: localstring
          • Custom script: call DestroyForce(udg_Temp_PlayerGroup)
          • Set localplayer = (Owner of (Picked unit))
          • Custom script: if udg_localplayer == GetLocalPlayer() then
          • Sound - Play alarm <gen>
          • Custom script: endif
      • Custom script: call DestroyGroup(udg_Temp_Group2)
      • Countdown Timer - Start WarningTimer[0] as a One-shot timer that will expire in 3.00 seconds
    • Else - Actions
Or this a safer approach?

Sorry, I'm only used to GUI. Will this way of setting up local message cause desync? I'm trying will fail and error in last 10 versions, however I cannot test it myself since it only happens with more than 1 player.

But I would prefer alarm sound for that one team only, not the other.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
I don't know if it's safe to open a new thread in a local block, just as ForForce does. (the display text force thing)
It probably leads to a desync.
I don't completely understand. I don't understand JASS language.

Are you referring to Temp_PlayerGroup? Destroying it every pick causes desync?

Or are you referring ForForce on something in trigger 1 or 2?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182
ok, added a few "NOTICE!" wich will help the reader

edit;

NOTICE! We use a player variable named "GetLocalPlayer" or "Player" based on wich way you want to use
NOTICE! The jass and the GUI version is just the same you can use any of them!
NOTICE! In jass the player index is between in 0-11 insted of 1-12 in GUI
NOTICE! Handles that have their own stack will never desync!
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182
NOTICE! We use a player variable named "GetLocalPlayer" or "Player" based on wich way you want to use
NOTICE! The jass and the GUI version is just the same you can use any of them!
NOTICE! In jass the player index is between in 0-11 insted of 1-12 in GUI
NOTICE! Handles that have their own stack will never desync!

I know they are not very helpful but useful in some cases

edit, yay 1100 posts :)
 
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
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
I'm talking about that :

Game - Display to Temp_PlayerGroup the text: localstring

Since i suppose that it uses ForForce.

It does not.

JASS:
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

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

though
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
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.

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:
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?
 
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:

When to use a CS?

-> When you need to use a JASS line inside a GUI trigger

How to use a CS?

1)Click the trigger
2)Right click on the trigger's GUI space and choose add action
3)Choose Custom script from the dropdown list
4)Write your jass line

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...
 
Level 4
Joined
Jan 19, 2012
Messages
52
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...

Doesn't this tutorial exist in the JASS section, then?

Still, how is this GUI?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182
Those questions seems kind of stupid to me actually...
This is a normal tigger its called GUI
  • trigger name
  • Events
  • Conditions
  • Actions
this is JASS or vJASS
JASS:
function functionname takes nothing returns nothing
endfunction

and in the GUI there is no such thing as GetLocalPlayer and I show to how to get the JASS native GetLocalPlayer into the GUI. so tell me how can it not be suiting in the GUI tutorials?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Those questions seems kind of stupid to me actually...

Nah it's not stupid, I get his perspective...

This is a normal tigger its called GUI
  • trigger name
  • Events
  • Conditions
  • Actions
Damn right it is!

this is JASS or vJASS
JASS:
function functionname takes nothing returns nothing
endfunction

Nope, just JASS ;P

and in the GUI there is no such thing as GetLocalPlayer and I show to how to get the JASS native GetLocalPlayer into the GUI. so tell me how can it not be suiting in the GUI tutorials?

Let me rephrase that for him:
If GetLocalPlayer() only exists in Jass, then how can this be a GUI tutorial?

But then again... It's in the GUI section because it effectively shows you how to put the return of a Jass function inside a GUI variable.
Which can then be used for local code without having to use custom script actions over and over again in GUI. Which can be a useful refference for GUI users.
(If you've come this far as a GUI user, I don't really see the point in not learning Jass anyways then :/)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
  • Custom script: set udg_global_variable = JASSFunctionReturn()
How hard is that?

Depends... How much do you know about GUI? :)
I'm just saying, this stuff is simple cake for almost anyone but you'll never know who finds it useful.
Plus the fact that not every GUI'er thinks of this solution for using local code.
It's also good to have idiot proof things...

Did you know that there was a women in the US who had fried her dog with a microwave just because the dog went outside in the rain. And afterwards sued the company who made the microwave because it killed the dog since it wasn't in the user manual that you should not put your dog in the microwave?

Imagine this world without simple idiot proof explenations 0.o
Retardation will be without limits. (no offence to anyone who is retarded b.t.w.)
 
Last edited:
Level 4
Joined
Jan 19, 2012
Messages
52
Depends... How much do you know about GUI? :)
I'm just saying, this stuff is simple cake for almost anyone but you'll never know who finds it useful.
Plus the fact that not every GUI'er thinks of this solution for using local code.
It's also good to have idiot proof things...

Did you know that there was a women in the US who had fried her dog with a microwave just because the dog went outside in the rain. And afterwards sued the company who made the microwave because it killed the dog since it wasn't in the user manual that you should not put your dog in the microwave?

Imagine this world without simple idiot proof explenations 0.o
Retardation will be without limits. (no offence to anyone who is retarded b.t.w.)
My answer:
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:

When to use a CS?

-> When you need to use a JASS line inside a GUI trigger

How to use a CS?

1)Click the trigger
2)Right click on the trigger's GUI space and choose add action
3)Choose Custom script from the dropdown list
4)Write your jass line

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...
There you go.

However, you make a good point. Maybe I will create a tutorial on how and when to use a custom script sooner or later.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
My answer:
There you go.

You are correct, but that doesn't mean I don't find it useful to use this guide for reference whenever someone doesn't know how to use local code in GUI.

However, you make a good point. Maybe I will create a tutorial on how and when to use a custom script sooner or later.

Well that will be a brief tutorial in that case :)
It's good if it gave some hints towards learning Jass.
I think at this point GUI users should seriously consider doing that instead.
It's not that hard anyways...
 
Level 14
Joined
Aug 8, 2010
Messages
1,021
I have used GetLocalPlayer 5-6 times in my map. Only one of them causes a desync, though... i gotta find the problem.
Anyway, after doing this :
  • Custom script: set udg_Player = GetLocalPlayer()
what will be the current value of the "Player" variable?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
No, it's still a player variable, just that it contains another value for each client. Jass code is not handled centrally on the game server but every client gets the same sheet of paper of script and executes it on its own. Functions like GetLocalPlayer() provide client-specific data the other players in the game have no access to. This way, they create asynchronous results.
 
Top