ID:802162
 
Keywords: client, help, overlay
(See the best response by DarkCampainger.)
Essentially when a character uses a certain technique, it lets them see how much energy each client around them has. I wanted to make this a graphic representation before adding it to the game. Is there any way of adding to a character an overlay that can not only be changed, but can only be viewed by users with a specific technique?


Thanks a lot in advance!
Perhaps map_text could come in handy here.
This sounds like something you are going to need images for. As for changing it, you'll have to make a new image every time it changes. Don't even bother putting the image in the overlays, just keep it in a list.

var/list/technique_visible_only = list()


Then loop through the list and add each image to their client.screen if they have the technique.
I was thinking though, if I set it as just a variable and then displayed through the << operator, would I be able to change its icon state?

mob
New()
I_Tar = image('EnergyDisplay.dmi',src)
return ..()

And then in the techniques code display like this
usr << M.I_Tar

Edit: Where M is a reference to all client's on the users screen

Otherwise a list would be the only way to work it right? D:
You can change an image's variables after outputting it to a client and it will update. So having each mob with their own display image that they manage may be the easiest way to go, especially if this kind of ability is common.

Also, don't forget to manually delete the image when the owning mob logs out.
Oh yeah definitely, I just wasn't sure if you change the I_Tar definition. because it displays an icon that equates to that character's % energy left at the time the move is used.

I_Tar=image('somethingdifferent.dmi',M)
(where M is the mob who's overlay will change)
Wherever I want would work then?
In response to Asakuraboy
Best response
No, you want to keep the existing /image object, otherwise you'll have to re-output that new object to all the player who should be able to see it:
// In the function that alters energy levels
src.I_Tar.icon_state = "[EnergyLevel]" // Just change the icon_state of the existing image
I think there might be a way to combine Forum_account's Overlays library with his Visibility Groups library. If so, you could just give every mob an overlay in a group, "energy overlay". When the ability is activated, all you need to do is call vis.can_see("energy overlay"), and every mob's energy overlay will become visible to you (and everyone else who uses the skill).
AH HA, thank you Dark. :)
In response to Kaiochao
Kaiochao wrote:
I think there might be a way to combine Forum_account's Overlays library with his Visibility Groups library. If so, you could just give every mob an overlay in a group, "energy overlay". When the ability is activated, all you need to do is call vis.can_see("energy overlay"), and every mob's energy overlay will become visible to you (and everyone else who uses the skill).

It's even simpler than that. The /Overlay object has a ShowTo() proc which automatically converts the overlay to an image object and shows it to only the players you've specified. You'd just have to do something like this:

mob
var
Overlay/energy_meter

New()
..()
energy_meter = overlay('energy-meter.dmi')

verb
see_everyones_energy()
for(var/mob/m in players)
m.energy_meter.ShowTo(src)
Since when did Byond have a ShowTo proc!? xD

For any admin reading this, case closed and working! :D
In response to Asakuraboy
Asakuraboy wrote:
Since when did Byond have a ShowTo proc!? xD

Since I added that proc to the Overlays library back in February =)
I see, I thought you meant that it was added to the compiler.. Was gon'say wutttt xD