How to hide my unit from everyone

Level 5
Joined
Mar 6, 2015
Messages
130
I'm seeking to hide a specific unit from everyone except player 1 the permanent invisibility ability was very tricky option but I realized that the allies can see my unit and my unit gets a little bit transparent is there any way to do this?
How about special effects can I hide a special effect from every one else except player x ?
 
Level 19
Joined
Jul 2, 2011
Messages
2,161
is this unit part of player ones team or ally?

what you can do is give a unit an allied Stat for only play 1 and give it the invisible ability

that way the unit becomes visible only to player one and no one else
 
Level 11
Joined
Dec 19, 2012
Messages
411
There's a thread shows that creating a same unit but different in model doesn't desync. Playing with GetLocalPlayer

I did a quick test, base unit i used is footman (hfoo)

1. Create a unit base on footman, change it model to none, as well as changing the shadow to none. (in my case the new unit row code is 'h000')
2. I also changed the shadow of from original footman to none.

3. The trigger part :

JASS:
	local integer i
	
	
	if GetLocalPlayer() == Player(0) then
		set i = 'hfoo'
	else
		set i = 'h000'
	endif
	
	call CreateUnit(Player(0), i, 0, 0, 0)

And doesn't cause desync. So basically just different in model, the rest of the part are same.


EDIT : Oh and 1 thing, for the new unit type (h000 in my case), inside the Unit Editor : Stats - Hide Minimap Display set this to true, so that none of the other player could see the unit from the minimap.
 
Last edited:
Level 11
Joined
Dec 19, 2012
Messages
411
Are you sure the unit with no model would appear hp bar? I don't think so.


Anywhere, to get rid of the hp bar, you have 1 option :

In Unit Editor : Art - Selection Scale (ussc)

Set the selection scale to 0.1, the hp bar should be gone, but also you wouldn't be able to see the selection circle.
 
Level 5
Joined
Mar 6, 2015
Messages
130
I played around the hide unit and getlocal player and tested with JNGP`s multiplayer test the results were desyncs and this is not good the best solution till now is making unit invisible while the shared vision is unchecked its working but its getting funny with transparent units is there a possible way to make unit invisible without fading out?
 
Level 11
Joined
Dec 19, 2012
Messages
411
The reason is, if your map originally have unit type 'hfoo' (assuming), and you use the getlocalplayer trick to create another unit with 'hfoo' and whatever another type, you will get desync.

So, to avoid desync, you can only create 'hfoo' via getlocalplayer, and whatever another type via getlocalplayer, it must be constant so that when the warcraft 3 sync, the returned unit type id wouldn't be different for each player.

Since talked about unit type id, be aware that using the native would cause desync though.

This is the risk you need to be careful, since this is what you want, if not, I only got a second option :

1. Use getlocalplayer for setting the unit transparent locally, and in OE change the change unit selection scale to a small value and also set hide minimap display to true. Not sure if this gonna be the more acceptable solution for you.


EDIT : So it is dummy unit (I'm assuming it controllable, like normal unit) just for special effect. If then, why don't you just display the special effect locally? Or you want to modify the spell effect speed?
 
Level 5
Joined
Mar 6, 2015
Messages
130
You could use GetLocalPlayer and change the vertex color, but the HP bar would still be shown and it can be attacked, even if you can't see the model.
You could fix that by added locus but then player 1 can't control it.

My guess is that it's impossible.

These units are dummys with locust ability I'm just using them as UI effects they are not supposed to be controlled they just have to be displayed.
 
Level 36
Joined
Jul 22, 2015
Messages
3,491
You can also use GetLocalPlayer to change the model for a special effect locally. Possibly showing no model at all for some players.

This. If you want to hide a unit from everyone, I think something like this would work:

  • Set TargetUnit = (Unit you want to hide)
  • Set Owner = (Owner of TargetUnit)
  • Custom script: if GetLocalPlayer() != udg_Owner then
  • Animation - Change TargetUnit's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
  • Custom script: endif
 
Top