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

Only Render Ubersplats/Images when visible

Status
Not open for further replies.
Level 5
Joined
May 6, 2013
Messages
125
Well, if someone uses thunderclap somewhere where you don't even see the unit (read: when the unit is covered by the fog of war), the ubersplat the spell creates is also invisible to you. Only if it was created in a visible area and then "wanders" into the fog of war (or to be more precise, the fog of war covers the ubersplat afterwards) are you able to see it.

Now, for trigger created ubersplats and, more importantly, trigger created images, this does not seem to apply. In the common.j i found the following natives:

- SetImageRenderAlways, which has to be set to true in order for the image to actually be visible
- SetImageRender, which seemingly does nothing at all
- ShowImage, which also has to be true, bringing up the question what the point of this function is when we have SetImageRenderAlways

I guess i might get a similar effect with ShowImage and GetLocalPlayer and IsVisibleToPlayer, but than again, GetLocalPlayer always bears the possibility to desync. So, before i go play with this last method, does anybody know a other way?
 
You have to use ShowImage locally.

It won't desync. I'm thinking you can do something along the lines of:
JASS:
call ShowImage(i, IsVisibleToPlayer(x, y, GetLocalPlayer()))
It is a creative way of doing it. However, I haven't tested it. To be sure you can just do something along the lines of:
JASS:
local integer i = 0
call ShowImage(img, false)
loop
    exitwhen i > 11
    if IsVisibleToPlayer(x, y, Player(i)) and GetLocalPlayer() == Player(i) then
        call ShowImage(img, true)
    endif
    set i = i + 1
endloop
Where img is an image variable and x and y are real variables representing the coordinates of the image.
 
Status
Not open for further replies.
Top