• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Unit Hiding

Status
Not open for further replies.
Is there a way by GUI to hide/ show a number of units but only for a single player, for example When a unit is selected, 10 units should be created but only shown to an individual player?
Help appreciated Thanks

temporarily give them permanent invisibility? something like that i guess, or some advanced script that i know nothing off....
 
With GUI, no.
With JASS, probably* yes.

* I'm not entirely sure whether this will work, but following the logic, it should.

JASS:
function ShowUnitForPlayer takes player p, unit u, boolean bool returns nothing
    if GetLocalPlayer()==p then
        call ShowUnit(u, bool)
    endif
endfunction
I haven't tested it, and i doubt anyone has ever come up with such a crazy idea, this may as well crash your game and World Editor, so remember to save before you paste it...

Copy the above function and paste it into your map header (above all triggers and categories, with the map icon)
Then, whenever you'll want to hide/show the unit, just do:
  • Custom script: call ShowUnitForPlayer(your_unit, false) [or true]
 
Well, it does hide the unit, but you would need to check a few things in multiplayer:
1) Do other players get disconnected when the function runs? (if yes, there is no hope this will ever work)
2) Are they able to see the unit, when they shouldn't be able to?

I made a little map you can test with someone over BNet, if they get disconnected when the map loads, then just abandon the idea.
 

Attachments

I tested it long ago and it can desync.

The hiding itself doesn't desync but it has secondary effects like acquire range that does desync (on a computer, a unit auto-attack the showed unit but on an other computer, units don't auto-attack because the target is hidden).

I guess it could be possible if someone does enough tests to see how it can desync (auto-attack, pathing, etc...)
 
How about a simpler way... with GUI. Animoi had the right idea. Invisability. All you have to do is GUI truesight. Instead of using the spell true sight, make it a GUI spell. Unit comes in range of unit. Unit has spell True Sight. Have vision of triggering unit. and an extea condition "Unit is part of unit group equal to false"
 
Status
Not open for further replies.
Back
Top