• 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.

Unit Appearing for limited players

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
Level 28
Joined
Jan 26, 2007
Messages
4,789
Then you've either done something wrong, or the model has particle effects :D.
This worked for me:
  • Set TempPlayer1 = Whomever
  • Set TempLoc1 = (TempPlayer1 start location)
  • Set TempReal1 = 100.00
  • Unit - Create 1 Dummy for TempPlayer1 at TempLoc1 facing Default building facing degrees
  • Custom script: if IsPlayerAlly(GetLocalPlayer(), udg_TempPlayer1) then
  • Set TempReal1 = 0.00
  • Custom script: endif
  • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with TempReal1% transparency
  • Custom script: call RemoveLocation(udg_TempLoc1)
Makes the created unit invisible for all enemy players.

The problem is that vertex coloring does not change the particle effects (like missile effects and so on, those colors don't get changed).
In that case, you might want to try using fly height (have the unit have a negative fly height by default, then raise it for the local player). I hope that works :p.
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
when in trigger editor, click on trigger and press copy as text, then paste it [trigger]in here[/trigger]

this will however not work for all units correctly, for example golems.
I undestand that this is maybe only desync safe method but it still has the disadvantage of setting units vertex colors to 100% 100% 100% but not all units have 100 100 100 vertex colors(several war golems(the red one I believe) has different value etc)
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
this will however not work for all units correctly, for example golems.
I undestand that this is maybe only desync safe method but it still has the disadvantage of setting units vertex colors to 100% 100% 100% but not all units have 100 100 100 vertex colors(several war golems(the red one I believe) has different value etc)

yes i understand but in my trigger i know the vertex coloring of the unit so this not much a problem
Here is the trigger btw

  • Fire Strike
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fire Strike (Elemental)
    • Actions
      • Set Fire_Elemental_FireStrike = (Casting unit)
      • Set FireStrike_Target = (Target point of ability being cast)
      • Unit - Create 1 Flame strike first for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees
      • Set y = 100.00
      • Custom script: if IsPlayerAlly(GetLocalPlayer(), Player(8)) then
      • Set y = 0.00
      • Custom script: endif
      • Animation - Change (Last Created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with y% transparency
      • Unit - Add a 3.50 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Flame strike Loop for Player 1 (Red) at FireStrike_Target facing Default building facing degrees
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Wait 3.00 seconds
      • Unit - Create 1 Flame strike final for Player 1 (Red) at FireStrike_Target facing Default building facing degrees
      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 2 (Blue)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 3 (Teal)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 4 (Purple)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 5 (Yellow)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 6 (Orange)
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 550.00 of FireStrike_Target matching ((((Owner of (Matching unit)) Equal to Player 7 (Green)) or (((Owner of (Matching unit)) Equal to Neutral Hostile) or ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Fire_El and do (Actions)
            • Loop - Actions
              • Unit - Cause Fire_Elemental_FireStrike to damage (Picked unit), dealing (90.00 x (Real((Level of Fire Strike (Elemental) for Fire_Elemental_FireStrike)))) damage of attack type Spells and damage type Magic
        • Else - Actions
          • Unit Group - Pick every unit in (Units within 550.00 of FireStrike_Target matching ((((Owner of (Matching unit)) Equal to Player 1 (Red)) or (((Owner of (Matching unit)) Equal to Neutral Hostile) or ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Fire_Elem and do (Actions)
            • Loop - Actions
              • Unit - Cause Fire_Elemental_FireStrike to damage (Picked unit), dealing (90.00 x (Real((Level of Fire Strike (Elemental) for Fire_Elemental_FireStrike)))) damage of attack type Spells and damage type Magic
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
  • Set FireStrike_Target = (Target point of ability being cast)
  • Unit - Create 1 Flame strike first for "Triggering Player" at "FireStrike_Target" facing Default building facing degrees
at end of the trigger
  • Custom script: call RemoveLocation(udg_FireStrike_Target)
useing wait could break ur system also because the target position/Fire_Elemental_FireStrike variables will be ovewrited if will be casted bt someone else this ability in next 3sec after u casted it, use local variable

also change Player 1 to trigger player if u want apply to any unit or it is single player map?

unit grouyp also got leak and use tag
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
  • Set FireStrike_Target = (Target point of ability being cast)
  • Unit - Create 1 Flame strike first for "Triggering Player" at "FireStrike_Target" facing Default building facing degrees
at end of the trigger
  • Custom script: call RemoveLocation(udg_FireStrike_Target)
useing wait could break ur system also because the target position/Fire_Elemental_FireStrike variables will be ovewrited if will be casted bt someone else this ability in next 3sec after u casted it, use local variable

also change Player 1 to trigger player if u want apply to any unit or it is single player map?

unit grouyp also got leak and use tag

I restricted it (wich means:

Impossible to be more than one Hero (caster)
Impossible to cast it twice in 3 seconds (Cooldown-No cooldown reset)

Now i make a notice (the unit is a dummy for the spell wich is meant to be like an effect wich only has to be visible for allies of owner of casting unit) = lots of particals from the unit

also change Player 1 to trigger player if u want apply to any unit or it is single player map?

unit group also got leak and use tag

don't worry again for Player 1

didn't understand a word for the unit group thing
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Might I perhaps convince you to use 3 temporary locations in total for all your triggers?
This means that instead of the variable "FireStrike_Target", you'll have "TempLoc1" (and "TempLoc2" and "TempLoc3" in addition to that). You will never need more than that.
By doing that, you will save a lot of variables (having 3 locations total instead of 1-2 per spell).
You can still make it work by 'converting it to a local' at the start of the trigger (I'll probably have to explain this :p).

First off: you're not actually converting it to a local. That was a lie :D.
But it simplifies the explanation, so let's stick with that.

Here's an example:
  • Fire Strike
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fire Strike (Elemental)
    • Actions
      • Custom script: local location udg_TempLoc1
      • Set TempLoc1 = (Target point of ability being cast)
      • Wait 5.00 seconds
      • Unit - Create 1 unit at TempLoc1
      • Custom script: call RemoveLocation(udg_TempLoc1)
      • Custom script: set udg_TempLoc1 = null
By doing this, "TempLoc1" cannot be overwritten anymore :D.
If that spell is cast 10 times within 5 seconds, all those locations will still be correct! (Normally, 10 units would be created at the last location).

Frees up some variables and it's pretty clean, too.


but now ||||the unit is totally made of particals||||

What to do
Stop asking questions that I have already covered (in this same thread even) :p.
In that case, you might want to try using fly height (have the unit have a negative fly height by default, then raise it for the local player). I hope that works.
The trigger should remain almost exactly the same, except that you're not changing the fly height (and not the vertex coloring).
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Might I perhaps convince you to use 3 temporary locations in total for all your triggers?
This means that instead of the variable "FireStrike_Target", you'll have "TempLoc1" (and "TempLoc2" and "TempLoc3" in addition to that). You will never need more than that.
By doing that, you will save a lot of variables (having 3 locations total instead of 1-2 per spell).
You can still make it work by 'converting it to a local' at the start of the trigger (I'll probably have to explain this :p).

First off: you're not actually converting it to a local. That was a lie :D.
But it simplifies the explanation, so let's stick with that.

Here's an example:
  • Fire Strike
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fire Strike (Elemental)
    • Actions
      • Custom script: local location udg_TempLoc1
      • Set TempLoc1 = (Target point of ability being cast)
      • Wait 5.00 seconds
      • Unit - Create 1 unit at TempLoc1
      • Custom script: call RemoveLocation(udg_TempLoc1)
      • Custom script: set udg_TempLoc1 = null
By doing this, "TempLoc1" cannot be overwritten anymore :D.
If that spell is cast 10 times within 5 seconds, all those locations will still be correct! (Normally, 10 units would be created at the last location).

Frees up some variables and it's pretty clean, too.



Stop asking questions that I have already covered (in this same thread even) :p.

The trigger should remain almost exactly the same, except that you're not changing the fly height (and not the vertex coloring).

thx for the advice for the location

I'm simply refreshing the state (the unit is made out of particals so it can not be invisible)

show me for the flying height
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
DotCa said:
show me for the flying height
I'm sorry if this sounds rude, but did you even try this yourself? You can't expect everyone to do stuff for you, even after they explain how you can do this.
Sure, it'd be faster, but it's for the best if you actually did something yourself :).

What you need to know for this to work, is that you cannot change a unit's flying height to something negative by triggers.
So the default has to be negative, and then you need to revert that to a flying height of 0 (triggered) for the players who should be able to see the unit.
If you start from the trigger I gave you in my second post here and modify it, you should be able to work it out.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
I'm sorry if this sounds rude, but did you even try this yourself? You can't expect everyone to do stuff for you, even after they explain how you can do this.
Sure, it'd be faster, but it's for the best if you actually did something yourself :).

What you need to know for this to work, is that you cannot change a unit's flying height to something negative by triggers.
So the default has to be negative, and then you need to revert that to a flying height of 0 (triggered) for the players who should be able to see the unit.
If you start from the trigger I gave you in my second post here and modify it, you should be able to work it out.

I tried to make the flying height and when i failed i posted that i needed help
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Can someone explain what desync means

And the trigger is like that
Player (2) is owner of casting unit

  • Fire Strike
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fire Strike (Elemental)
    • Actions
      • Set Fire_Elemental_FireStrike = (Casting unit)
      • Set FireStrike_Target = (Target point of ability being cast)
      • Unit - Create 1 Flame strike first for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees
      • Custom script: if IsPlayerAlly(GetLocalPlayer(), Player(2)) then
      • Animation - Change (Last created unit) flying height to 3000.00 at 3000.00
      • Custom script: endif
      • Unit - Add a 3.50 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Flame strike Loop for Player 1 (Red) at FireStrike_Target facing Default building facing degrees
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Wait 3.00 seconds
      • Unit - Create 1 Flame strike final for Player 1 (Red) at FireStrike_Target facing Default building facing degrees
      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 2 (Blue)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 3 (Teal)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 4 (Purple)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 5 (Yellow)
              • (Owner of Fire_Elemental_FireStrike) Equal to Player 6 (Orange)
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 550.00 of FireStrike_Target matching ((((Owner of (Matching unit)) Equal to Player 7 (Green)) or (((Owner of (Matching unit)) Equal to Neutral Hostile) or ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Fire_El and do (Actions)
            • Loop - Actions
              • Unit - Cause Fire_Elemental_FireStrike to damage (Picked unit), dealing (90.00 x (Real((Level of Fire Strike (Elemental) for Fire_Elemental_FireStrike)))) damage of attack type Spells and damage type Magic
        • Else - Actions
          • Unit Group - Pick every unit in (Units within 550.00 of FireStrike_Target matching ((((Owner of (Matching unit)) Equal to Player 1 (Red)) or (((Owner of (Matching unit)) Equal to Neutral Hostile) or ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Fire_Elem and do (Actions)
            • Loop - Actions
              • Unit - Cause Fire_Elemental_FireStrike to damage (Picked unit), dealing (90.00 x (Real((Level of Fire Strike (Elemental) for Fire_Elemental_FireStrike)))) damage of attack type Spells and damage type Magic
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
  • Animation - Change (Last created unit) flying height to 3000.00 at 3000.00
Do you know what this means? It means that the unit will rise to a flying height of 3000 (which is way too high, you wouldn't be able to see a unit at that height either) over 3000 seconds (almost an hour).
Change it to "to 0.00 at 0.00".
Also, make sure that the unit's Movement-Type is set to "Flying".

Can someone explain what desync means
Simply said: when 2 players are receiving different information, the game will be split into 2 different states.
Here's an example: you create a unit for a local player (which is what you asked for).
Let's say you create it for Player 1, then only Player 1's game will have that unit.
The unit will not exist for Player 2, nor will it have any information of the unit's existence.

Because units usually do stuff (even if it is just blocking the path), the information for those players will be different.
Therefore, the games will be split into 2 states: one where the unit exists, one where it does not exist.
The players then get desynced (which essentially means that they cannot play together anymore).

GetLocalPlayer() is a dangerous tool to use if you don't know what you're doing, that's why we've got an entire thread dedicated to it.
And I have no idea whether that flying height will desync or not :). I think not, but who knows?
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Ah, wait a second!
With "Player(2)", do you mean Blue or Teal?

In JASS: Player(0) = Red, Player(1) = Blue, Player(2) = Teal.

ahahaha i mented player blue i'll make it player (1)....

EDIT: Still not working
and i found an alternative to it:
is there a way to scale special effects or create special effects on an invisible unit would be better?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
For scaling special effects, you can use the model dummy.mdx as a base unit (it's a very common model, seen in a lot of maps).
Attach the special effect to the chest of that dummy (scale of the dummy can be changed through triggers or in the object editor).

Special effects can be shown for a single player in the same way the vertex coloring works: use a temporary string, set it to <empty string> at first and within the local-block, set it to the special effect you want to show.
Outside the local block, create the effect.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
For scaling special effects, you can use the model dummy.mdx as a base unit (it's a very common model, seen in a lot of maps).
Attach the special effect to the chest of that dummy (scale of the dummy can be changed through triggers or in the object editor).

Special effects can be shown for a single player in the same way the vertex coloring works: use a temporary string, set it to <empty string> at first and within the local-block, set it to the special effect you want to show.
Outside the local block, create the effect.

thx for the dummy
but one last prob:
  • Fire Strike
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fire Strike (Elemental)
    • Actions
      • Set Fire_Elemental_FireStrike = (Casting unit)
      • Set FireStrike_Target = (Target point of ability being cast)
      • Unit - Create 1 Flame strike first (dummy model file) for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees
      • Unit - Add a 3.50 second Generic expiration timer to (Last created unit)
      • Custom script: if IsPlayerAlly(GetLocalPlayer(), GetOwningPlayer(GetSpellAbilityUnit())) then
      • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
      • Custom script: endif
      • Unit - Create 1 Flame strike Loop (dummy model file) for Player 1 (Red) at FireStrike_Target facing Default building facing degrees
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Custom script: if IsPlayerAlly(GetLocalPlayer(), GetOwningPlayer(GetSpellAbilityUnit())) then
      • Special Effect - Create a special effect attached to the chest of (Last created unit) using war3mapImporte\FireConsume.mdx
      • Custom script: endif
      • Wait 3.00 seconds
      • Unit - Create 1 Flame strike final for Player 1 (Red) at FireStrike_Target facing Default building facing degrees
      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
when i add expiration timer for the dummy he expires after a lot of time not after 3.5/5 seconds
do you know what's the prob?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
I recently realized something, couldn't we hide the unit for specific players?

we can hide but we cant create unit locally

create unit locally(create unit for 1 player only) != hide unit (show unit only for 1 player, but even others dont see the unit, the unit still can attack and will be visible special effect if he cast example a thunder clap)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Ok no problem since the unit will be an effect :p and won't move or attack

but if u attach attachment to unit that will be visible exclude if u make that too with getlocalplayer :p

could use soemthing like this
  • Set u = Gryphon Rider 0000 <gen>
  • Set o = 100.00
  • Set s = <Empty String>
  • Custom script: if IsPlayerAlly(GetLocalPlayer(), GetOwningPlayer(GetSpellAbilityUnit())) then
  • Set o = 0.00
  • Set s = units\human\Knight\Knight
  • Custom script: endif
  • Animation - Change u's vertex coloring to (100.00%, 100.00%, 100.00%) with o% transparency
  • Special Effect - Create a special effect attached to the overhead of u using s
 
If the unit can be normally selected ingame then changing the transparency of the unit won't change this. By dragging the mouse over the screen it is possible to find the unit as the unit would have a health bar. unless it has the locus ability.

So yeah the best solution for making it invisible would be to make it 100% transparent in your case as you said that you're unit is going to use the locus ability.
 
Status
Not open for further replies.
Top