• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Is it possible to only show destructables to one player?

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
Hi guys, is it possible to only show destructables to one player? I guess it is possible? But even it is possible, I am still confused about the GetLocalPlayer() function.

JASS:
function con takes nothing returns boolean
    if GetTriggerPlayer() == GetLocalPlayer() then   //This comparison must be wrong...
        ....     //Showing destructables
    endif
    return false    
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer i = 0
    loop
        exitwhen i > 7 // There are only 8 players in my map.
        call TriggerRegisterPlayerEvent(t, Player(i), EVENT_PLAYER_END_CINEMATIC) 
        set i = i + 1
    endloop
    call TriggerAddAction(t, function con)
endfunction

So, how to correctly use the GetLocalPlayer() function? Many thanks.
 
It is possible.
JASS:
if GetTriggerPlayer() == GetLocalPlayer() then
    call ShowDestructable(d, true)
endif

But if a player interacts with the destructable (e.g. attacks it, harvests it, w/e) then it will disconnect players. So just be careful. Here is a thorough list of what is and isn't problematic when it comes to hiding destructables (courtesy of Zwiebelchen):
Zwiebelchen said:
However, there are some rules you need to consider, in order to make your map work without desyncs in multiplayer:
- never hide destructables units or players can interact with (attackable, selectable or destructable)
- hiding destructables that block pathing is safe, as hiding the destructable will not change its pathing
- hiding destructables that need to be enumed is safe; hidden destructables can be enumerated
- hiding walkable platforms is also safe, as long as you dont get a location Z for a location placed on that destructable globally; this is not 100% safe anyway, as
the returned value of GetLocationZ() is dependant on the render state of the destructable
 
Level 11
Joined
Oct 11, 2012
Messages
711
It is possible.
JASS:
if GetTriggerPlayer() == GetLocalPlayer() then
    call ShowDestructable(d, true)
endif

But if a player interacts with the destructable (e.g. attacks it, harvests it, w/e) then it will disconnect players. So just be careful. Here is a thorough list of what is and isn't problematic when it comes to hiding destructables (courtesy of Zwiebelchen):

Thanks a lot, PnF. +Rep
 
Status
Not open for further replies.
Top