• 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] How to set a unit's size only for one player?

Status
Not open for further replies.
Level 5
Joined
Jan 18, 2012
Messages
92
I started experimenting with GetLocalPlayer() and I was wondering if it's possible to set a unit's scale only for the local player. I want to set the unit's scale to 0 so the owner of that unit can't see the unit but everyone else can.

I know of this function:

JASS:
SetUnitScale(unit, x, y, z)

So I was wondering if this is possible. I read somewhere that it's safe to change the vertex color of a unit only for the local player, so I'm assuming you can change the scale too.

I managed to figure it out!
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,658
Sorry I didn't read the post and just gave an answer to the title.

Here is the real answer:
Loop through all players:
if LocalPlayer = owning player then
Set unit scale to 0, 0, 0
else
Set unit scale to 1, 1, 1

I think that this wouldnt work but you could try set vertex coloring with 100% transparency instead
(As we are talking about colors, make sure you check out what the BJ function does before you remove it... you might even keep the BJ instead of the native.)

EDIT:
Hide unit does not hide a unit does it?
The editor sais that it is only hidden for regions.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
If you set the scale to 0, you can still drag-select it can't ya?
So I'd rather hide the unit for a specific player instead.

this will desync if the player that cant see the unit will try to do enter the unit's collision range with his unit's collision range(basically step over it).

I have tried this personally before, I wanted to hide units inside village for only players that finished certain quest, but there is no easy method to do this
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
SetUnitX/Y will also desync if you try to step to position where the unit should be for another player, because you desync the game states(Player A's game thinks your unit stands there, Player's B game thinks your unit cant be there, because some other unit is standing there)
 
Level 19
Joined
Dec 12, 2010
Messages
2,074
everything which mess with object's behaiour CANNOT be runned locally.
nothing in WC3 cares about unit's tint, size - but everything cares about his X/Y/life.
so you may assume tint and size can be modified locally - what does it matter, if enemy will see black or standard model? but messing with unit's coorinated will lead to desync as soon as enemy will try to do something with moved unit.
it's safe as long as enemy can only "watch", but once it starts to be interactive, you have no rights to do such stuff locally.
 
Status
Not open for further replies.
Top