• 🏆 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!

[Trigger] Unit Hiding

Status
Not open for further replies.
Level 8
Joined
Apr 8, 2009
Messages
499
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....
 
Level 9
Joined
May 27, 2006
Messages
498
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]
 
Level 9
Joined
May 27, 2006
Messages
498
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

  • ShowUnitForPlayer.w3x
    16.8 KB · Views: 62
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...)
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
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.
Top