3078 Posts in 566 Topics - by 2212 Members - Latest Member: DavidVictoria

Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

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

Poll

Was this useful to you?

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

Author Topic: [GUI] GetLocalPlayer  (Read 8955 times)

  • Newbie - level 1
  • *
  • Posts: 8
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 3
  • Advanced GUI user
    • View Profile
[GUI] GetLocalPlayer
« 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 152485845
   
           
  • init
  •     Events
  •         Map initialization
  •     Conditions
  •     Actions
  •         Custom script:   set udg_GetLocalPlayer = GetLocalPlayer()
           
Trigger: Test 298652814
   
           
  • 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 1908860002
   
           
  • 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 2054866080
   
           
  • 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 632784401
   
           
  • 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 803159591
   
           
  • 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 1386516159
   
           
  • 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 1865127825
   
           
  • 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 1986905308
   
           
  •         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 818502533
   
           
  • init
  •     Events
  •         Map initialization
  •     Conditions
  •     Actions
  •         Custom script:   set udg_GetLocalPlayer = GetLocalPlayer()
           
Trigger: Test 477236868
   
           
  • 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 567170176
   
           
  • 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 741688041
   
           
  • 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 1802516323
   
           
  • 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 589874070
   
           
  • 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 1301352102
   
           
  • 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 »

  • Rookie - level 1
  • *
  • Posts: 48
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 8
  • cool != useful
    • View Profile
Re: [GUI] GetLocalPlayer
« 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".

  • Newbie - level 1
  • *
  • Posts: 8
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 3
  • Advanced GUI user
    • View Profile
Re: [GUI] GetLocalPlayer
« 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

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 958
  • WC3 Models: 59
  • WC3 Tutorials: 13
  • WC3 Tools: 12
  • WC3 Maps: 12
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 15
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
Re: [GUI] GetLocalPlayer
« 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 1841110109
   
           
  • init
  •     Events
  •         Map initialization
  •     Conditions
  •     Actions
  •         Custom script:   set udg_GetLocalPlayer = GetLocalPlayer()
           
Trigger: Test 720434981
   
           
  • 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
           



We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

  • Your Awesome Site Director
  • Recognized User
  • Starter - level 1
  • *****
  • Posts: 382
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 677
    • View Profile
Re: [GUI] GetLocalPlayer
« 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.

  • Newbie - level 1
  • *
  • Posts: 8
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 3
  • Advanced GUI user
    • View Profile
Re: [GUI] GetLocalPlayer
« 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 »

  • Da Shaman
  • Recognized User
  • Rookie - level 1
  • *****
  • Posts: 75
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 7
  • Wired...
    • View Profile
Re: [GUI] GetLocalPlayer
« Reply #6 on: November 23, 2012, 07:44:29 AM »
I have seen few typo errors. Please, fix them.

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 958
  • WC3 Models: 59
  • WC3 Tutorials: 13
  • WC3 Tools: 12
  • WC3 Maps: 12
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 15
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
Re: [GUI] GetLocalPlayer
« 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.

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

  • Newbie - level 1
  • *
  • Posts: 8
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 3
  • Advanced GUI user
    • View Profile
Re: [GUI] GetLocalPlayer
« 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

 

Blizzard Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena Starcraft II Modding Information Center
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!