• 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.

Hide Units from Other Players

Status
Not open for further replies.
Level 10
Joined
Dec 17, 2011
Messages
355
I made a picking system .Its like you have to select a unit that will appear in the
middle of the screen ,with a nice background .The camera is fixed .The system still works fine except my map is multiplayer ,so need a solution to hide out the other players units from the screen .I didnt find a way to achieve this in WE . :ogre_frown:
Help,i dont want to make 12 backgrounds :goblin_cry:
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Help,i dont want to make 12 backgrounds
So you create only 1 background for it to be shared by 12 players ?
What's wrong with that ?
Why do you need to hide unit from other player ?

By having a rough guess, I think that you're trying to make a Hero Selection System where Player will select their Heroes based on the unit that they click.

Why not just create those Units normally and detect which Player clicks it by using this event;
  • Setup
    • Events
      • Unit - Blood Mage Selector 0000 <gen> Is selected
    • Conditions
    • Actions
      • -------- Use (Triggering player) to refer to the Player who selects the unit. --------
      • Unit - Create 1 Blood Mage for (Triggering player) at YourLocation facing Default building facing degrees
But, this is just a mere assumption, I don't know what you're trying to achieve by hiding units from Player if you're using the same background.
 
I'm not sure if this will work, but try:

  • Create the unit at the background area for the player who selects it
  • Create a dummy unit with invisibility spell
  • Make dummy cast invisibility on unit in the background area
  • Change vertex coloring of invisible unit to 100%

That should create the unit and hide it from enemy players. Note this won't work if your map has teams.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If you still want to hide the unit from non-local-Player Sight, you can do the GetLocalPlayer() method BUT the purpose is just to select heroes, and that's that.

Don't make it interact with anything else, if it does, it would cause some errors there which will lead to desynchronization and has tendency to be disconnected.
 
Level 10
Joined
Dec 17, 2011
Messages
355
I'm not sure if this will work, but try:

  • Create the unit at the background area for the player who selects it
  • Create a dummy unit with invisibility spell
  • Make dummy cast invisibility on unit in the background area
  • Change vertex coloring of invisible unit to 100%

That should create the unit and hide it from enemy players. Note this won't work if your map has teams.

It doesnt works because changing vertex coloring does nothing with invisible objects ,only can change their color ,but they still remain transparent.
Anyway thanks for the tip!
 
Level 10
Joined
Dec 17, 2011
Messages
355
@defskull
@Adiktuz Thnx ,it looks a nice solution but im very bad with custom scrypts .So i failed to
make it . :vw_sad:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Sold unit)) Equal to BuyingDummyAlly[1]
    • Then - Actions
      • Unit - Remove (Load 0 of (Integer((Name of BuyerPlayer))) in ImageUnitTable) from the game
      • Unit - Create 1 ImageDummyAlly[1] for BuyerPlayer at (Position of AllyPickerPositingUnit) facing (Position of AllyPickFacingUnit)
      • Hashtable - Save Handle Of(Last created unit) as 0 of (Integer((Name of BuyerPlayer))) in ImageUnitTable
      • Set Hidden_Unit = (Load 0 of (Integer((Name of BuyerPlayer))) in ImageUnitTable)
      • Unit - Hide Hidden_Unit
      • Custom script: if GetLocalPlayer() = udg_BuyerPlayer then
      • Custom script: call ShowUnit(udg_Hidden_Unit , true)
      • Custom script: endif
    • Else - Actions
i made this .And the unit is hidden even for me .
 
it should be if GetLocalPlayer() == udg_BuyerPlayer then . That's strange you didn't end up with an error.

I recommend you to test in multiplayer as soon as you get it work because I'm not sure it won't cause desync even if it is only a selection issue (will the other computers accept that you selected an hidden unit?). If it was already tested and approved, then that's a good thing to know ^^.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I believe this will cause desyncs if i either order a unit toward the hidden unit or the hidden unit is isused an order. I play with this command
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Oh ,was that a lack of = ? haha
Thank you guys ,now it works properly .And i think its not gonna couse desync in multiplayer ,because it is a simple locusted unit , does nothing but shows a standing animation .

Ah. that won't cause problems than
 
Status
Not open for further replies.
Top