• 🏆 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] if GetLocalPlayer() == udg_Player then

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2012
Messages
158
if GetLocalPlayer() == udg_Player then - SOLVED

Hi

I want to create a spell which puts a targeted unit into a shadow realm for several seconds and causes units (creatures of the void) to spawn and attack him :)
By learning about if "GetLocalPlayer() == udg_Player then" I was able to create a nice effect for the transferred target while he is in the shadow-dimension.

But is it possible to hide all units for a single player with the custom script?

I have made a trigger, but it doesn't work
  • Creatures of the Void Attack
    • Events
    • Conditions
    • Actions
      • Set PlayerDarkGreen = Player 11 (Dark Green)
      • Custom script: if GetLocalPlayer() == udg_PlayerDarkGreen then
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Matching unit)) Not equal to Player 11 (Dark Green))) and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
      • Unit - Unhide TouchOfTheShadowRealmTarget
      • Custom script: endif
In my example i'm trying to hide all units for darkgreen (which is the owner of the spawns) so that they will not attack anything but the target.

Thanks :)
 
Last edited:
Level 7
Joined
Mar 6, 2006
Messages
282
You can't use the "Hide" action with GetLocalPlayer(). When you "Hide" a unit with that action, it will essentially remove it from the game for ONLY that player, so for everyone else, that unit is still there (not hidden), and once it interacts with something, the player who executed the local Hide action will be desync'd.

To achieve what you want, you would have to use an ability that makes units invisible, and create dummy units with True Sight for players that you want to be able to see certain units.

For example:

Every "shadow realm" unit has an invisible ability, and are hidden with "Unit - Hide (unit)".

Once a player is put in the shadow realm, you "Unit - Unhide (unit)" the shadow monsters and give the player True Sight, so he can see the shadow monsters.

You may also have to give the player's unit invisibility too, so that the other players can't see him (because he's in the shadow realm) and thus, give the shadow monsters True Sight so they can see the affected player.
 
Level 7
Joined
Jul 9, 2012
Messages
158
By sending the targeted unit into the shadow world, i'm giving him Permenant Invisibility + True Sight so that no one else can see him. The shadow monsters also have permentant invisibility + True Sight so they can spot the targeted unit too. Therefore I cannot add invisibility to the units outside the shadow world because the monsters would still be able to see them :b

But is there any other way to make the monsters only be able to attack the targeted unit? :)
 
Level 5
Joined
Jan 27, 2014
Messages
164
Been a long time since I used GetLocalPlayer. So these information may either be outdated or my mistake.

As far as I know, GetLocalPlayer works if you change the unit size, fly height, and vertex colouring. To make your units not visible, you can try setting their fly height to a large value, or reduce their size to zero, or set their transparency to 100%. Or, you could do all three.

Then again, the player can still possible select the unit and attack the unit (though a little hard). The HP bar should be hidden when the unit height is set to a large value.

Then again, it's not too wise to mess around with this. Make sure you test it out on multiplayer despite what I've mentioned above.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
I dont think that is possible with GetLocalPlayer()

As a work-around I would suggest something like this.
Units owned by player X is moved a to a certain region on the map
in that region you spawn those void units. When all void units are dead or after X seconds you move them back to their old position.
 
Status
Not open for further replies.
Top