- Joined
- Nov 13, 2006
- Messages
- 1,814
[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
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 - tested myself
4. Special effects attachment to unit, visibile for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
5. Create floating texts/or show for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
6. Unit color, transparancy, size/scale for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
7. Fog of war and black mask, color, visibile for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
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
9. Sound & music, for 1 player only?
Question - this cause desyncronization?
Answer - i dont really was able to test it
10. Show Multiboard, for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
11. Trackables, for 1-2 player only?
Question - this cause desyncronization?
Answer - No - tested myself
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 - tested myself
15. Desctructible visibility, for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
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
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
-
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
-
Events
2. Quest for 1 player only?
Question - this cause desyncronization?
Answer - Yes but if u use Enable/Disable quest then No
-
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
-
Events
3. Special effects, visibile for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
-
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)
-
Events
4. Special effects attachment to unit, visibile for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
-
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
-
Events
5. Create floating texts/or show for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
-
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)
-
Events
6. Unit color, transparancy, size/scale for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
-
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
-
Events
7. Fog of war and black mask, color, visibile for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
-
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
-
Events
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
-
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)
-
Events
9. Sound & music, for 1 player only?
Question - this cause desyncronization?
Answer - i dont really was able to test it
-
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
-
Events
10. Show Multiboard, for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
-
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
-
Events
11. Trackables, for 1-2 player only?
Question - this cause desyncronization?
Answer - No - tested myself
JASS:
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
-
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
-
Events
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
-
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)
-
Events
14. Weather effect off for 1 player?
Question - this cause desyncronization?
Answer - No - tested myself
-
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
-
Events
15. Desctructible visibility, for 1 player only?
Question - this cause desyncronization?
Answer - No - tested myself
-
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)
-
Events
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
-
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)
-
Events
Last edited: