vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

[GUI] GetLocalPlayer

Chaosy · 9435

Poll

Was this useful to you?

Yes
No
You need to work more on this tutorial
I don't know

0 Members and 1 Guest are viewing this topic.

on: November 20, 2012, 11:57:27 AM
Category: Trigger (GUI) Editor Tutorials
« Created: April 04, 2016, 10:37:10 PM by moyack »
GetLocalPlayer - By Chaosy




Introduction
This is my first tutorial on blizzardmodding, but I have been around the editor messing around for GUI for one year now (@hiveworkshop) and I thought I might share this tutorial with you guys.
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 knowage of GUI triggering.
Very basic jass knowage.
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 choise 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.

NOTICE! We use a player variable named "GetLocalPlayer" or "Player" based on wich way you want to use. but you can name it whatever you want.

This is the way I recomend for GUI users, you only set only single line JASS in the init trigger and then you can use that variable the whole game!
Trigger: Test 1584798157
   
           
  • init
  •     Events
  •         Map initialization
  •     Conditions
  •     Actions
  •         Custom script:   set udg_GetLocalPlayer = GetLocalPlayer()
           
Trigger: Test 1735196890
   
           
  • 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
           

Here is the version that you should use if you actually like jass (Wich I really dont do).
Trigger: Test 568724982
   
           
  • 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
           

Here is the trigger wich you can use if you want to but as said the first trigger is better. But this is pretty much the standrad
Trigger: Test 924150944
   
           
  • 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.
Trigger: Test 1837639920
   
           
  • 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.
Trigger: Test 1982207187
   
           
  • 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.
Trigger: Test 1741924004
   
           
  • 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!
Trigger: Test 66332198
   
           
  • 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
           

Trigger: Test 1047606937
   
           
  •         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.
Again I show you the same three ways nothing new with the method.

Trigger: Test 293376576
   
           
  • init
  •     Events
  •         Map initialization
  •     Conditions
  •     Actions
  •         Custom script:   set udg_GetLocalPlayer = GetLocalPlayer()
           
Trigger: Test 2122289927
   
           
  • 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
           


Trigger: Test 1847728700
   
           
  • 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
           


Trigger: Test 1853784293
   
           
  • 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).
Trigger: Test 1150463772
   
           
  • 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.
Trigger: Test 1876299680
   
           
  • 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.
Trigger: Test 456876762
   
           
  • 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, ifpossible do only use the GetLocalPlayer in conditions.
So if it does desync don't 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


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
shadowvzs - The list of what does desync and not
Hashjie - Telling me info about GetLocalPlayer and the idea to this tutorial
Troll-Brain - awesome tip to improve the tutorial
« Last Edit: April 04, 2016, 10:37:10 PM by moyack »



Reply #1 on: November 20, 2012, 04:18:26 PM
Sounds like a troll there, it's a jass forum you know.

vJass is already a jass preprocessor, no need to (ab)use vJass features in order to make some inferior vJass preprocessor coded "by hand".


Reply #2 on: November 20, 2012, 04:59:02 PM
Not on purpose, it says "scripting tutorials" when I clicked it and I thought that maybe included GUI.
Anyway there is no other place where it suits at all, and I asked Sonofjay if GUI tutorials was accepted here on blizzmodding



Reply #3 on: November 20, 2012, 09:55:25 PM
Hi Chaosy and welcome to Blizzmod :D

By far this tutorial is looking great. You can use the [trigger] BBcode instead of [code] bbcode.

Example:

This is the way I recomend for GUI users, you only set only single line JASS in the init trigger and then you can use that variable the whole game!
Trigger: Test 1883605800
   
           
  • init
  •     Events
  •         Map initialization
  •     Conditions
  •     Actions
  •         Custom script:   set udg_GetLocalPlayer = GetLocalPlayer()
           
Trigger: Test 968522529
   
           
  • 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
           




Reply #4 on: November 21, 2012, 01:29:11 AM
Wow, this is really useful for GUI users and its also well explained. Great job!

Chronicles of Darkness
by: SonofJay

A BlizzMod Hosted Project

They can hate, let them hate, make them hate.


Reply #5 on: November 21, 2012, 12:09:22 PM
@moyack
Thanks, I will add it in a few minutes :)

@sonofjay thanks mate :D

@all
updated
replaced [ code ] [ /code ] with trigger
added list of desyncs
added credits
« Last Edit: November 21, 2012, 12:21:17 PM by Chaosy »



Reply #6 on: November 23, 2012, 07:44:29 AM
I have seen few typo errors. Please, fix them.


Reply #7 on: November 29, 2012, 06:36:17 AM
Approvezorded!!!!1 :D

Please don't forget to check the typos eubz has pointed out.


Reply #8 on: November 29, 2012, 08:43:10 AM
Thanks, means alot. I aint good a grammar and stuff but I will fix if I find something



 

Power of Corruption - A Warcraft III altered melee map   Chaos Realm - The world of Game modders and wc3 addicts