• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to make a unit visible only to its owner?

Status
Not open for further replies.
Level 1
Joined
Feb 1, 2012
Messages
5
Hello there, Hive Community :)

I have a map, and "x" allied players in one team. Also I have a script that spawning some units nearby, 1 unit for each player.

What I need is so spawned unit can be visible only for it's owner, i.e. I created a unit for Player 1 (Red), and this unit should be visible only to that one spcific player.

How to do that?
(Perma invisibility is not helping, or I'm doing it wrong?)
 
Level 1
Joined
Jan 31, 2012
Messages
5
Is the spawned unit performing an action that would cause it to break invisibility? Also, what role is the spawned unit supposed to Perform?
 
Level 1
Joined
Feb 1, 2012
Messages
5
No actions, the unit can't move at all.

Unit is a dummy, and supposed to perform no actions (actually it's a button highlight - camera applied from bird's view straight to ground 90 degrees).

This how it looks like in editor:

editorp.jpg


And in-game (fire selected):
ingameh.jpg


This highlighted button on last screenshot is actually a unit with highlight-model "TRS\TRSHerolevel.mdl". And this model needs to be shown only to triggered player (owner of this unit).
So any ideas?
 
Level 10
Joined
Oct 5, 2008
Messages
355
I would use the GetLocalPlayer function. If the local player is equal to the triggering player the dummi needs to be viewed, set a real variable x to 0.00, else to 100.00. Then, just change the vertex coloring of the dummi to (255,255,255) with x% transparency. For every player, except the triggering player, the dummi should be 100% transparent, meaning it should be not visible.

Edit: I currently don't know if this would cause a desync, but i think rather not, since no game-relevant data is changed which would lead to a desync

here is a trigger which shows what i mean:

  • Actions
    • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
    • Set u = 0.00
    • Custom script: else
    • Set u = 100.00
    • Custom script: endif
    • Animation - Change (Your unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with u% transparency
I made it in gui, don't know why ^^
 
I would although suggest doing it this way though as it would be more officiant and easier to create and also preventing any time wasting mistakes for using the variable that was changed locally for that player and desyncing the map.
  • Actions
    • Custom script: if GetLocalPlayer != GetTriggerPlayer() then
    • Animation - Change UNIT vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
    • Custom script: endif
 
Status
Not open for further replies.
Top