• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] getlocal player advice

Status
Not open for further replies.

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
hi everyone,

is this trigger safe?

[Jass=]
function Trig_Building_ProgressBar takes nothing returns nothing
local texttag udg_LocalText
local unit building
local real visible
local integer A
set udg_LocalPlayer = GetTriggerPlayer()
set building = GetConstructingStructure()
if ( IsPlayerInForce(udg_LocalPlayer, udg_Team[1]) == true )
set A = 1
elseif ( IsPlayerInForce(udg_LocalPlayer, udg_Team[2]) == true )
set A = 2
elseif ( IsPlayerInForce(udg_LocalPlayer, udg_Team[3]) == true )
set A = 3
else
set A = 4
endif
if ( GetUnitTypeId(building) == 'h016' ) then
if ( IsPlayerInForce(GetLocalPlayer(), udg_Team[A]) == true ) then
set visible = 0
else
set visible = 100
endif
call CreateTextTagUnitBJ( udg_ProgressBar[7], GetConstructingStructure(), 0, 8.00, 100, 100, 100, visible )
set udg_LocalText = GetLastCreatedTextTag()
call PolledWait( 0.50 )
if ( IsUnitAliveBJ(building) == true ) then
call SetTextTagTextBJ( udg_LocalText, udg_ProgressBar[8], 8.00 )
else
call DestroyTextTagBJ( udg_LocalText )
return
endif
call PolledWait( 0.50 )
call DestroyTextTagBJ( udg_LocalText )
endif
endfunction

//===========================================================================
function InitTrig_Building_ProgressBar_Copy takes nothing returns nothing
set gg_trg_Building_ProgressBar_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Building_ProgressBar_Copy, EVENT_PLAYER_UNIT_CONSTRUCT_START )
call TriggerAddAction( gg_trg_Building_ProgressBar_Copy, function Trig_Building_ProgressBar )
endfunction[/code]

i need the texttag to show only for team mate of player constructing the structure
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
well i allready have check these two tutorials,
but usually they talk about 1 player, not a group of player using getlocalplayer...
i think the way i did it is ok.
but i rather ask for confirmation from more experienced player.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
kLoader is the best answer.

Problem is that I have not tested every case that can cause desync (sorry about that) but you can get the confirmation you need from kLoader.


Its a program that allow you to run multiple WC3 instance at the same time, so you can use LAN games and add yourself as another human player to test desync
 
Status
Not open for further replies.
Top