• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

show Floating text only to players which can view the unit.

Status
Not open for further replies.
Level 16
Joined
Aug 20, 2009
Messages
1,552
i am using a normal usual damage detection floating text.

i want the floating text to be shown only to players which has a view of the units.

such as, player 1 has unit A in view, so he can see floating text when unit A gets damaged,

PLayer 2 has no view, since it is in the fog of war, so he can't see the floating text on the unit. even if he gets damaged.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • ((Triggering unit) is fogged to (Picked player)) Equal to True
              • ((Triggering unit) is invisible to (Picked player)) Equal to True
              • ((Triggering unit) is masked to (Picked player)) Equal to True
        • Then - Actions
          • Floating Text - Hide (Last created floating text) for (Player group((Picked player)))
        • Else - Actions
Add this to Damage Detection trigger,after the floating text is created.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
I think he/she meant the force in there:

  • Floating Text - Hide (Last created floating text) for (Player group((Picked player)))

And yes, this one creates a fresh force.

  • ((Triggering unit) is fogged to (Picked player)) Equal to True
  • ((Triggering unit) is invisible to (Picked player)) Equal to True
  • ((Triggering unit) is masked to (Picked player)) Equal to True

Doesn't invisible already unite fogged and masked?
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
To prevent leak,use
  • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
  • Custom script: call SetTextTagVisibility(bj_lastCreatedTextTag,false)
  • Custom script: endif
instead of
  • Floating Text - Hide (Last created floating text) for (Player group((Picked player)))
And for invisibility,WaterKnight - i wasn't sure so i put all 3 conditions,it won't have any negative effect.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
No, you make a new force and you do not remove it and throw all references away to it. In proper games (SC2) a garbage collector would catch it and remove it for you but in WC3 it will just stick in memory, slowing the game down for certain opperations.

All players returns a constant force (the same force object) and thus it can not leak. Remvoing it will even cause bugs cause all future references to it will return null.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Take it easy, Simply use this, don't make it complex:
  • Floating Text - Hide (Last created floating text) for (All enemies of (Owner of (Triggering unit)))
Well, because of your "take it easy, make it simple", congratulations, you have misunderstood the thread :D
He wanted to make Floating Text ONLY appear to a unit when in vision OR in Sight Radius
He don't want if that the unit is in fogged, the floating text can still be seen
If the unit is in radius sight of the player unit, floating text will be shown
IF you use that condition of yours...
Even if the unit is in sight radius, the floating text won't appear because that unit is your enemy
 
Level 6
Joined
Jun 19, 2010
Messages
143
Well, it appears to the allies of me & me of course who obviously have the view of the unit. all of my enermies will not have that unit in sight radius because they are my ENERMIES. My condition prevents them to see the floating text even when the enermies get the unit in their sight radius.

If the unit is in fogged, u couldn't see neither the unit nor the floating text. It is reasonable. It is weird if you wanna see the floating text when you cannot view it.

Yaa, but you r right, if using my one, in the solo mode, ur enermy couldn't see it aswell.
 
Level 16
Joined
Aug 20, 2009
Messages
1,552
sadly they do...

Player Group
Note: (All Players) does not leak, and destroying it can result in problems
Player Groups leak also, but those are really rare. The fix:

  • Player Group
    • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
    • (Ability being cast) Equal to Some Spell
    • Actions
    • Set PlayerGroup = (All enemies of Player 1 (Red))
    • Player Group - Pick every player in PlayerGroup and do (Do nothing)
    • Custom script: call DestroyForce(udg_PlayerGroup)

anyways no, they haven't misunderstood, it works perfectly just like what i wanted :)
 
Status
Not open for further replies.
Top